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
This commit is contained in:
mistic100 2013-10-19 17:43:04 +00:00
parent 35ff1b7c1f
commit ae707279a1
89 changed files with 700 additions and 1084 deletions

View file

@ -113,13 +113,7 @@ SELECT
;'; ;';
list($group_name) = pwg_db_fetch_row(pwg_query($query)); 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
)
);
} }
// +-----------------------------------------------------------------------+ // +-----------------------------------------------------------------------+

View file

@ -177,10 +177,7 @@ SELECT element_id
FROM '.CADDIE_TABLE.' FROM '.CADDIE_TABLE.'
WHERE user_id = '.$user['id'].' WHERE user_id = '.$user['id'].'
;'; ;';
array_push( $filter_sets[] = array_from_query($query, 'element_id');
$filter_sets,
array_from_query($query, 'element_id')
);
break; break;
@ -190,10 +187,7 @@ SELECT image_id
FROM '.FAVORITES_TABLE.' FROM '.FAVORITES_TABLE.'
WHERE user_id = '.$user['id'].' WHERE user_id = '.$user['id'].'
;'; ;';
array_push( $filter_sets[] = array_from_query($query, 'image_id');
$filter_sets,
array_from_query($query, 'image_id')
);
break; break;
@ -210,10 +204,7 @@ SELECT id
FROM '.IMAGES_TABLE.' FROM '.IMAGES_TABLE.'
WHERE date_available BETWEEN '.pwg_db_get_recent_period_expression(1, $row['date']).' AND \''.$row['date'].'\' 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; break;
@ -242,10 +233,7 @@ SELECT id
$linked_to_virtual = array_from_query($query, 'image_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; break;
@ -257,10 +245,7 @@ SELECT
LEFT JOIN '.IMAGE_CATEGORY_TABLE.' ON id = image_id LEFT JOIN '.IMAGE_CATEGORY_TABLE.' ON id = image_id
WHERE category_id is null WHERE category_id is null
;'; ;';
array_push( $filter_sets[] = array_from_query($query, 'id');
$filter_sets,
array_from_query($query, 'id')
);
break; break;
@ -272,10 +257,7 @@ SELECT
LEFT JOIN '.IMAGE_TAG_TABLE.' ON id = image_id LEFT JOIN '.IMAGE_TAG_TABLE.' ON id = image_id
WHERE tag_id is null WHERE tag_id is null
;'; ;';
array_push( $filter_sets[] = array_from_query($query, 'id');
$filter_sets,
array_from_query($query, 'id')
);
break; break;
@ -297,11 +279,7 @@ SELECT id
FROM '.IMAGES_TABLE.' FROM '.IMAGES_TABLE.'
WHERE file IN (\''.implode("','", $duplicate_files).'\') WHERE file IN (\''.implode("','", $duplicate_files).'\')
;'; ;';
$filter_sets[] = array_from_query($query, 'id');
array_push(
$filter_sets,
array_from_query($query, 'id')
);
break; break;
@ -337,10 +315,7 @@ if (isset($_SESSION['bulk_manager_filter']['category']))
FROM '.IMAGE_CATEGORY_TABLE.' FROM '.IMAGE_CATEGORY_TABLE.'
WHERE category_id IN ('.implode(',', $categories).') 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'])) if (isset($_SESSION['bulk_manager_filter']['level']))
@ -362,15 +337,12 @@ SELECT id
if (!empty($_SESSION['bulk_manager_filter']['tags'])) if (!empty($_SESSION['bulk_manager_filter']['tags']))
{ {
array_push( $filter_sets[] = get_image_ids_for_tags(
$filter_sets, $_SESSION['bulk_manager_filter']['tags'],
get_image_ids_for_tags( $_SESSION['bulk_manager_filter']['tag_mode'],
$_SESSION['bulk_manager_filter']['tags'], null,
$_SESSION['bulk_manager_filter']['tag_mode'], null,
null, false // we don't apply permissions in administration screens
null,
false // we don't apply permissions in administration screens
)
); );
} }

View file

@ -82,7 +82,7 @@ if (isset($_POST['submit']))
// photo in the selection // photo in the selection
if (count($collection) == 0) 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']; $action = $_POST['selectAction'];
@ -105,7 +105,7 @@ DELETE
{ {
if (empty($_POST['add_tags'])) if (empty($_POST['add_tags']))
{ {
array_push($page['errors'], l10n('Select at least one tag')); $page['errors'][] = l10n('Select at least one tag');
} }
else else
{ {
@ -133,7 +133,7 @@ DELETE
} }
else 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(); $datas = array();
foreach ($collection as $image_id) foreach ($collection as $image_id)
{ {
array_push( $datas[] = array(
$datas, 'id' => $image_id,
array( 'author' => $_POST['author']
'id' => $image_id,
'author' => $_POST['author']
)
); );
} }
@ -268,12 +265,9 @@ DELETE
$datas = array(); $datas = array();
foreach ($collection as $image_id) foreach ($collection as $image_id)
{ {
array_push( $datas[] = array(
$datas, 'id' => $image_id,
array( 'name' => $_POST['title']
'id' => $image_id,
'name' => $_POST['title']
)
); );
} }
@ -302,12 +296,9 @@ DELETE
$datas = array(); $datas = array();
foreach ($collection as $image_id) foreach ($collection as $image_id)
{ {
array_push( $datas[] = array(
$datas, 'id' => $image_id,
array( 'date_creation' => $date_creation
'id' => $image_id,
'date_creation' => $date_creation
)
); );
} }
@ -324,12 +315,9 @@ DELETE
$datas = array(); $datas = array();
foreach ($collection as $image_id) foreach ($collection as $image_id)
{ {
array_push( $datas[] = array(
$datas, 'id' => $image_id,
array( 'level' => $_POST['level']
'id' => $image_id,
'level' => $_POST['level']
)
); );
} }
@ -362,15 +350,9 @@ DELETE
$deleted_count = delete_elements($collection, true); $deleted_count = delete_elements($collection, true);
if ($deleted_count > 0) if ($deleted_count > 0)
{ {
$_SESSION['page_infos'] = array( $_SESSION['page_infos'][] = l10n_dec(
sprintf( '%d photo was deleted', '%d photos were deleted',
l10n_dec( $deleted_count
'%d photo was deleted',
'%d photos were deleted',
$deleted_count
),
$deleted_count
)
); );
$redirect_url = get_root_url().'admin.php?page='.$_GET['page']; $redirect_url = get_root_url().'admin.php?page='.$_GET['page'];
@ -378,12 +360,12 @@ DELETE
} }
else else
{ {
array_push($page['errors'], l10n('No photo can be deleted')); $page['errors'][] = l10n('No photo can be deleted');
} }
} }
else 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) if ('metadata' == $action)
{ {
sync_metadata($collection); sync_metadata($collection);
$page['infos'][] = l10n('Metadata synchronized from file');
array_push(
$page['infos'],
l10n('Metadata synchronized from file')
);
} }
if ('delete_derivatives' == $action) if ('delete_derivatives' == $action)
@ -415,11 +393,13 @@ DELETE
if ('generate_derivatives' == $action) if ('generate_derivatives' == $action)
{ {
if ($_POST['regenerateSuccess'] != '0') 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') 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); trigger_action('element_set_global_action', $action, $collection);
@ -444,9 +424,7 @@ $prefilters = array(
if ($conf['enable_synchronization']) if ($conf['enable_synchronization'])
{ {
array_push($prefilters, $prefilters[] = array('ID' => 'no_virtual_album', 'NAME' => l10n('With no virtual album'));
array('ID' => 'no_virtual_album', 'NAME' => l10n('With no virtual album'))
);
} }
$prefilters = trigger_event('get_batch_manager_prefilters', $prefilters); $prefilters = trigger_event('get_batch_manager_prefilters', $prefilters);

View file

@ -103,7 +103,7 @@ SELECT id, date_creation
$data['date_creation'] = $row['date_creation']; $data['date_creation'] = $row['date_creation'];
} }
array_push($datas, $data); $datas[] = $data;
// tags management // tags management
$tag_ids = array(); $tag_ids = array();
@ -123,7 +123,7 @@ SELECT id, date_creation
$datas $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)) while ($row = pwg_db_fetch_assoc($result))
{ {
array_push($element_ids, $row['id']); $element_ids[] = $row['id'];
$src_image = new SrcImage($row); $src_image = new SrcImage($row);

View file

@ -78,7 +78,7 @@ function save_categories_order($categories)
$current_rank++; $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')); $fields = array('primary' => array('id'), 'update' => array('rank'));
mass_updates(CATEGORIES_TABLE, $fields, $datas); mass_updates(CATEGORIES_TABLE, $fields, $datas);
@ -133,11 +133,11 @@ else if (isset($_POST['submitAdd']))
if (isset($output_create['error'])) if (isset($output_create['error']))
{ {
array_push($page['errors'], $output_create['error']); $page['errors'][] = $output_create['error'];
} }
else else
{ {
array_push($page['infos'], $output_create['info']); $page['infos'][] = $output_create['info'];
} }
} }
// save manual category ordering // save manual category ordering
@ -146,10 +146,7 @@ else if (isset($_POST['submitManualOrder']))
asort($_POST['catOrd'], SORT_NUMERIC); asort($_POST['catOrd'], SORT_NUMERIC);
save_categories_order(array_keys($_POST['catOrd'])); 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'])) else if (isset($_POST['submitAutoOrder']))
{ {
@ -178,17 +175,11 @@ SELECT id, name, id_uppercat
$result = pwg_query($query); $result = pwg_query($query);
while ($row = pwg_db_fetch_assoc($result)) while ($row = pwg_db_fetch_assoc($result))
{ {
array_push( $categories[] = array(
$categories, 'id' => $row['id'],
array( 'id_uppercat' => $row['id_uppercat'],
'id' => $row['id'],
'id_uppercat' => $row['id_uppercat'],
)
);
array_push(
$names,
$row['name']
); );
$names[] = $row['name'];
} }
array_multisort( array_multisort(
@ -199,10 +190,7 @@ SELECT id, name, id_uppercat
); );
save_categories_order($categories); save_categories_order($categories);
array_push( $page['infos'][] = l10n('Albums automatically sorted');
$page['infos'],
l10n('Albums automatically sorted')
);
} }
// +-----------------------------------------------------------------------+ // +-----------------------------------------------------------------------+

View file

@ -51,10 +51,7 @@ if (isset($_POST['submit']))
} }
else else
{ {
array_push( $page['errors'][] = l10n('Select at least one album');
$page['errors'],
l10n('Select at least one album')
);
} }
} }

View file

@ -125,7 +125,7 @@ SELECT
$result = pwg_query($query); $result = pwg_query($query);
while ($row = pwg_db_fetch_assoc($result)) 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(); $inserts = array();
@ -135,12 +135,9 @@ SELECT
$group_ids = array_diff($grant_groups, $granteds[$cat_id]); $group_ids = array_diff($grant_groups, $granteds[$cat_id]);
foreach ($group_ids as $group_id) foreach ($group_ids as $group_id)
{ {
array_push( $inserts[] = array(
$inserts, 'group_id' => $group_id,
array( 'cat_id' => $cat_id
'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); $result = pwg_query($query);
while ($row = pwg_db_fetch_assoc($result)) 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(); $user_granted_by_group_ids = array();
@ -302,7 +299,7 @@ SELECT user_id, group_id
{ {
if (in_array($user_id, $user_granted_indirect_ids)) if (in_array($user_id, $user_granted_indirect_ids))
{ {
array_push($group_usernames, $users[$user_id]); $group_usernames[] = $users[$user_id];
} }
} }

View file

@ -41,10 +41,7 @@ if (!empty($_POST))
{ {
if (empty($_POST['comments'])) if (empty($_POST['comments']))
{ {
array_push( $page['errors'][] = l10n('Select at least one comment');
$page['errors'],
l10n('Select at least one comment')
);
} }
else else
{ {
@ -55,12 +52,9 @@ if (!empty($_POST))
{ {
validate_user_comment($_POST['comments']); validate_user_comment($_POST['comments']);
array_push( $page['infos'][] = l10n_dec(
$page['infos'], '%d user comment validated', '%d user comments validated',
l10n_dec( count($_POST['comments'])
'%d user comment validated', '%d user comments validated',
count($_POST['comments'])
)
); );
} }
@ -68,12 +62,9 @@ if (!empty($_POST))
{ {
delete_user_comment($_POST['comments']); delete_user_comment($_POST['comments']);
array_push( $page['infos'][] = l10n_dec(
$page['infos'], '%d user comment rejected', '%d user comments rejected',
l10n_dec( count($_POST['comments'])
'%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) ); $template->assign('LIST', implode(',', $list) );

View file

@ -154,7 +154,7 @@ if (isset($_POST['submit']))
} }
if ( !count($_POST['order_by']) ) if ( !count($_POST['order_by']) )
{ {
array_push($page['errors'], l10n('No order field selected')); $page['errors'][] = l10n('No order field selected');
} }
else else
{ {
@ -179,7 +179,7 @@ if (isset($_POST['submit']))
} }
else 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'] < 5
or $_POST['nb_comment_page'] > 50) 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) foreach( $comments_checkboxes as $checkbox)
{ {
@ -225,7 +225,7 @@ if (isset($_POST['submit']))
if (!preg_match($int_pattern, $_POST['nb_categories_page']) if (!preg_match($int_pattern, $_POST['nb_categories_page'])
or $_POST['nb_categories_page'] < 4) 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) foreach( $display_checkboxes as $checkbox)
{ {
@ -268,7 +268,7 @@ WHERE param = \''.$row['param'].'\'
pwg_query($query); pwg_query($query);
} }
} }
array_push($page['infos'], l10n('Information data registered in database')); $page['infos'][] = l10n('Information data registered in database');
} }
//------------------------------------------------------ $conf reinitialization //------------------------------------------------------ $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\''); pwg_query('DELETE FROM '.CONFIG_TABLE.' WHERE param = \'disabled_derivatives\'');
clear_derivative_cache(); clear_derivative_cache();
array_push( $page['infos'][] = l10n('Your configuration settings are saved');
$page['infos'],
l10n('Your configuration settings are saved')
);
} }
//----------------------------------------------------- template initialization //----------------------------------------------------- template initialization
@ -324,7 +321,7 @@ switch ($page['section'])
if (order_by_is_local()) 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']) ) if ( isset($conf['order_by_custom']) or isset($conf['order_by_inside_category_custom']) )
@ -400,7 +397,7 @@ switch ($page['section'])
{ {
// Reload user // Reload user
$edit_user = build_user($conf['guest_id'], false); $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); $page['errors'] = array_merge($page['errors'], $errors);

View file

@ -64,13 +64,10 @@ function save_images_order($category_id, $images)
$datas = array(); $datas = array();
foreach ($images as $id) foreach ($images as $id)
{ {
array_push( $datas[] = array(
$datas, 'category_id' => $category_id,
array( 'image_id' => $id,
'category_id' => $category_id, 'rank' => ++$current_rank,
'image_id' => $id,
'rank' => ++$current_rank,
)
); );
} }
$fields = array( $fields = array(
@ -98,10 +95,7 @@ if (isset($_POST['submit']))
array_keys($_POST['rank_of_image']) 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']) if (!empty($_POST['image_order_choice'])
@ -143,7 +137,7 @@ UPDATE '.CATEGORIES_TABLE.'
pwg_query($query); pwg_query($query);
} }
array_push($page['infos'], l10n('Your configuration settings are saved')); $page['infos'][] = l10n('Your configuration settings are saved');
} }
// +-----------------------------------------------------------------------+ // +-----------------------------------------------------------------------+

View file

@ -149,8 +149,7 @@ UPDATE '.CONFIG_TABLE.'
WHERE param = \'extents_for_templates\';'; WHERE param = \'extents_for_templates\';';
if (pwg_query($query)) if (pwg_query($query))
{ {
array_push($page['infos'], $page['infos'][] = l10n('Templates configuration has been recorded.');
l10n('Templates configuration has been recorded.'));
} }
} }

View file

@ -45,7 +45,7 @@ if (isset($_POST['submit_add']))
{ {
if (empty($_POST['groupname'])) 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) if (count($page['errors']) == 0)
{ {
@ -58,7 +58,7 @@ SELECT COUNT(*)
list($count) = pwg_db_fetch_row(pwg_query($query)); list($count) = pwg_db_fetch_row(pwg_query($query));
if ($count != 0) 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) if (count($page['errors']) == 0)
@ -86,7 +86,7 @@ if (isset($_POST['submit']) and isset($_POST['selectAction']) and isset($_POST['
$groups = $_POST['group_selection']; $groups = $_POST['group_selection'];
if (count($groups) == 0) 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']; $action = $_POST['selectAction'];
@ -169,7 +169,7 @@ SELECT COUNT(*)
list($count) = pwg_db_fetch_row(pwg_query($query)); list($count) = pwg_db_fetch_row(pwg_query($query));
if ($count != 0) 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 else
{ {
@ -255,7 +255,7 @@ SELECT COUNT(*)
list($count) = pwg_db_fetch_row(pwg_query($query)); list($count) = pwg_db_fetch_row(pwg_query($query));
if ($count != 0) 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; break;
} }
// creating the group // creating the group

View file

@ -81,7 +81,7 @@ SELECT id
$result = pwg_query($query); $result = pwg_query($query);
while ($row = pwg_db_fetch_assoc($result)) 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 // 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)) while ($row = pwg_db_fetch_assoc($result))
{ {
array_push($authorized_ids, $row['cat_id']); $authorized_ids[] = $row['cat_id'];
} }
$inserts = array(); $inserts = array();
$to_autorize_ids = array_diff($private_uppercats, $authorized_ids); $to_autorize_ids = array_diff($private_uppercats, $authorized_ids);
foreach ($to_autorize_ids as $to_autorize_id) foreach ($to_autorize_ids as $to_autorize_id)
{ {
array_push( $inserts[] = array(
$inserts, 'group_id' => $page['group'],
array( 'cat_id' => $to_autorize_id
'group_id' => $page['group'],
'cat_id' => $to_autorize_id
)
); );
} }
@ -158,7 +155,7 @@ $result = pwg_query($query_true);
$authorized_ids = array(); $authorized_ids = array();
while ($row = pwg_db_fetch_assoc($result)) while ($row = pwg_db_fetch_assoc($result))
{ {
array_push($authorized_ids, $row['id']); $authorized_ids[] = $row['id'];
} }
$query_false = ' $query_false = '

View file

@ -164,7 +164,7 @@ INSERT INTO '.SEARCH_TABLE.'
} }
else else
{ {
array_push($page['errors'], l10n('Empty query. No criteria has been entered.')); $page['errors'][] = l10n('Empty query. No criteria has been entered.');
} }
} }

View file

@ -71,9 +71,10 @@ class check_integrity
// Information // Information
if (count($this->retrieve_list) > 0) if (count($this->retrieve_list) > 0)
{ {
$header_notes[] = $header_notes[] = l10n_dec(
l10n_dec('%d anomaly has been detected.', '%d anomalies have been detected.', '%d anomaly has been detected.', '%d anomalies have been detected.',
count($this->retrieve_list)); count($this->retrieve_list)
);
} }
// Treatments // Treatments
@ -116,15 +117,17 @@ class check_integrity
if ($corrected_count > 0) if ($corrected_count > 0)
{ {
$page['infos'][] = $page['infos'][] = l10n_dec(
l10n_dec('%d anomaly has been corrected.', '%d anomalies have been detected corrected.', '%d anomaly has been corrected.', '%d anomalies have been detected corrected.',
$corrected_count); $corrected_count
);
} }
if ($not_corrected_count > 0) if ($not_corrected_count > 0)
{ {
$page['errors'][] = $page['errors'][] = l10n_dec(
l10n_dec('%d anomaly has not been corrected.', '%d anomalies have not been corrected.', '%d anomaly has not been corrected.', '%d anomalies have not been corrected.',
$not_corrected_count); $not_corrected_count
);
} }
} }
else else
@ -145,9 +148,10 @@ class check_integrity
if ($ignored_count > 0) if ($ignored_count > 0)
{ {
$page['infos'][] = $page['infos'][] = l10n_dec(
l10n_dec('%d anomaly has been ignored.', '%d anomalies have been ignored.', '%d anomaly has been ignored.', '%d anomalies have been ignored.',
$ignored_count); $ignored_count
);
} }
} }
} }

View file

@ -254,10 +254,7 @@ if (count($errors) == 0)
clear_derivative_cache($changed_types); clear_derivative_cache($changed_types);
} }
array_push( $page['infos'][] = l10n('Your configuration settings are saved');
$page['infos'],
l10n('Your configuration settings are saved')
);
} }
else else
{ {

View file

@ -174,10 +174,7 @@ if (count($errors) == 0)
clear_derivative_cache($changed_types); clear_derivative_cache($changed_types);
} }
array_push( $page['infos'][] = l10n('Your configuration settings are saved');
$page['infos'],
l10n('Your configuration settings are saved')
);
} }
else else
{ {

View file

@ -540,7 +540,7 @@ function get_fs_directories($path, $recursive = true)
and $node != 'pwg_representative' and $node != 'pwg_representative'
and is_dir($path.'/'.$node)) and is_dir($path.'/'.$node))
{ {
array_push($dirs, $path.'/'.$node); $dirs[] = $path.'/'.$node;
if ($recursive) if ($recursive)
{ {
$dirs = array_merge($dirs, get_fs_directories($path.'/'.$node)); $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)); list($representative) = pwg_db_fetch_row(pwg_query($query));
array_push( $datas[] = array(
$datas, 'id' => $category_id,
array( 'representative_picture_id' => $representative,
'id' => $category_id,
'representative_picture_id' => $representative,
)
); );
} }
@ -862,26 +859,26 @@ function get_fs($path, $recursive = true)
{ {
if (basename($path) == 'thumbnail') if (basename($path) == 'thumbnail')
{ {
array_push($fs['thumbnails'], $path.'/'.$node); $fs['thumbnails'][] = $path.'/'.$node;
} }
else if (basename($path) == 'pwg_representative') else if (basename($path) == 'pwg_representative')
{ {
array_push($fs['representatives'], $path.'/'.$node); $fs['representatives'][] = $path.'/'.$node;
} }
else else
{ {
array_push($fs['elements'], $path.'/'.$node); $fs['elements'][] = $path.'/'.$node;
} }
} }
// else if (in_array($extension, $conf['file_ext'])) // else if (in_array($extension, $conf['file_ext']))
else if (isset($conf['flip_file_ext'][$extension])) 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) 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; $uppercat = $id;
while ($uppercat) while ($uppercat)
{ {
array_push($upper_list, $uppercat); $upper_list[] = $uppercat;
$uppercat = $cat_map[$uppercat]['id_uppercat']; $uppercat = $cat_map[$uppercat]['id_uppercat'];
} }
$new_uppercats = implode(',', array_reverse($upper_list)); $new_uppercats = implode(',', array_reverse($upper_list));
if ($new_uppercats != $cat['uppercats']) if ($new_uppercats != $cat['uppercats'])
{ {
array_push( $datas[] = array(
$datas, 'id' => $id,
array( 'uppercats' => $new_uppercats
'id' => $id,
'uppercats' => $new_uppercats
)
); );
} }
} }
@ -1095,10 +1089,7 @@ SELECT uppercats
// into a new parent category with uppercats 12,125,13,14,24 // into a new parent category with uppercats 12,125,13,14,24
if (preg_match('/^'.$category['uppercats'].'(,|$)/', $new_parent_uppercats)) 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; return;
} }
} }
@ -1177,12 +1168,9 @@ DELETE FROM '.$table.'
} }
} }
array_push( $page['infos'][] = l10n_dec(
$page['infos'], '%d album moved', '%d albums moved',
l10n_dec( count($categories)
'%d album moved', '%d albums moved',
count($categories)
)
); );
} }
@ -1307,12 +1295,9 @@ SELECT id, uppercats, global_rank, visible, status
$inserts = array(); $inserts = array();
foreach ($granted_grps as $granted_grp) foreach ($granted_grps as $granted_grp)
{ {
array_push( $inserts[] = array(
$inserts, 'group_id' => $granted_grp,
array( 'cat_id' => $inserted_id
'group_id' => $granted_grp,
'cat_id' => $inserted_id
)
); );
} }
mass_inserts(GROUP_ACCESS_TABLE, array('group_id','cat_id'), $inserts); mass_inserts(GROUP_ACCESS_TABLE, array('group_id','cat_id'), $inserts);
@ -1586,13 +1571,10 @@ SELECT
{ {
$rank = ++$current_rank_of[$category_id]; $rank = ++$current_rank_of[$category_id];
array_push( $inserts[] = array(
$inserts, 'image_id' => $image_id,
array( 'category_id' => $category_id,
'image_id' => $image_id, 'rank' => $rank,
'category_id' => $category_id,
'rank' => $rank,
)
); );
} }
} }
@ -2315,7 +2297,7 @@ SELECT
$result = pwg_query($query); $result = pwg_query($query);
while ($row = pwg_db_fetch_assoc($result)) 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(); $inserts = array();
@ -2326,12 +2308,9 @@ SELECT
foreach ($grant_to_users as $user_id) foreach ($grant_to_users as $user_id)
{ {
array_push( $inserts[] = array(
$inserts, 'user_id' => $user_id,
array( 'cat_id' => $cat_id
'user_id' => $user_id,
'cat_id' => $cat_id
)
); );
} }
} }
@ -2513,7 +2492,7 @@ function get_dirs($directory)
and is_dir($directory.'/'.$file) and is_dir($directory.'/'.$file)
and $file != '.svn') and $file != '.svn')
{ {
array_push($sub_dirs, $file); $sub_dirs[] = $file;
} }
} }
closedir($opendir); closedir($opendir);

View file

@ -58,18 +58,12 @@ SELECT
if (isset($search['fields']['date-after'])) 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'])) 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'])) if (isset($search['fields']['types']))
@ -88,34 +82,25 @@ SELECT
$clause.= "= '".$type."'"; $clause.= "= '".$type."'";
} }
array_push($local_clauses, $clause); $local_clauses[] = $clause;
} }
} }
if (count($local_clauses) > 0) if (count($local_clauses) > 0)
{ {
array_push( $clauses[] = implode(' OR ', $local_clauses);
$clauses,
implode(' OR ', $local_clauses)
);
} }
} }
if (isset($search['fields']['user']) if (isset($search['fields']['user'])
and $search['fields']['user'] != -1) 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'])) 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'])) if (isset($search['fields']['filename']))
@ -123,14 +108,11 @@ SELECT
if (count($search['image_ids']) == 0) if (count($search['image_ids']) == 0)
{ {
// a clause that is always false // a clause that is always false
array_push($clauses, '1 = 2 '); $clauses[] = '1 = 2 ';
} }
else 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)) while ($row = pwg_db_fetch_assoc($result))
{ {
array_push($data, $row); $data[] = $row;
} }
return $data; return $data;
@ -177,4 +159,4 @@ SELECT
add_event_handler('get_history', 'get_history', EVENT_HANDLER_PRIORITY_NEUTRAL, 3); add_event_handler('get_history', 'get_history', EVENT_HANDLER_PRIORITY_NEUTRAL, 3);
trigger_action('functions_history_included'); trigger_action('functions_history_included');
?> ?>

View file

@ -96,7 +96,7 @@ function install_db_connect(&$infos, &$errors)
} }
catch (Exception $e) catch (Exception $e)
{ {
array_push( $errors, l10n($e->getMessage())); $errors[] = l10n($e->getMessage());
} }
} }
?> ?>

View file

@ -219,23 +219,20 @@ SELECT id, path, representative_ext
foreach (explode(',', $data[$key]) as $tag_name) 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; $data['date_metadata_update'] = CURRENT_DATE;
array_push($datas, $data); $datas[] = $data;
} }
if (count($datas) > 0) if (count($datas) > 0)
{ {
$update_fields = get_sync_metadata_attributes(); $update_fields = get_sync_metadata_attributes();
array_push($update_fields, 'date_metadata_update'); $update_fields[] = 'date_metadata_update';
$update_fields = array_diff( $update_fields = array_diff(
$update_fields, $update_fields,
@ -297,7 +294,7 @@ SELECT id
$result = pwg_query($query); $result = pwg_query($query);
while ($row = pwg_db_fetch_assoc($result)) while ($row = pwg_db_fetch_assoc($result))
{ {
array_push($cat_ids, $row['id']); $cat_ids[] = $row['id'];
} }
if (count($cat_ids) == 0) if (count($cat_ids) == 0)

View file

@ -169,7 +169,7 @@ order by';
{ {
while ($nbm_user = pwg_db_fetch_assoc($result)) 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; global $page, $env_nbm;
$env_nbm['sent_mail_count'] += 1; $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; global $page, $env_nbm;
$env_nbm['error_on_mail_count'] += 1; $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) 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) 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 else
{ {
if ($env_nbm['sent_mail_count'] == 0) if ($env_nbm['sent_mail_count'] == 0)
array_push($page['infos'], l10n('No mail to send.')); {
$page['infos'][] = l10n('No mail to send.');
}
else 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()) if (check_sendmail_timeout())
{ {
// Stop fill list on 'send', if the quota is override // Stop fill list on 'send', if the quota is override
array_push($page['errors'], $msg_break_timeout); $page['errors'][] = $msg_break_timeout;
break; break;
} }
// Fill return list // Fill return list
array_push($check_key_treated, $nbm_user['check_key']); $check_key_treated[] = $nbm_user['check_key'];
$do_update = true; $do_update = true;
if ($nbm_user['mail_address'] != '') if ($nbm_user['mail_address'] != '')
@ -453,22 +469,17 @@ function do_subscribe_unsubscribe_notification_by_mail($is_admin_request, $is_su
if ($do_update) if ($do_update)
{ {
array_push $updates[] = array(
( 'check_key' => $nbm_user['check_key'],
$updates, 'enabled' => $enabled_value
array );
(
'check_key' => $nbm_user['check_key'],
'enabled' => $enabled_value
)
);
$updated_data_count += 1; $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 else
{ {
$error_on_updated_data_count += 1; $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) if ($error_on_updated_data_count != 0)
{ {
array_push($page['errors'], $page['errors'][] = l10n_dec(
l10n_dec('%d user was not updated.', '%d user was not updated.', '%d users were not updated.',
'%d users were not updated.', $error_on_updated_data_count
$error_on_updated_data_count)); );
} }
unset_make_full_url(); unset_make_full_url();

View file

@ -39,7 +39,7 @@ function get_admin_plugin_menu_link($file)
} }
else if (isset($page['errors'])) 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; return $url;
} }

View file

@ -93,7 +93,7 @@ AND id NOT IN (\'' . implode('\',\'', $standard_plugins) . '\')
$plugins = array(); $plugins = array();
while ($row = pwg_db_fetch_assoc($result)) while ($row = pwg_db_fetch_assoc($result))
{ {
array_push($plugins, $row['id']); $plugins[] = $row['id'];
} }
if (!empty($plugins)) if (!empty($plugins))
@ -105,8 +105,8 @@ WHERE id IN (\'' . implode('\',\'', $plugins) . '\')
;'; ;';
pwg_query($query); pwg_query($query);
array_push($page['infos'], $page['infos'][] = l10n('As a precaution, following plugins have been deactivated. You must check for plugins upgrade before reactiving them:')
l10n('As a precaution, following plugins have been deactivated. You must check for plugins upgrade before reactiving them:').'<p><i>'.implode(', ', $plugins).'</i></p>'); .'<p><i>'.implode(', ', $plugins).'</i></p>';
} }
} }
@ -135,8 +135,8 @@ SELECT
$theme_names = array(); $theme_names = array();
while ($row = pwg_db_fetch_assoc($result)) while ($row = pwg_db_fetch_assoc($result))
{ {
array_push($theme_ids, $row['id']); $theme_ids[] = $row['id'];
array_push($theme_names, $row['name']); $theme_names[] = $row['name'];
} }
if (!empty($theme_ids)) if (!empty($theme_ids))
@ -148,8 +148,8 @@ DELETE
;'; ;';
pwg_query($query); pwg_query($query);
array_push($page['infos'], $page['infos'][] = l10n('As a precaution, following themes have been deactivated. You must check for themes upgrade before reactiving them:')
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>'); .'<p><i>'.implode(', ', $theme_names).'</i></p>';
// what is the default theme? // what is the default theme?
$query = ' $query = '
@ -249,11 +249,11 @@ WHERE '.$conf['user_fields']['username'].'=\''.$username.'\'
if (!$conf['password_verify']($password, $row['password'])) 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') 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 else
{ {
@ -279,7 +279,7 @@ function get_available_upgrade_ids()
if (is_file($upgrades_path.'/'.$node) if (is_file($upgrades_path.'/'.$node)
and preg_match('/^(.*?)-database\.php$/', $node, $match)) and preg_match('/^(.*?)-database\.php$/', $node, $match))
{ {
array_push($available_upgrade_ids, $match[1]); $available_upgrade_ids[] = $match[1];
} }
} }
} }

View file

@ -122,13 +122,9 @@ function save_upload_form_config($data, &$errors=array(), &$form_errors=array())
} }
else else
{ {
array_push( $errors[] = sprintf(
$errors, $upload_form_config[$field]['error_message'],
sprintf( $min, $max
$upload_form_config[$field]['error_message'],
$min,
$max
)
); );
$form_errors[$field] = '['.$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) function add_upload_error($upload_id, $error_message)
{ {
if (!isset($_SESSION['uploads_error'])) $_SESSION['uploads_error'][$upload_id][] = $error_message;
{
$_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);
} }
function ready_for_upload_message() function ready_for_upload_message()

View file

@ -57,7 +57,7 @@ class languages
case 'activate': case 'activate':
if (isset($crt_db_language)) if (isset($crt_db_language))
{ {
array_push($errors, 'CANNOT ACTIVATE - LANGUAGE IS ALREADY ACTIVATED'); $errors[] = 'CANNOT ACTIVATE - LANGUAGE IS ALREADY ACTIVATED';
break; break;
} }
@ -74,13 +74,13 @@ INSERT INTO '.LANGUAGES_TABLE.'
case 'deactivate': case 'deactivate':
if (!isset($crt_db_language)) if (!isset($crt_db_language))
{ {
array_push($errors, 'CANNOT DEACTIVATE - LANGUAGE IS ALREADY DEACTIVATED'); $errors[] = 'CANNOT DEACTIVATE - LANGUAGE IS ALREADY DEACTIVATED';
break; break;
} }
if ($language_id == get_default_language()) if ($language_id == get_default_language())
{ {
array_push($errors, 'CANNOT DEACTIVATE - LANGUAGE IS DEFAULT LANGUAGE'); $errors[] = 'CANNOT DEACTIVATE - LANGUAGE IS DEFAULT LANGUAGE';
break; break;
} }
@ -95,12 +95,12 @@ DELETE
case 'delete': case 'delete':
if (!empty($crt_db_language)) if (!empty($crt_db_language))
{ {
array_push($errors, 'CANNOT DELETE - LANGUAGE IS ACTIVATED'); $errors[] = 'CANNOT DELETE - LANGUAGE IS ACTIVATED';
break; break;
} }
if (!isset($this->fs_languages[$language_id])) if (!isset($this->fs_languages[$language_id]))
{ {
array_push($errors, 'CANNOT DELETE - LANGUAGE DOES NOT EXIST'); $errors[] = 'CANNOT DELETE - LANGUAGE DOES NOT EXIST';
break; break;
} }
@ -368,7 +368,7 @@ UPDATE '.USER_INFOS_TABLE.'
and $old_files = file($extract_path.'/obsolete.list', FILE_IGNORE_NEW_LINES) and $old_files = file($extract_path.'/obsolete.list', FILE_IGNORE_NEW_LINES)
and !empty($old_files)) and !empty($old_files))
{ {
array_push($old_files, 'obsolete.list'); $old_files[] = 'obsolete.list';
foreach($old_files as $old_file) foreach($old_files as $old_file)
{ {
$path = $extract_path.'/'.$old_file; $path = $extract_path.'/'.$old_file;

View file

@ -209,12 +209,12 @@ $setup_errors = array();
$error_message = ready_for_upload_message(); $error_message = ready_for_upload_message();
if (!empty($error_message)) if (!empty($error_message))
{ {
array_push($setup_errors, $error_message); $setup_errors[] = $error_message;
} }
if (!function_exists('gd_info')) if (!function_exists('gd_info'))
{ {
array_push($setup_errors, l10n('GD library is missing')); $setup_errors[] = l10n('GD library is missing');
} }
$template->assign( $template->assign(
@ -235,21 +235,15 @@ if (!isset($_SESSION['upload_hide_warnings']))
if ($conf['use_exif'] and !function_exists('read_exif_data')) 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')) if (get_ini_size('upload_max_filesize') > get_ini_size('post_max_size'))
{ {
array_push( $setup_warnings[] = l10n(
$setup_warnings, 'In your php.ini file, the upload_max_filesize (%sB) is bigger than post_max_size (%sB), you should change this setting',
sprintf( get_ini_size('upload_max_filesize', false),
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('post_max_size', false)
get_ini_size('upload_max_filesize', false),
get_ini_size('post_max_size', false)
)
); );
} }
$template->assign( $template->assign(

View file

@ -34,12 +34,9 @@ if (isset($_GET['processed']))
// exceeded the post_max_size (but not the upload_max_size) // exceeded the post_max_size (but not the upload_max_size)
if (!isset($_POST['submit_upload'])) if (!isset($_POST['submit_upload']))
{ {
array_push( $page['errors'][] = l10n(
$page['errors'], 'The uploaded files exceed the post_max_size directive in php.ini: %sB',
sprintf( ini_get('post_max_size')
l10n('The uploaded files exceed the post_max_size directive in php.ini: %sB'),
ini_get('post_max_size')
)
); );
} }
else else
@ -51,7 +48,7 @@ if (isset($_GET['processed']))
{ {
foreach ($_POST['onUploadError'] as $error) 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))) 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(
$images_to_add, 'source_filepath' => $upload_dir.'/'.$temporary_archive_name.'/'.$node['filename'],
array( 'original_filename' => basename($node['filename']),
'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)) elseif (is_valid_image_extension($extension))
{ {
array_push( $images_to_add[] = array(
$images_to_add, 'source_filepath' => $_FILES['image_upload']['tmp_name'][$idx],
array( 'original_filename' => $_FILES['image_upload']['name'][$idx],
'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'] $_POST['level']
); );
array_push($image_ids, $image_id); $image_ids[] = $image_id;
// TODO: if $image_id is not an integer, something went wrong // 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); $error_message = file_upload_error_message($error);
array_push( $page['errors'][] = l10n(
$page['errors'], 'Error on file "%s" : %s',
sprintf( $_FILES['image_upload']['name'][$idx],
l10n('Error on file "%s" : %s'), $error_message
$_FILES['image_upload']['name'][$idx],
$error_message
)
); );
} }
} }
@ -172,7 +160,7 @@ if (isset($_GET['processed']))
{ {
foreach ($_SESSION['uploads_error'][ $_POST['upload_id'] ] as $error) 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; $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'])) if (!empty($page['thumbnails']))
{ {
array_push( $page['infos'][] = l10n('%d photos uploaded', count($page['thumbnails']));
$page['infos'],
sprintf(
l10n('%d photos uploaded'),
count($page['thumbnails'])
)
);
if (0 != $_POST['level']) if (0 != $_POST['level'])
{ {
array_push( $page['infos'][] = l10n(
$page['infos'], 'Privacy level set to "%s"',
sprintf( l10n(sprintf('Level %d', $_POST['level']))
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-'); $category_name = get_cat_display_name_from_id($category_id, 'admin.php?page=album-');
// information // information
array_push( $page['infos'][] = l10n(
$page['infos'], 'Album "%s" now contains %d photos',
sprintf( '<em>'.$category_name.'</em>',
l10n('Album "%s" now contains %d photos'), $count
'<em>'.$category_name.'</em>',
$count
)
); );
$page['batch_link'] = PHOTOS_ADD_BASE_URL.'&batch='.implode(',', $image_ids); $page['batch_link'] = PHOTOS_ADD_BASE_URL.'&batch='.implode(',', $image_ids);

View file

@ -399,7 +399,7 @@ DELETE FROM ' . PLUGINS_TABLE . ' WHERE id=\'' . $plugin_id . '\'';
{ {
$server_plugins[$plugin['extension_id']] = array(); $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) 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 $old_files = file($extract_path.'/obsolete.list', FILE_IGNORE_NEW_LINES)
and !empty($old_files)) and !empty($old_files))
{ {
array_push($old_files, 'obsolete.list'); $old_files[] = 'obsolete.list';
foreach($old_files as $old_file) foreach($old_files as $old_file)
{ {
$path = $extract_path.'/'.$old_file; $path = $extract_path.'/'.$old_file;

View file

@ -77,12 +77,9 @@ class themes
$missing_parent = $this->missing_parent_theme($theme_id); $missing_parent = $this->missing_parent_theme($theme_id);
if (isset($missing_parent)) if (isset($missing_parent))
{ {
array_push( $errors[] = l10n(
$errors, 'Impossible to activate this theme, the parent theme is missing: %s',
sprintf( $missing_parent
l10n('Impossible to activate this theme, the parent theme is missing: %s'),
$missing_parent
)
); );
break; break;
@ -93,7 +90,7 @@ class themes
and !empty($conf['mobile_theme']) and !empty($conf['mobile_theme'])
and $conf['mobile_theme'] != $theme_id) 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; break;
} }
@ -134,10 +131,7 @@ INSERT INTO '.THEMES_TABLE.'
// you can't deactivate the last theme // you can't deactivate the last theme
if (count($this->db_themes_by_id) <= 1) 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; break;
} }
@ -190,7 +184,7 @@ DELETE
case 'delete': case 'delete':
if (!empty($crt_db_theme)) if (!empty($crt_db_theme))
{ {
array_push($errors, 'CANNOT DELETE - THEME IS INSTALLED'); $errors[] = 'CANNOT DELETE - THEME IS INSTALLED';
break; break;
} }
if (!isset($this->fs_themes[$theme_id])) if (!isset($this->fs_themes[$theme_id]))
@ -202,12 +196,9 @@ DELETE
$children = $this->get_children_themes($theme_id); $children = $this->get_children_themes($theme_id);
if (count($children) > 0) if (count($children) > 0)
{ {
array_push( $errors[] = l10n(
$errors, 'Impossible to delete this theme. Other themes depends on it: %s',
sprintf( implode(', ', $children)
l10n('Impossible to delete this theme. Other themes depends on it: %s'),
implode(', ', $children)
)
); );
break; break;
} }
@ -262,7 +253,7 @@ DELETE
{ {
if (isset($test_child['parent']) and $test_child['parent'] == $theme_id) 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(); $themes = array();
while ($row = pwg_db_fetch_assoc($result)) while ($row = pwg_db_fetch_assoc($result))
{ {
array_push($themes, $row); $themes[] = $row;
} }
return $themes; return $themes;
} }
@ -628,7 +619,7 @@ SELECT
and $old_files = file($extract_path.'/obsolete.list', FILE_IGNORE_NEW_LINES) and $old_files = file($extract_path.'/obsolete.list', FILE_IGNORE_NEW_LINES)
and !empty($old_files)) and !empty($old_files))
{ {
array_push($old_files, 'obsolete.list'); $old_files[] = 'obsolete.list';
foreach($old_files as $old_file) foreach($old_files as $old_file)
{ {
$path = $extract_path.'/'.$old_file; $path = $extract_path.'/'.$old_file;

View file

@ -161,7 +161,7 @@ class updates
{ {
if (in_array($ext_id, $conf['updates_ignored'][$type])) if (in_array($ext_id, $conf['updates_ignored'][$type]))
{ {
array_push($ignore_list, $ext_id); $ignore_list[] = $ext_id;
} }
else else
{ {
@ -248,7 +248,7 @@ class updates
and $old_files = file(PHPWG_ROOT_PATH.$file, FILE_IGNORE_NEW_LINES) and $old_files = file(PHPWG_ROOT_PATH.$file, FILE_IGNORE_NEW_LINES)
and !empty($old_files)) and !empty($old_files))
{ {
array_push($old_files, $file); $old_files[] = $file;
foreach($old_files as $old_file) foreach($old_files as $old_file)
{ {
$path = PHPWG_ROOT_PATH.$old_file; $path = PHPWG_ROOT_PATH.$old_file;
@ -314,7 +314,7 @@ class updates
} }
else 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']); unset($_SESSION['need_update']);
if ($step == 2) if ($step == 2)
{ {
array_push($page['infos'], l10n('Update Complete'), $upgrade_to); $page['infos'][] = l10n('Update Complete');
$page['infos'][] = $upgrade_to;
$step = -1; $step = -1;
} }
else else
@ -425,24 +426,22 @@ class updates
else else
{ {
file_put_contents(PHPWG_ROOT_PATH.$conf['data_location'].'update/log_error.txt', $error); file_put_contents(PHPWG_ROOT_PATH.$conf['data_location'].'update/log_error.txt', $error);
array_push(
$page['errors'], $page['errors'][] = l10n(
sprintf( '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>.',
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'
get_root_url().$conf['data_location'].'update/log_error.txt' );
)
);
} }
} }
else else
{ {
deltree(PHPWG_ROOT_PATH.$conf['data_location'].'update'); 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 else
{ {
array_push($page['errors'], l10n('Piwigo cannot retrieve upgrade file from server')); $page['errors'][] = l10n('Piwigo cannot retrieve upgrade file from server');
} }
} }
} }

View file

@ -47,20 +47,7 @@ $image_id = add_uploaded_file(
$_POST['level'] $_POST['level']
); );
if (!isset($_SESSION['uploads'])) $_SESSION['uploads'][ $_POST['upload_id'] ][] = $image_id;
{
$_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
);
$query = ' $query = '
SELECT SELECT

View file

@ -45,7 +45,7 @@ if (isset($_GET['action']) and 'check_upgrade' == $_GET['action'])
{ {
if (!fetchRemote(PHPWG_URL.'/download/latest_version', $result)) 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 else
{ {
@ -73,33 +73,21 @@ if (isset($_GET['action']) and 'check_upgrade' == $_GET['action'])
if ('' == $versions['latest']) 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 // concatenation needed to avoid automatic transformation by release
// script generator // script generator
else if ('%'.'PWGVERSION'.'%' == $versions['current']) 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) 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 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_VERSION' => $db_version,
'DB_ELEMENTS' => l10n_dec('%d photo', '%d photos', $nb_elements), 'DB_ELEMENTS' => l10n_dec('%d photo', '%d photos', $nb_elements),
'DB_CATEGORIES' => 'DB_CATEGORIES' =>
l10n_dec('%d album including', '%d albums including', l10n_dec('%d album including', '%d albums including', $nb_categories).
$nb_categories). l10n_dec('%d physical', '%d physicals', $nb_physical).
l10n_dec('%d physical', '%d physicals', l10n_dec(' and %d virtual', ' and %d virtuals', $nb_virtual),
$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_IMAGE_CATEGORY' => l10n_dec('%d association', '%d associations', $nb_image_category),
'DB_TAGS' => l10n_dec('%d tag', '%d tags', $nb_tags), 'DB_TAGS' => l10n_dec('%d tag', '%d tags', $nb_tags),
'DB_IMAGE_TAG' => l10n_dec('%d association', '%d associations', $nb_image_tag), 'DB_IMAGE_TAG' => l10n_dec('%d association', '%d associations', $nb_image_tag),

View file

@ -87,7 +87,7 @@ foreach($languages->fs_languages as $language_id => $language)
else else
{ {
$language['is_default'] = false; $language['is_default'] = false;
array_push($tpl_languages, $language); $tpl_languages[] = $language;
} }
} }

View file

@ -53,7 +53,7 @@ if (isset($_GET['revision']))
{ {
if (!is_webmaster()) if (!is_webmaster())
{ {
array_push($page['errors'], l10n('Webmaster status is required.')); $page['errors'][] = l10n('Webmaster status is required.');
} }
else else
{ {
@ -73,28 +73,23 @@ if (isset($_GET['installstatus']))
switch ($_GET['installstatus']) switch ($_GET['installstatus'])
{ {
case 'ok': case 'ok':
array_push($page['infos'], $page['infos'][] = l10n('Language has been successfully installed');
l10n('Language has been successfully installed')
);
break; break;
case 'temp_path_error': case 'temp_path_error':
array_push($page['errors'], l10n('Can\'t create temporary file.')); $page['errors'][] = l10n('Can\'t create temporary file.');
break; break;
case 'dl_archive_error': case 'dl_archive_error':
array_push($page['errors'], l10n('Can\'t download archive.')); $page['errors'][] = l10n('Can\'t download archive.');
break; break;
case 'archive_error': case 'archive_error':
array_push($page['errors'], l10n('Can\'t read or extract archive.')); $page['errors'][] = l10n('Can\'t read or extract archive.');
break; break;
default: 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 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'); $template->assign_var_from_handle('ADMIN_CONTENT', 'languages');

View file

@ -148,7 +148,7 @@ UPDATE '.CONFIG_TABLE.'
'; ';
pwg_query($query); 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 ); make_consecutive( $mb_conf );

View file

@ -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); $_POST[$post_keyname] = array_diff($_POST[$post_keyname], $check_key_treated);
$must_repost = true; $must_repost = true;
array_push($page['errors'], $page['errors'][] = l10n_dec(
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 second].',
'Execution time is out, treatment must be continue [Estimated time: %d seconds].', 'Execution time is out, treatment must be continue [Estimated time: %d seconds].',
$time_refresh)); $time_refresh
);
} }
} }
@ -156,29 +157,20 @@ order by
$nbm_user['check_key'] = find_available_check_key(); $nbm_user['check_key'] = find_available_check_key();
// Save key // Save key
array_push($check_key_list, $nbm_user['check_key']); $check_key_list[] = $nbm_user['check_key'];
// Insert new nbm_users // Insert new nbm_users
array_push $inserts[] = array(
( 'user_id' => $nbm_user['user_id'],
$inserts, 'check_key' => $nbm_user['check_key'],
array 'enabled' => 'false' // By default if false, set to true with specific functions
( );
'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.',
$page['infos'], stripslashes($nbm_user['username']),
l10n( get_email_address_as_display_text($nbm_user['mail_address'])
'User %s [%s] added.', );
stripslashes($nbm_user['username']),
get_email_address_as_display_text($nbm_user['mail_address'])
)
);
} }
// Insert new nbm_users // 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()) if ((!$is_action_send) and check_sendmail_timeout())
{ {
// Stop fill list on 'list_to_send', if the quota is override // 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; break;
} }
if (($is_action_send) and check_sendmail_timeout()) if (($is_action_send) and check_sendmail_timeout())
{ {
// Stop fill list on 'send', if the quota is override // Stop fill list on 'send', if the quota is override
array_push($page['errors'], $msg_break_timeout); $page['errors'][] = $msg_break_timeout;
break; break;
} }
@ -299,7 +291,7 @@ function do_action_send_mail_notification($action = 'list_to_send', $check_key_l
{ {
set_make_full_url(); set_make_full_url();
// Fill return list of "treated" check_key for 'send' // 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']) 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); inc_mail_sent_success($nbm_user);
$data = array('user_id' => $nbm_user['user_id'], $datas[] = array(
'last_send' => $dbnow); 'user_id' => $nbm_user['user_id'],
array_push($datas, $data); 'last_send' => $dbnow
);
} }
else 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)) if (news_exists($nbm_user['last_send'], $dbnow))
{ {
// Fill return list of "selected" users for 'list_to_send' // 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) 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'], $page['infos'][] = l10n_dec(
l10n_dec('%d parameter was updated.', '%d parameters were updated.', '%d parameter was updated.', '%d parameters were updated.',
$updated_param_count)); $updated_param_count
);
// Reload conf with new values // Reload conf with new values
load_conf_from_db('param like \'nbm\\_%\''); load_conf_from_db('param like \'nbm\\_%\'');

View file

@ -59,13 +59,13 @@ function parse_sort_variables(
} }
elseif (isset($default_field) and !isset($_GET[$get_param]) ) elseif (isset($default_field) and !isset($_GET[$get_param]) )
{ {
array_push($ret, $field); $ret[] = $field;
$disp = '<em>'.$disp.'</em>'; $disp = '<em>'.$disp.'</em>';
} }
} }
else else
{ {
array_push($ret, $field); $ret[] = $field;
$disp = '<em>'.$disp.'</em>'; $disp = '<em>'.$disp.'</em>';
} }
if ( isset($template_var) ) if ( isset($template_var) )
@ -100,7 +100,9 @@ DELETE FROM '.OLD_PERMALINKS_TABLE.'
LIMIT 1'; LIMIT 1';
$result = pwg_query($query); $result = pwg_query($query);
if (pwg_db_changes($result)==0) if (pwg_db_changes($result)==0)
array_push($page['errors'], l10n('Cannot delete the old permalink !')); {
$page['errors'][] = l10n('Cannot delete the old permalink !');
}
} }

View file

@ -43,12 +43,9 @@ DELETE FROM '.CADDIE_TABLE.'
$inserts = array(); $inserts = array();
foreach (explode(',', $_GET['batch']) as $image_id) foreach (explode(',', $_GET['batch']) as $image_id)
{ {
array_push( $inserts[] = array(
$inserts, 'user_id' => $user['id'],
array( 'element_id' => $image_id,
'user_id' => $user['id'],
'element_id' => $image_id,
)
); );
} }
mass_inserts( mass_inserts(

View file

@ -104,7 +104,7 @@ SELECT category_id
if (isset($_GET['sync_metadata'])) if (isset($_GET['sync_metadata']))
{ {
sync_metadata(array( intval($_GET['image_id']))); 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 //--------------------------------------------------------- update informations
@ -120,7 +120,7 @@ if (isset($_POST['date_creation_action'])
$_POST['date_creation_year']) $_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']; $represent_options_selected = $_POST['represent'];
array_push($page['infos'], l10n('Photo informations updated')); $page['infos'][] = l10n('Photo informations updated');
} }
// tags // tags

View file

@ -64,7 +64,7 @@ if (isset($_GET['action']) and isset($_GET['plugin']))
{ {
if (!is_webmaster()) if (!is_webmaster())
{ {
array_push($page['errors'], l10n('Webmaster status is required.')); $page['errors'][] = l10n('Webmaster status is required.');
} }
else else
{ {
@ -90,7 +90,7 @@ if (isset($_GET['incompatible_plugins']))
foreach ($plugins->get_incompatible_plugins() as $plugin => $version) foreach ($plugins->get_incompatible_plugins() as $plugin => $version)
{ {
if ($plugin == '~~expire~~') continue; if ($plugin == '~~expire~~') continue;
array_push($incompatible_plugins, $plugin); $incompatible_plugins[] = $plugin;
} }
echo json_encode($incompatible_plugins); echo json_encode($incompatible_plugins);
@ -152,7 +152,7 @@ foreach($plugins->fs_plugins as $plugin_id => $fs_plugin)
$active_plugins++; $active_plugins++;
} }
array_push($tpl_plugins, $tpl_plugin); $tpl_plugins[] = $tpl_plugin;
} }
$template->append('plugin_states', 'active'); $template->append('plugin_states', 'active');
@ -170,17 +170,14 @@ $missing_plugin_ids = array_diff(
if (count($missing_plugin_ids) > 0) 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(
$tpl_plugins, 'NAME' => $plugin_id,
array( 'VERSION' => $plugins->db_plugins_by_id[$plugin_id]['version'],
'NAME' => $plugin_id, 'DESC' => l10n('ERROR: THIS PLUGIN IS MISSING BUT IT IS INSTALLED! UNINSTALL IT NOW.'),
'VERSION' => $plugins->db_plugins_by_id[$plugin_id]['version'], 'U_ACTION' => sprintf($action_url, $plugin_id),
'DESC' => l10n('ERROR: THIS PLUGIN IS MISSING BUT IT IS INSTALLED! UNINSTALL IT NOW.'), 'STATE' => 'missing',
'U_ACTION' => sprintf($action_url, $plugin_id),
'STATE' => 'missing',
)
); );
} }
$template->append('plugin_states', 'missing'); $template->append('plugin_states', 'missing');

View file

@ -39,7 +39,7 @@ if (isset($_GET['revision']) and isset($_GET['extension']))
{ {
if (!is_webmaster()) if (!is_webmaster())
{ {
array_push($page['errors'], l10n('Webmaster status is required.')); $page['errors'][] = l10n('Webmaster status is required.');
} }
else else
{ {
@ -57,27 +57,25 @@ if (isset($_GET['installstatus']))
switch ($_GET['installstatus']) switch ($_GET['installstatus'])
{ {
case 'ok': case 'ok':
array_push($page['infos'], $page['infos'][] = l10n('Plugin has been successfully copied');
l10n('Plugin has been successfully copied'), $page['infos'][] = l10n('You might go to plugin list to install and activate it.');
l10n('You might go to plugin list to install and activate it.'));
break; break;
case 'temp_path_error': case 'temp_path_error':
array_push($page['errors'], l10n('Can\'t create temporary file.')); $page['errors'][] = l10n('Can\'t create temporary file.');
break; break;
case 'dl_archive_error': case 'dl_archive_error':
array_push($page['errors'], l10n('Can\'t download archive.')); $page['errors'][] = l10n('Can\'t download archive.');
break; break;
case 'archive_error': case 'archive_error':
array_push($page['errors'], l10n('Can\'t read or extract archive.')); $page['errors'][] = l10n('Can\'t read or extract archive.');
break; break;
default: default:
array_push($page['errors'], $page['errors'][] = l10n('An error occured during extraction (%s).', htmlspecialchars($_GET['installstatus']));
l10n('An error occured during extraction (%s).', htmlspecialchars($_GET['installstatus'])), $page['errors'][] = l10n('Please check "plugins" folder and sub-folders permissions (CHMOD).');
l10n('Please check "plugins" folder and sub-folders permissions (CHMOD).'));
} }
} }
@ -135,7 +133,7 @@ if ($plugins->get_server_plugins(true))
} }
else 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'); $template->assign_var_from_handle('ADMIN_CONTENT', 'plugins');

View file

@ -194,7 +194,7 @@ $images = array();
$result = pwg_query($query); $result = pwg_query($query);
while ($row = pwg_db_fetch_assoc($result)) while ($row = pwg_db_fetch_assoc($result))
{ {
array_push($images, $row); $images[] = $row;
} }
$template->assign( 'images', array() ); $template->assign( 'images', array() );

View file

@ -75,15 +75,13 @@ SELECT COUNT(id) AS count
$row = pwg_db_fetch_assoc(pwg_query($query)); $row = pwg_db_fetch_assoc(pwg_query($query));
if ($row['count'] > 0) if ($row['count'] > 0)
{ {
array_push($page['errors'], $page['errors'][] = l10n('This site already exists').' ['.$url.']';
l10n('This site already exists').' ['.$url.']');
} }
if (count($page['errors']) == 0) if (count($page['errors']) == 0)
{ {
if ( ! file_exists($url) ) if ( ! file_exists($url) )
{ {
array_push($page['errors'], $page['errors'][] = l10n('Directory does not exist').' ['.$url.']';
l10n('Directory does not exist').' ['.$url.']');
} }
} }
@ -96,8 +94,7 @@ INSERT INTO '.SITES_TABLE.'
(\''.$url.'\') (\''.$url.'\')
;'; ;';
pwg_query($query); pwg_query($query);
array_push($page['infos'], $page['infos'][] = $url.' '.l10n('created');
$url.' '.l10n('created'));
} }
} }
@ -121,8 +118,7 @@ SELECT galleries_url
case 'delete' : case 'delete' :
{ {
delete_site($page['site']); delete_site($page['site']);
array_push($page['infos'], $page['infos'][] = $galleries_url.' '.l10n('deleted');
$galleries_url.' '.l10n('deleted'));
break; break;
} }
} }

View file

@ -52,12 +52,9 @@ function open()
if (!is_dir($this->site_url)) if (!is_dir($this->site_url))
{ {
array_push( $errors[] = array(
$errors, 'path' => $this->site_url,
array( 'type' => 'PWG-ERROR-NO-FS'
'path' => $this->site_url,
'type' => 'PWG-ERROR-NO-FS'
)
); );
return false; 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_high'
and $node != 'pwg_representative' and $node != 'pwg_representative'
and $node != 'thumbnail' ) and $node != 'thumbnail' )
{ {
array_push($subdirs, $node); $subdirs[] = $node;
} }
} //end while readdir } //end while readdir
closedir($contents); closedir($contents);

View file

@ -199,7 +199,7 @@ SELECT id_uppercat, MAX(rank)+1 AS next_rank
// category directory, we need to include it in our array // category directory, we need to include it in our array
if (isset($_POST['cat'])) if (isset($_POST['cat']))
{ {
array_push($fs_fulldirs, $basedir); $fs_fulldirs[] = $basedir;
} }
// If $_POST['subcats-included'] != 1 ("Search in sub-albums" is unchecked) // If $_POST['subcats-included'] != 1 ("Search in sub-albums" is unchecked)
// $db_fulldirs doesn't include any subdirectories and $fs_fulldirs does // $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']; $insert['global_rank'] = $insert['rank'];
} }
array_push($inserts, $insert); $inserts[] = $insert;
array_push( $infos[] = array(
$infos,
array(
'path' => $fulldir, 'path' => $fulldir,
'info' => l10n('added') 'info' => l10n('added')
) )
@ -277,12 +275,9 @@ SELECT id_uppercat, MAX(rank)+1 AS next_rank
} }
else else
{ {
array_push( $errors[] = array(
$errors, 'path' => $fulldir,
array( 'type' => 'PWG-UPDATE-1'
'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(); $granted_grps[$row['cat_id']]=array();
} }
// TODO: explanaition
array_push( array_push(
$granted_grps, $granted_grps,
array( array(
@ -349,6 +345,7 @@ SELECT id_uppercat, MAX(rank)+1 AS next_rank
{ {
$granted_users[$row['cat_id']]=array(); $granted_users[$row['cat_id']]=array();
} }
// TODO: explanaition
array_push( array_push(
$granted_users, $granted_users,
array( array(
@ -372,37 +369,28 @@ SELECT id_uppercat, MAX(rank)+1 AS next_rank
{ {
foreach ($granted_grps[$parent_id] as $granted_grp) foreach ($granted_grps[$parent_id] as $granted_grp)
{ {
array_push( $insert_granted_grps[] = array(
$insert_granted_grps, 'group_id' => $granted_grp,
array( 'cat_id' => $ids
'group_id' => $granted_grp, );
'cat_id' => $ids
)
);
} }
} }
if (isset($granted_users[$parent_id])) if (isset($granted_users[$parent_id]))
{ {
foreach ($granted_users[$parent_id] as $granted_user) foreach ($granted_users[$parent_id] as $granted_user)
{ {
array_push( $insert_granted_users[] = array(
$insert_granted_users, 'user_id' => $granted_user,
array( 'cat_id' => $ids
'user_id' => $granted_user, );
'cat_id' => $ids
)
);
} }
} }
foreach (get_admins() as $granted_user) foreach (get_admins() as $granted_user)
{ {
array_push( $insert_granted_users[] = array(
$insert_granted_users, 'user_id' => $granted_user,
array( 'cat_id' => $ids
'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 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) 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]); 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) if (substr_compare($fulldir, '../', 0, 3)==0)
{ {
$fulldir = substr($fulldir, 3); $fulldir = substr($fulldir, 3);
} }
$to_delete_derivative_dirs[] = PHPWG_ROOT_PATH.PWG_DERIVATIVE_DIR.$fulldir; $to_delete_derivative_dirs[] = PHPWG_ROOT_PATH.PWG_DERIVATIVE_DIR.$fulldir;
} }
if (count($to_delete) > 0) if (count($to_delete) > 0)
{ {
if (!$simulate) if (!$simulate)
@ -505,12 +500,9 @@ SELECT id, path
$filename = basename($path); $filename = basename($path);
if (!preg_match($conf['sync_chars_regex'], $filename)) if (!preg_match($conf['sync_chars_regex'], $filename))
{ {
array_push( $errors[] = array(
$errors, 'path' => $path,
array( 'type' => 'PWG-UPDATE-1'
'path' => $path,
'type' => 'PWG-UPDATE-1'
)
); );
continue; continue;
@ -532,25 +524,16 @@ SELECT id, path
$insert['level'] = $_POST['privacy_level']; $insert['level'] = $_POST['privacy_level'];
} }
array_push( $inserts[] = $insert;
$inserts,
$insert $insert_links[] = array(
'image_id' => $insert['id'],
'category_id' => $insert['storage_category_id'],
); );
array_push( $infos[] = array(
$insert_links, 'path' => $insert['path'],
array( 'info' => l10n('added')
'image_id' => $insert['id'],
'category_id' => $insert['storage_category_id'],
)
);
array_push(
$infos,
array(
'path' => $insert['path'],
'info' => l10n('added')
)
); );
$caddiables[] = $insert['id']; $caddiables[] = $insert['id'];
@ -587,9 +570,11 @@ SELECT id, path
$to_delete_elements = array(); $to_delete_elements = array();
foreach (array_diff($db_elements, array_keys($fs)) as $path) foreach (array_diff($db_elements, array_keys($fs)) as $path)
{ {
array_push($to_delete_elements, array_search($path, $db_elements)); $to_delete_elements[] = array_search($path, $db_elements);
array_push($infos, array('path' => $path, $infos[] = array(
'info' => l10n('deleted'))); 'path' => $path,
'info' => l10n('deleted')
);
} }
if (count($to_delete_elements) > 0) if (count($to_delete_elements) > 0)
{ {
@ -658,7 +643,7 @@ if (isset($_POST['submit'])
} }
$data['id']=$id; $data['id']=$id;
array_push($datas, $data); $datas[] = $data;
} // end foreach file } // end foreach file
$counts['upd_elements'] = count($datas); $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['date_metadata_update'] = CURRENT_DATE;
$data['id']=$id; $data['id']=$id;
array_push($datas, $data); $datas[] = $data;
foreach (array('keywords', 'tags') as $key) 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) 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 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'
);
} }
} }

View file

@ -97,7 +97,7 @@ SELECT
$output = array(); $output = array();
while ($row = pwg_db_fetch_assoc($result)) while ($row = pwg_db_fetch_assoc($result))
{ {
array_push($output, $row); $output[] = $row;
} }
return $output; return $output;
@ -226,7 +226,7 @@ SELECT *
if (isset($need_update[$key])) if (isset($need_update[$key]))
{ {
$row['nb_pages'] += $need_update[$key]; $row['nb_pages'] += $need_update[$key];
array_push($updates, $row); $updates[] = $row;
unset($need_update[$key]); unset($need_update[$key]);
} }
} }
@ -236,16 +236,13 @@ foreach ($need_update as $time_key => $nb_pages)
{ {
$time_tokens = explode('-', $time_key); $time_tokens = explode('-', $time_key);
array_push( $inserts[] = array(
$inserts, 'year' => $time_tokens[0],
array( 'month' => @$time_tokens[1],
'year' => $time_tokens[0], 'day' => @$time_tokens[2],
'month' => @$time_tokens[1], 'hour' => @$time_tokens[3],
'day' => @$time_tokens[2], 'nb_pages' => $nb_pages,
'hour' => @$time_tokens[3], );
'nb_pages' => $nb_pages,
)
);
} }
if (count($updates) > 0) if (count($updates) > 0)
@ -323,10 +320,7 @@ $title_parts = array();
$url = PHPWG_ROOT_PATH.'admin.php?page=stats'; $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'); $period_label = l10n('Year');
@ -334,10 +328,7 @@ if (isset($page['year']))
{ {
$url.= '&amp;year='.$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'); $period_label = l10n('Month');
} }
@ -346,10 +337,7 @@ if (isset($page['month']))
{ {
$url.= '&amp;month='.$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'); $period_label = l10n('Day');
} }
@ -366,10 +354,7 @@ if (isset($page['day']))
$lang['day'][date('w', $time)] $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'); $period_label = l10n('Hour');
} }

View file

@ -69,23 +69,14 @@ SELECT id, name
{ {
if (in_array($tag_name, $existing_names)) 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)) else if (!empty($tag_name))
{ {
array_push( $updates[] = array(
$updates, 'id' => $tag_id,
array( 'name' => addslashes($tag_name),
'id' => $tag_id, 'url_name' => trigger_event('render_tag_url', $tag_name),
'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)) 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)) else if (!empty($tag_name))
{ {
@ -171,12 +156,9 @@ SELECT id, name
$inserts = array(); $inserts = array();
foreach ($destination_tag_image_ids as $image_id) foreach ($destination_tag_image_ids as $image_id)
{ {
array_push( $inserts[] = array(
$inserts, 'tag_id' => $destination_tag_id,
array( 'image_id' => $image_id
'tag_id' => $destination_tag_id,
'image_id' => $image_id
)
); );
} }
@ -188,13 +170,11 @@ SELECT id, name
$inserts $inserts
); );
} }
array_push(
$page['infos'], $page['infos'][] = l10n(
l10n( 'Tag "%s" is now a duplicate of "%s"',
'Tag "%s" is now a duplicate of "%s"', stripslashes($tag_name),
stripslashes($tag_name), $current_name_of[$tag_id]
$current_name_of[$tag_id]
)
); );
} }
} }
@ -217,10 +197,7 @@ if (isset($_POST['confirm_merge']))
{ {
if (!isset($_POST['destination_tag'])) if (!isset($_POST['destination_tag']))
{ {
array_push( $page['errors'][] = l10n('No destination tag selected');
$page['errors'],
l10n('No destination tag selected')
);
} }
else else
{ {
@ -274,12 +251,9 @@ SELECT
$inserts = array(); $inserts = array();
foreach ($image_ids_to_link as $image_id) foreach ($image_ids_to_link as $image_id)
{ {
array_push( $inserts[] = array(
$inserts, 'tag_id' => $destination_tag_id,
array( 'image_id' => $image_id
'tag_id' => $destination_tag_id,
'image_id' => $image_id
)
); );
} }
@ -298,13 +272,10 @@ SELECT
$tags_deleted[] = $name_of_tag[$tag_id]; $tags_deleted[] = $name_of_tag[$tag_id];
} }
array_push( $page['infos'][] = l10n(
$page['infos'], 'Tags <em>%s</em> merged into tag <em>%s</em>',
l10n( implode(', ', $tags_deleted),
'Tags <em>%s</em> merged into tag <em>%s</em>', $name_of_tag[$destination_tag_id]
implode(', ', $tags_deleted),
$name_of_tag[$destination_tag_id]
)
); );
} }
} }
@ -326,14 +297,11 @@ SELECT name
delete_tags($_POST['tags']); delete_tags($_POST['tags']);
array_push( $page['infos'][] = l10n_dec(
$page['infos'], 'The following tag was deleted', 'The %d following tags were deleted',
l10n_dec( count($tag_names)
'The following tag was deleted', )
'The %d following tags were deleted', .' : '.implode(', ', $tag_names);
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 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(); $orphan_tag_names = array();
foreach ($orphan_tags as $tag) 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) if (count($orphan_tag_names) > 0)
{ {
array_push( $page['warnings'][] = sprintf(
$page['warnings'], l10n('You have %d orphan tags: %s.').' <a href="%s">'.l10n('Delete orphan tags').'</a>',
sprintf( count($orphan_tag_names),
l10n('You have %d orphan tags: %s.').' <a href="%s">'.l10n('Delete orphan tags').'</a>', implode(', ', $orphan_tag_names),
count($orphan_tag_names), get_root_url().'admin.php?page=tags&amp;action=delete_orphans&amp;pwg_token='.get_pwg_token()
implode(', ', $orphan_tag_names),
get_root_url().'admin.php?page=tags&amp;action=delete_orphans&amp;pwg_token='.get_pwg_token()
)
); );
} }

View file

@ -62,7 +62,7 @@ $db_themes = $themes->get_db_themes();
$db_theme_ids = array(); $db_theme_ids = array();
foreach ($db_themes as $db_theme) foreach ($db_themes as $db_theme)
{ {
array_push($db_theme_ids, $db_theme['id']); $db_theme_ids[] = $db_theme['id'];
} }
$tpl_themes = array(); $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 // sort themes by state then by name

View file

@ -50,7 +50,7 @@ if (isset($_GET['revision']) and isset($_GET['extension']))
{ {
if (!is_webmaster()) if (!is_webmaster())
{ {
array_push($page['errors'], l10n('Webmaster status is required.')); $page['errors'][] = l10n('Webmaster status is required.');
} }
else else
{ {
@ -75,28 +75,25 @@ if (isset($_GET['installstatus']))
switch ($_GET['installstatus']) switch ($_GET['installstatus'])
{ {
case 'ok': case 'ok':
array_push( $page['infos'][] = l10n('Theme has been successfully installed');
$page['infos'],
l10n('Theme has been successfully installed')
);
break; break;
case 'temp_path_error': case 'temp_path_error':
array_push($page['errors'], l10n('Can\'t create temporary file.')); $page['errors'][] = l10n('Can\'t create temporary file.');
break; break;
case 'dl_archive_error': case 'dl_archive_error':
array_push($page['errors'], l10n('Can\'t download archive.')); $page['errors'][] = l10n('Can\'t download archive.');
break; break;
case 'archive_error': case 'archive_error':
array_push($page['errors'], l10n('Can\'t read or extract archive.')); $page['errors'][] = l10n('Can\'t read or extract archive.');
break; break;
default: default:
array_push( $page['errors'][] = l10n(
$page['errors'], 'An error occured during extraction (%s).',
l10n('An error occured during extraction (%s).', htmlspecialchars($_GET['installstatus'])) htmlspecialchars($_GET['installstatus'])
); );
} }
} }
@ -130,7 +127,7 @@ if ($themes->get_server_themes(true)) // only new themes
} }
else else
{ {
array_push($page['errors'], l10n('Can\'t connect to server.')); $page['errors'][] = l10n('Can\'t connect to server.');
} }
$template->assign('default_screenshot', $template->assign('default_screenshot',

View file

@ -32,8 +32,8 @@ $autoupdate = new updates($page['page']);
$show_reset = false; $show_reset = false;
if (!$autoupdate->get_server_extensions()) if (!$autoupdate->get_server_extensions())
{ {
array_push($page['errors'], l10n('Can\'t connect to server.')); $page['errors'][] = l10n('Can\'t connect to server.');
return; return; // TODO: remove this return and add a proper "page killer"
} }
foreach ($autoupdate->types as $type) foreach ($autoupdate->types as $type)

View file

@ -149,7 +149,7 @@ if ($step == 3 and is_webmaster())
if (!is_webmaster()) if (!is_webmaster())
{ {
array_push($page['errors'], l10n('Webmaster status is required.')); $page['errors'][] = l10n('Webmaster status is required.');
} }
$template->assign(array( $template->assign(array(

View file

@ -119,7 +119,7 @@ SELECT DISTINCT u.'.$conf['user_fields']['id'].' AS id,
$user = $row; $user = $row;
$user['groups'] = array(); $user['groups'] = array();
array_push($users, $user); $users[] = $user;
} }
// add group lists // add group lists
@ -140,10 +140,7 @@ SELECT user_id, group_id
$result = pwg_query($query); $result = pwg_query($query);
while ($row = pwg_db_fetch_assoc($result)) 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'])) 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'])) 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'])) 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']) 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 else
{ {
@ -212,13 +209,7 @@ if ($conf['double_password_type_in_admin'] == true)
if (count($page['errors']) == 0) 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) 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) foreach($page['filtered_users'] as $local_user)
{ {
array_push($collection, $local_user['id']); $collection[] = $local_user['id'];
} }
break; break;
} }
@ -311,7 +296,7 @@ if (isset($_POST['delete']) or isset($_POST['pref_submit']))
if (count($collection) == 0) 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)) 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 if (($conf['guest_id'] != $conf['default_user_id']) and
in_array($conf['default_user_id'], $collection)) 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)) 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)) 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) if (count($page['errors']) == 0)
@ -346,13 +331,12 @@ if (isset($_POST['delete']) and count($collection) > 0)
{ {
delete_user($user_id); delete_user($user_id);
} }
array_push(
$page['infos'], $page['infos'][] = l10n_dec(
l10n_dec( '%d user deleted', '%d users deleted',
'%d user deleted', '%d users deleted', count($collection)
count($collection)
)
); );
foreach ($page['filtered_users'] as $filter_key => $filter_user) foreach ($page['filtered_users'] as $filter_key => $filter_user)
{ {
if (in_array($filter_user['id'], $collection)) if (in_array($filter_user['id'], $collection))
@ -363,7 +347,7 @@ if (isset($_POST['delete']) and count($collection) > 0)
} }
else 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) foreach ($associable as $item)
{ {
array_push($datas, $datas[] = array(
array('group_id'=>$_POST['associate'], 'group_id' => $_POST['associate'],
'user_id'=>$item)); 'user_id' => $item
);
} }
mass_inserts(USER_GROUP_TABLE, mass_inserts(USER_GROUP_TABLE,
@ -426,8 +411,8 @@ DELETE FROM '.USER_GROUP_TABLE.'
if ($conf['activate_comments']) if ($conf['activate_comments'])
{ {
array_push($formfields, 'show_nb_comments'); $formfields[] = 'show_nb_comments';
array_push($true_false_fields, 'show_nb_comments'); $true_false_fields[] = 'show_nb_comments';
} }
foreach ($formfields as $formfield) foreach ($formfields as $formfield)
@ -444,7 +429,7 @@ DELETE FROM '.USER_GROUP_TABLE.'
if ($_POST[$test] != 'leave') if ($_POST[$test] != 'leave')
{ {
array_push($dbfields['update'], $formfield); $dbfields['update'][] = $formfield;
} }
} }
@ -480,7 +465,7 @@ DELETE FROM '.USER_GROUP_TABLE.'
$data['level'] = 8; $data['level'] = 8;
if (!in_array('level', $dbfields['update'])) 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); mass_updates(USER_INFOS_TABLE, $dbfields, $datas);

View file

@ -119,8 +119,8 @@ if (pwg_db_num_rows($result) > 0)
$cats = array(); $cats = array();
while ($row = pwg_db_fetch_assoc($result)) while ($row = pwg_db_fetch_assoc($result))
{ {
array_push($cats, $row); $cats[] = $row;
array_push($group_authorized, $row['cat_id']); $group_authorized[] = $row['cat_id'];
} }
usort($cats, 'global_rank_compare'); usort($cats, 'global_rank_compare');
@ -152,7 +152,7 @@ $result = pwg_query($query_true);
$authorized_ids = array(); $authorized_ids = array();
while ($row = pwg_db_fetch_assoc($result)) while ($row = pwg_db_fetch_assoc($result))
{ {
array_push($authorized_ids, $row['id']); $authorized_ids[] = $row['id'];
} }
$query_false = ' $query_false = '

View file

@ -446,8 +446,8 @@ $query.= '
$result = pwg_query($query); $result = pwg_query($query);
while ($row = pwg_db_fetch_assoc($result)) while ($row = pwg_db_fetch_assoc($result))
{ {
array_push($comments, $row); $comments[] = $row;
array_push($element_ids, $row['image_id']); $element_ids[] = $row['image_id'];
} }
if (count($comments) > 0) if (count($comments) > 0)

View file

@ -39,7 +39,7 @@ if ( !empty($_GET['redirect']) )
$redirect_to = urldecode($_GET['redirect']); $redirect_to = urldecode($_GET['redirect']);
if ( is_a_guest() ) 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()])) 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 else
{ {
@ -68,7 +65,7 @@ if (isset($_POST['login']))
} }
else else
{ {
array_push($page['errors'], l10n('Invalid password!') ); $page['errors'][] = l10n('Invalid password!');
} }
} }
} }

View file

@ -388,7 +388,7 @@ SELECT id, file,representative_ext,path,width,height,rotation, '.pwg_db_get_dayo
$first_day_dow -= 1; $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; list($cell_width, $cell_height) = ImageStdParams::get_by_type(IMG_SQUARE)->sizing->ideal_size;

View file

@ -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[CWEEK]['sql'] = pwg_db_get_week($this->date_field, 5).'+1';
$this->calendar_levels[CDAY]['sql'] = pwg_db_get_weekday($this->date_field); $this->calendar_levels[CDAY]['sql'] = pwg_db_get_weekday($this->date_field);
array_push( $this->calendar_levels[CDAY]['labels'], $this->calendar_levels[CDAY]['labels'][] = array_shift($this->calendar_levels[CDAY]['labels']);
array_shift( $this->calendar_levels[CDAY]['labels'] ) );
} }
} }

View file

@ -207,7 +207,7 @@ SELECT *
if (isset($image_id) and !in_array($image_id, $image_ids)) 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']) if ($conf['representative_cache_on_level'])

View file

@ -328,7 +328,7 @@ SHOW FULL COLUMNS FROM '.$tablename;
{ {
$column.= " collate '".$row['Collation']."'"; $column.= " collate '".$row['Collation']."'";
} }
array_push($columns, $column); $columns[] = $column;
} }
} }
@ -564,7 +564,7 @@ function do_maintenance_all_tables()
$result = pwg_query($query); $result = pwg_query($query);
while ($row = pwg_db_fetch_row($result)) while ($row = pwg_db_fetch_row($result))
{ {
array_push($all_tables, $row[0]); $all_tables[] = $row[0];
} }
// Repair all tables // Repair all tables
@ -582,7 +582,7 @@ function do_maintenance_all_tables()
{ {
if ($row['Key'] == 'PRI') 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); $mysql_rc = $mysql_rc && pwg_query($query);
if ($mysql_rc) if ($mysql_rc)
{ {
array_push( $page['infos'][] = l10n('All optimizations have been successfully completed.');
$page['infos'],
l10n('All optimizations have been successfully completed.')
);
} }
else else
{ {
array_push( $page['errors'][] = l10n('Optimizations have been completed with some errors.');
$page['errors'],
l10n('Optimizations have been completed with some errors.')
);
} }
} }

View file

@ -365,7 +365,7 @@ SHOW FULL COLUMNS FROM '.$tablename;
{ {
$column.= " collate '".$row['Collation']."'"; $column.= " collate '".$row['Collation']."'";
} }
array_push($columns, $column); $columns[] = $column;
} }
} }
@ -601,7 +601,7 @@ function do_maintenance_all_tables()
$result = pwg_query($query); $result = pwg_query($query);
while ($row = pwg_db_fetch_row($result)) while ($row = pwg_db_fetch_row($result))
{ {
array_push($all_tables, $row[0]); $all_tables[] = $row[0];
} }
// Repair all tables // Repair all tables
@ -619,7 +619,7 @@ function do_maintenance_all_tables()
{ {
if ($row['Key'] == 'PRI') 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); $mysqli_rc = $mysqli_rc && pwg_query($query);
if ($mysqli_rc) if ($mysqli_rc)
{ {
array_push( $page['infos'][] = l10n('All optimizations have been successfully completed.');
$page['infos'],
l10n('All optimizations have been successfully completed.')
);
} }
else else
{ {
array_push( $page['errors'][] = l10n('Optimizations have been completed with some errors.');
$page['errors'],
l10n('Optimizations have been completed with some errors.')
);
} }
} }

View file

@ -123,7 +123,10 @@ WHERE ';
unset($filter_key); unset($filter_key);
if (get_filter_page_value('add_notes')) 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'); include_once(PHPWG_ROOT_PATH.'include/functions_filter.inc.php');
} }

View file

@ -878,8 +878,10 @@ SELECT element_id
foreach ($caddiables as $caddiable) foreach ($caddiables as $caddiable)
{ {
array_push($datas, array('element_id' => $caddiable, $datas[] = array(
'user_id' => $user['id'])); 'element_id' => $caddiable,
'user_id' => $user['id'],
);
} }
if (count($caddiables) > 0) if (count($caddiables) > 0)

View file

@ -212,7 +212,7 @@ WHERE id IN (' . implode(',',$page['items']) .')';
$chronology_date = array(); $chronology_date = array();
if ( isset($page['chronology_date'][0]) ) if ( isset($page['chronology_date'][0]) )
{ {
array_push($chronology_date, $page['chronology_date'][0]); $chronology_date[] = $page['chronology_date'][0];
} }
} }
else else

View file

@ -93,7 +93,7 @@ function insert_user_comment( &$comm, $key, &$infos )
{ {
if ($conf['comments_author_mandatory']) if ($conf['comments_author_mandatory'])
{ {
array_push($infos, l10n('Username is mandatory') ); $infos[] = l10n('Username is mandatory');
$comment_action='reject'; $comment_action='reject';
} }
$comm['author'] = 'guest'; $comm['author'] = 'guest';
@ -110,7 +110,7 @@ SELECT COUNT(*) AS user_exists
$row = pwg_db_fetch_assoc( pwg_query( $query ) ); $row = pwg_db_fetch_assoc( pwg_query( $query ) );
if ( $row['user_exists'] == 1 ) 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'; $comment_action='reject';
} }
} }
@ -141,7 +141,7 @@ SELECT COUNT(*) AS user_exists
} }
if (!url_check_format($comm['website_url'])) 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'; $comment_action='reject';
} }
} }
@ -155,13 +155,13 @@ SELECT COUNT(*) AS user_exists
} }
else if ($conf['comments_email_mandatory']) 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'; $comment_action='reject';
} }
} }
else if (!email_check_format($comm['email'])) 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'; $comment_action='reject';
} }
@ -192,7 +192,7 @@ SELECT count(1) FROM '.COMMENTS_TABLE.'
list($counter) = pwg_db_fetch_row(pwg_query($query)); list($counter) = pwg_db_fetch_row(pwg_query($query));
if ( $counter > 0 ) 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'; $comment_action='reject';
} }
} }

View file

@ -293,7 +293,7 @@ SELECT
{ {
if (!empty($admin['mail_address'])) 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'])) 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']);
} }
} }

View file

@ -206,7 +206,7 @@ function custom_notification_query($action, $type, $start, $end)
while ($row = pwg_db_fetch_assoc($result)) while ($row = pwg_db_fetch_assoc($result))
{ {
array_push($infos, $row); $infos[] = $row;
} }
return $infos; 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>'; $line = '<a href="'.$url.'">'.$line.'</a>';
} }
array_push($news, $line); $news[] = $line;
} }
} }
@ -450,7 +450,7 @@ SELECT date_available,
$dates = array(); $dates = array();
while ($row = pwg_db_fetch_assoc($result)) while ($row = pwg_db_fetch_assoc($result))
{ {
array_push($dates, $row); $dates[] = $row;
} }
for ($i=0; $i<count($dates); $i++) for ($i=0; $i<count($dates); $i++)
@ -469,7 +469,7 @@ SELECT DISTINCT i.*
$result = pwg_query($query); $result = pwg_query($query);
while ($row = pwg_db_fetch_assoc($result)) 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); $result = pwg_query($query);
while ($row = pwg_db_fetch_assoc($result)) 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 .= $description .=
'<li>' '<li>'
.l10n_dec('%d album updated', '%d albums updated', .l10n_dec('%d album updated', '%d albums updated', $date_detail['nb_cats'])
$date_detail['nb_cats'])
.'</li>'; .'</li>';
$description .= '<ul>'; $description .= '<ul>';
@ -557,8 +556,7 @@ function get_html_description_recent_post_date($date_detail)
'<li>' '<li>'
.get_cat_display_name_cache($cat['uppercats']) .get_cat_display_name_cache($cat['uppercats'])
.' ('. .' ('.
l10n_dec('%d new photo', l10n_dec('%d new photo', '%d new photos', $cat['img_count']).')'
'%d new photos', $cat['img_count']).')'
.'</li>'; .'</li>';
} }
$description .= '</ul>'; $description .= '</ul>';

View file

@ -220,7 +220,7 @@ SELECT * FROM '.PLUGINS_TABLE;
$plugins = array(); $plugins = array();
while ($row = pwg_db_fetch_assoc($result)) while ($row = pwg_db_fetch_assoc($result))
{ {
array_push($plugins, $row); $plugins[] = $row;
} }
return $plugins; return $plugins;
} }

View file

@ -68,18 +68,15 @@ function get_sql_search_clause($search)
$local_clauses = array(); $local_clauses = array();
foreach ($search['fields'][$textfield]['words'] as $word) foreach ($search['fields'][$textfield]['words'] as $word)
{ {
array_push($local_clauses, $textfield." LIKE '%".$word."%'"); $local_clauses[] = $textfield." LIKE '%".$word."%'";
} }
// adds brackets around where clauses // adds brackets around where clauses
$local_clauses = prepend_append_array_items($local_clauses, '(', ')'); $local_clauses = prepend_append_array_items($local_clauses, '(', ')');
array_push( $clauses[] = implode(
$clauses, ' '.$search['fields'][$textfield]['mode'].' ',
implode( $local_clauses
' '.$search['fields'][$textfield]['mode'].' ',
$local_clauses
)
); );
} }
} }
@ -100,15 +97,12 @@ function get_sql_search_clause($search)
$field_clauses = array(); $field_clauses = array();
foreach ($fields as $field) foreach ($fields as $field)
{ {
array_push($field_clauses, $field." LIKE '%".$word."%'"); $field_clauses[] = $field." LIKE '%".$word."%'";
} }
// adds brackets around where clauses // adds brackets around where clauses
array_push( $word_clauses[] = implode(
$word_clauses, "\n OR ",
implode( $field_clauses
"\n OR ",
$field_clauses
)
); );
} }
@ -117,26 +111,18 @@ function get_sql_search_clause($search)
create_function('&$s','$s="(".$s.")";') create_function('&$s','$s="(".$s.")";')
); );
array_push( $clauses[] = "\n ".
$clauses,
"\n ".
implode( implode(
"\n ". "\n ". $search['fields']['allwords']['mode']. "\n ",
$search['fields']['allwords']['mode'].
"\n ",
$word_clauses $word_clauses
) );
);
} }
foreach (array('date_available', 'date_creation') as $datefield) foreach (array('date_available', 'date_creation') as $datefield)
{ {
if (isset($search['fields'][$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) foreach (array('after','before') as $suffix)
@ -145,15 +131,10 @@ function get_sql_search_clause($search)
if (isset($search['fields'][$key])) if (isset($search['fields'][$key]))
{ {
array_push( $clauses[] = $datefield.
$clauses,
$datefield.
($suffix == 'after' ? ' >' : ' <'). ($suffix == 'after' ? ' >' : ' <').
($search['fields'][$key]['inc'] ? '=' : ''). ($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).')'; $local_clause = 'category_id IN ('.implode(',', $cat_ids).')';
array_push($clauses, $local_clause); $clauses[] = $local_clause;
} }
// adds brackets around where clauses // adds brackets around where clauses

View file

@ -332,7 +332,7 @@ SELECT *
$tags = array(); $tags = array();
while ($row = pwg_db_fetch_assoc($result)) while ($row = pwg_db_fetch_assoc($result))
{ {
array_push($tags, $row); $tags[] = $row;
} }
return $tags; return $tags;
} }

View file

@ -466,14 +466,13 @@ function parse_section_url( $tokens, &$next_token)
{ {
if (empty($maybe_permalinks)) if (empty($maybe_permalinks))
{ {
array_push($maybe_permalinks, $tokens[$current_token]); $maybe_permalinks[] = $tokens[$current_token];
} }
else else
{ {
array_push($maybe_permalinks, $maybe_permalinks[] =
$maybe_permalinks[count($maybe_permalinks)-1] $maybe_permalinks[count($maybe_permalinks)-1]
. '/' . $tokens[$current_token] . '/' . $tokens[$current_token];
);
} }
$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) ) 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 else
{ {
array_push($requested_tag_url_names, $tokens[$i]); $requested_tag_url_names[] = $tokens[$i];
} }
$i++; $i++;
} }
@ -597,7 +596,7 @@ function parse_section_url( $tokens, &$next_token)
if (empty($tokens[$next_token])) if (empty($tokens[$next_token]))
{ {
// Add dummy element list // Add dummy element list
array_push($page['list'], -1); $page['list'][] = -1;
} }
// With pictures list // With pictures list
else else
@ -608,7 +607,7 @@ function parse_section_url( $tokens, &$next_token)
} }
foreach (explode(',', $tokens[$next_token]) as $image_id) foreach (explode(',', $tokens[$next_token]) as $image_id)
{ {
array_push($page['list'], $image_id); $page['list'][] = $image_id;
} }
} }
$next_token++; $next_token++;

View file

@ -60,13 +60,13 @@ if ( $page['show_comments'] and isset( $_POST['content'] ) )
switch ($comment_action) switch ($comment_action)
{ {
case 'moderate': 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': case 'validate':
array_push($page['infos'], l10n('Your comment has been registered')); $page['infos'][] = l10n('Your comment has been registered');
break; break;
case 'reject': case 'reject':
set_status_header(403); 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; break;
default: default:
trigger_error('Invalid comment action '.$comment_action, E_USER_WARNING); trigger_error('Invalid comment action '.$comment_action, E_USER_WARNING);

View file

@ -339,7 +339,7 @@ else
$page['tag_ids'] = array(); $page['tag_ids'] = array();
foreach ($page['tags'] as $tag) 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']); $items = get_image_ids_for_tags($page['tag_ids']);

View file

@ -401,7 +401,7 @@ SELECT id
$datas = array(); $datas = array();
foreach ( array_from_query($query, 'id') as $id ) 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)) if (count($datas))
{ {
@ -793,7 +793,7 @@ SELECT id, path, representative_ext, level
if (isset($image_id) and !in_array($image_id, $image_ids)) 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']) 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) foreach ($user_representative_updates_for as $cat_id => $image_id)
{ {
array_push( $updates[] = array(
$updates, 'user_id' => $user['id'],
array( 'cat_id' => $cat_id,
'user_id' => $user['id'], 'user_representative_picture_id' => $image_id,
'cat_id' => $cat_id,
'user_representative_picture_id' => $image_id,
)
); );
} }
@ -994,13 +991,13 @@ SELECT DISTINCT image_id
switch ($comment_action) switch ($comment_action)
{ {
case 'reject': 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) ); return new PwgError(403, implode("; ", $infos) );
case 'validate': case 'validate':
case 'moderate': case 'moderate':
$ret = array( $ret = array(
'id' => $comm['id'], 'id' => $comm['id'],
'validation' => $comment_action=='validate', 'validation' => $comment_action=='validate',
); );
return array( 'comment' => new PwgNamedStruct($ret) ); return array( 'comment' => new PwgNamedStruct($ret) );
default: default:
@ -1071,7 +1068,7 @@ SELECT id, name, permalink, uppercats, global_rank, commentable
) )
); );
$row['id']=(int)$row['id']; $row['id']=(int)$row['id'];
array_push($related_categories, $row); $related_categories[] = $row;
} }
usort($related_categories, 'global_rank_compare'); usort($related_categories, 'global_rank_compare');
if ( empty($related_categories) ) if ( empty($related_categories) )
@ -1544,7 +1541,7 @@ function merge_chunks($output_filepath, $original_sum, $type)
if (preg_match($pattern, $file)) if (preg_match($pattern, $file))
{ {
ws_logfile($file); ws_logfile($file);
array_push($chunks, $upload_dir.'/'.$file); $chunks[] = $upload_dir.'/'.$file;
} }
} }
closedir($handle); closedir($handle);
@ -1601,7 +1598,7 @@ function remove_chunks($original_sum, $type)
{ {
if (preg_match($pattern, $file)) if (preg_match($pattern, $file))
{ {
array_push($chunks, $upload_dir.'/'.$file); $chunks[] = $upload_dir.'/'.$file;
} }
} }
closedir($handle); closedir($handle);
@ -1958,8 +1955,7 @@ SELECT *
{ {
foreach ($params['tags'] as $tag_name) foreach ($params['tags'] as $tag_name)
{ {
$tag_id = tag_id_from_tag_name($tag_name); $tag_ids[] = tag_id_from_tag_name($tag_name);
array_push($tag_ids, $tag_id);
} }
} }
else else
@ -1967,8 +1963,7 @@ SELECT *
$tag_names = preg_split('~(?<!\\\),~', $params['tags']); $tag_names = preg_split('~(?<!\\\),~', $params['tags']);
foreach ($tag_names as $tag_name) foreach ($tag_names as $tag_name)
{ {
$tag_id = tag_id_from_tag_name(preg_replace('#\\\\*,#', ',', $tag_name)); $tag_ids[] = tag_id_from_tag_name(preg_replace('#\\\\*,#', ',', $tag_name));
array_push($tag_ids, $tag_id);
} }
} }
@ -2662,7 +2657,7 @@ function ws_images_delete($params, $service)
{ {
if ($image_id > 0) 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; continue;
} }
array_push($cat_ids, $cat_id); $cat_ids[] = $cat_id;
if (!isset($rank)) if (!isset($rank))
{ {
@ -2803,13 +2798,10 @@ SELECT
foreach ($new_cat_ids as $cat_id) foreach ($new_cat_ids as $cat_id)
{ {
array_push( $inserts[] = array(
$inserts, 'image_id' => $image_id,
array( 'category_id' => $cat_id,
'image_id' => $image_id, 'rank' => $rank_on_category[$cat_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) 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) 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 // Add or remove extension from ignore list
if (!in_array($params['id'], $conf['updates_ignored'][$params['type']])) 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']))); conf_update_param('updates_ignored', pwg_db_real_escape_string(serialize($conf['updates_ignored'])));
unset($_SESSION['extensions_need_update']); unset($_SESSION['extensions_need_update']);

View file

@ -66,7 +66,7 @@ class PwgXmlWriter
} }
$this->_output( '<'.$name ); $this->_output( '<'.$name );
$this->_lastTagOpen = true; $this->_lastTagOpen = true;
array_push( $this->_elementStack, $name); $this->_elementStack[] = $name;
} }
function end_element($x) function end_element($x)

View file

@ -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_install.inc.php');
include(PHPWG_ROOT_PATH . 'admin/include/functions_upgrade.php'); include(PHPWG_ROOT_PATH . 'admin/include/functions_upgrade.php');
if ( isset( $_POST['install'] )) if (isset($_POST['install']))
{ {
install_db_connect($infos, $errors); install_db_connect($infos, $errors);
pwg_db_check_charset(); pwg_db_check_charset();
$webmaster = trim(preg_replace( '/\s{2,}/', ' ', $admin_name )); $webmaster = trim(preg_replace('/\s{2,}/', ' ', $admin_name));
if ( empty($webmaster)) if (empty($webmaster))
array_push( $errors, l10n('enter a login for webmaster') ); {
else if ( preg_match( '/[\'"]/', $webmaster ) ) $errors[] = l10n('enter a login for webmaster');
array_push( $errors, l10n('webmaster login can\'t contain characters \' or "') ); }
if ( $admin_pass1 != $admin_pass2 || empty($admin_pass1) ) else if (preg_match( '/[\'"]/', $webmaster))
array_push( $errors, l10n('please enter your password again') ); {
if ( empty($admin_mail)) $errors[] = l10n('webmaster login can\'t contain characters \' or "');
array_push( $errors, l10n('mail address must be like xxx@yyy.eee (example : jack@altern.org)') ); }
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 else
{ {
$error_mail_address = validate_mail_address(null, $admin_mail); $error_mail_address = validate_mail_address(null, $admin_mail);
if (!empty($error_mail_address)) if (!empty($error_mail_address))
array_push( $errors, $error_mail_address ); {
$errors[] = $error_mail_address;
}
} }
if ( count( $errors ) == 0 ) if ( count( $errors ) == 0 )
@ -388,13 +398,10 @@ INSERT INTO '.$prefixeTable.'config (param,value,comment)
$datas = array(); $datas = array();
foreach (get_available_upgrade_ids() as $upgrade_id) foreach (get_available_upgrade_ids() as $upgrade_id)
{ {
array_push( $datas[] = array(
$datas, 'id' => $upgrade_id,
array( 'applied' => CURRENT_DATE,
'id' => $upgrade_id, 'description' => 'upgrade included in installation',
'applied' => CURRENT_DATE,
'description' => 'upgrade included in installation',
)
); );
} }
mass_inserts( mass_inserts(
@ -449,14 +456,11 @@ if ($step == 1)
} }
else else
{ {
array_push( $infos[] = l10n('Congratulations, Piwigo installation is completed');
$infos,
l10n('Congratulations, Piwigo installation is completed')
);
if (isset($error_copy)) if (isset($error_copy))
{ {
array_push($errors, $error_copy); $errors[] = $error_copy;
} }
else else
{ {

View file

@ -45,15 +45,14 @@ if (isset($_GET['subscribe'])
{ {
subscribe_notification_by_mail(false, array($_GET['subscribe'])); subscribe_notification_by_mail(false, array($_GET['subscribe']));
} }
else else if (isset($_GET['unsubscribe'])
if (isset($_GET['unsubscribe'])
and preg_match('/^[A-Za-z0-9]{16}$/', $_GET['unsubscribe'])) and preg_match('/^[A-Za-z0-9]{16}$/', $_GET['unsubscribe']))
{ {
unsubscribe_notification_by_mail(false, array($_GET['unsubscribe'])); unsubscribe_notification_by_mail(false, array($_GET['unsubscribe']));
} }
else else
{ {
array_push($page['errors'], l10n('Unknown identifier')); $page['errors'][] = l10n('Unknown identifier');
} }
// +-----------------------------------------------------------------------+ // +-----------------------------------------------------------------------+

View file

@ -53,7 +53,7 @@ function process_password_request()
if (empty($_POST['username_or_email'])) if (empty($_POST['username_or_email']))
{ {
array_push($page['errors'], l10n('Invalid username or email')); $page['errors'][] = l10n('Invalid username or email');
return false; return false;
} }
@ -66,7 +66,7 @@ function process_password_request()
if (!is_numeric($user_id)) if (!is_numeric($user_id))
{ {
array_push($page['errors'], l10n('Invalid username or email')); $page['errors'][] = l10n('Invalid username or email');
return false; return false;
} }
@ -76,18 +76,15 @@ function process_password_request()
$status = $userdata['status']; $status = $userdata['status'];
if (is_a_guest($status) or is_generic($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; return false;
} }
if (empty($userdata['email'])) if (empty($userdata['email']))
{ {
array_push( $page['errors'][] = l10n(
$page['errors'], 'User "%s" has no email address, password reset is not possible',
l10n( $userdata['username']
'User "%s" has no email address, password reset is not possible',
$userdata['username']
)
); );
return false; return false;
} }
@ -130,12 +127,12 @@ function process_password_request()
if (pwg_mail($userdata['email'], $email_params)) 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; return true;
} }
else else
{ {
array_push($page['errors'], l10n('Error sending email')); $page['errors'][] = l10n('Error sending email');
return false; return false;
} }
} }
@ -152,7 +149,7 @@ function check_password_reset_key($key)
if (!preg_match('/^[a-z0-9]{20}$/i', $key)) if (!preg_match('/^[a-z0-9]{20}$/i', $key))
{ {
array_push($page['errors'], l10n('Invalid key')); $page['errors'][] = l10n('Invalid key');
return false; return false;
} }
@ -167,7 +164,7 @@ SELECT
if (pwg_db_num_rows($result) == 0) if (pwg_db_num_rows($result) == 0)
{ {
array_push($page['errors'], l10n('Invalid key')); $page['errors'][] = l10n('Invalid key');
return false; return false;
} }
@ -175,7 +172,7 @@ SELECT
if (is_a_guest($userdata['status']) or is_generic($userdata['status'])) 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; return false;
} }
@ -194,7 +191,7 @@ function reset_password()
if ($_POST['use_new_pwd'] != $_POST['passwordConf']) 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; return false;
} }
@ -203,7 +200,7 @@ function reset_password()
$user_id = check_password_reset_key($_GET['key']); $user_id = check_password_reset_key($_GET['key']);
if (!is_numeric($user_id)) if (!is_numeric($user_id))
{ {
array_push($page['errors'], l10n('Invalid key')); $page['errors'][] = l10n('Invalid key');
return false; return false;
} }
} }
@ -212,7 +209,7 @@ function reset_password()
// we check the currently logged in user // we check the currently logged in user
if (is_a_guest() or is_generic()) 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; return false;
} }
@ -225,15 +222,15 @@ function reset_password()
array($conf['user_fields']['id'] => $user_id) 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'])) 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 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; return true;

View file

@ -102,8 +102,8 @@ SELECT id
{ {
if ('best_rated'==$page['section']) if ('best_rated'==$page['section'])
{ {
$page['rank_of'][$page['image_id']] = count($page['items']); $page['rank_of'][ $page['image_id'] ] = count($page['items']);
array_push($page['items'], $page['image_id'] ); $page['items'][] = $page['image_id'];
} }
else else
{ {
@ -468,13 +468,13 @@ $picture = array();
$ids = array($page['image_id']); $ids = array($page['image_id']);
if (isset($page['previous_item'])) if (isset($page['previous_item']))
{ {
array_push($ids, $page['previous_item']); $ids[] = $page['previous_item'];
array_push($ids, $page['first_item']); $ids[] = $page['first_item'];
} }
if (isset($page['next_item'])) if (isset($page['next_item']))
{ {
array_push($ids, $page['next_item']); $ids[] = $page['next_item'];
array_push($ids, $page['last_item']); $ids[] = $page['last_item'];
} }
$query = ' $query = '

View file

@ -56,9 +56,8 @@ include_once(LOCALEDIT_PATH.'include/'.$page['tab'].'.inc.php');
if (isset($_POST['restore'])) if (isset($_POST['restore']))
{ {
$content_file = file_get_contents(get_bak_file($edited_file)); $content_file = file_get_contents(get_bak_file($edited_file));
array_push($page['infos'], $page['infos'][] = l10n('locfiledit_bak_loaded1'),
l10n('locfiledit_bak_loaded1'), $page['infos'][] = l10n('locfiledit_bak_loaded2');
l10n('locfiledit_bak_loaded2'));
} }
// +-----------------------------------------------------------------------+ // +-----------------------------------------------------------------------+
@ -70,7 +69,7 @@ if (isset($_POST['submit']))
if (!is_webmaster()) if (!is_webmaster())
{ {
array_push($page['errors'], l10n('locfiledit_webmaster_only')); $page['errors'][] = l10n('locfiledit_webmaster_only');
} }
else else
{ {
@ -81,7 +80,7 @@ if (isset($_POST['submit']))
} }
if ($content_file === false) if ($content_file === false)
{ {
array_push($page['errors'], l10n('locfiledit_syntax_error')); $page['errors'][] = l10n('locfiledit_syntax_error');
} }
else else
{ {
@ -92,7 +91,7 @@ if (isset($_POST['submit']))
if (file_exists($edited_file)) if (file_exists($edited_file))
{ {
@copy($edited_file, get_bak_file($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")) if ($file = @fopen($edited_file , "w"))
@ -104,7 +103,7 @@ if (isset($_POST['submit']))
} }
else else
{ {
array_push($page['errors'], l10n('locfiledit_cant_save')); $page['errors'][] = l10n('locfiledit_cant_save');
} }
} }
} }

View file

@ -64,7 +64,7 @@ $db_themes = $themes->get_db_themes();
$db_theme_ids = array(); $db_theme_ids = array();
foreach ($db_themes as $db_theme) foreach ($db_themes as $db_theme)
{ {
array_push($db_theme_ids, $db_theme['id']); $db_theme_ids[] = $db_theme['id'];
} }
$active_themes = array(); $active_themes = array();
@ -85,12 +85,12 @@ foreach ($themes->fs_themes as $theme_id => $fs_theme)
} }
else else
{ {
array_push($active_themes, $fs_theme); $active_themes[] = $fs_theme;
} }
} }
else else
{ {
array_push($inactive_themes, $fs_theme); $inactive_themes[] = $fs_theme;
} }
} }

View file

@ -39,7 +39,7 @@ if (isset($_POST['create_tpl']))
$filename = $_POST['tpl_name']; $filename = $_POST['tpl_name'];
if (empty($filename)) if (empty($filename))
{ {
array_push($page['errors'], l10n('locfiledit_empty_filename')); $page['errors'][] = l10n('locfiledit_empty_filename');
} }
if (get_extension($filename) != 'tpl') if (get_extension($filename) != 'tpl')
{ {
@ -47,15 +47,15 @@ if (isset($_POST['create_tpl']))
} }
if (!preg_match('/^[a-zA-Z0-9-_.]+$/', $filename)) 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') 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)) 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'])) if (!empty($page['errors']))
{ {

View file

@ -35,12 +35,9 @@ define('LOCALEDIT_PATH' , PHPWG_PLUGINS_PATH . basename(dirname(__FILE__)) . '/'
function localfiles_admin_menu($menu) function localfiles_admin_menu($menu)
{ {
array_push( $menu[] = array(
$menu, 'NAME' => 'LocalFiles Editor',
array( 'URL' => get_root_url().'admin.php?page=plugin-'.basename(dirname(__FILE__))
'NAME' => 'LocalFiles Editor',
'URL' => get_root_url().'admin.php?page=plugin-'.basename(dirname(__FILE__))
)
); );
return $menu; return $menu;

View file

@ -201,7 +201,7 @@ function save_profile_from_post($userdata, &$errors)
// password is updated only if filled // password is updated only if filled
if (!empty($_POST['use_new_pwd'])) 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'] // password is hashed with function $conf['password_hash']
$data{$conf['user_fields']['password']} = $conf['password_hash']($_POST['use_new_pwd']); $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'])) 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']); unset($_POST['redirect']);
} }
else else
{ {
array_push($fields, $conf['user_fields']['username']); $fields[] = $conf['user_fields']['username'];
$data{$conf['user_fields']['username']} = $_POST['username']; $data{$conf['user_fields']['username']} = $_POST['username'];
// send email to the user // send email to the user
@ -262,7 +262,7 @@ function save_profile_from_post($userdata, &$errors)
if ($conf['activate_comments']) if ($conf['activate_comments'])
{ {
array_push($fields, 'show_nb_comments'); $fields[] = 'show_nb_comments';
} }
$data = array(); $data = array();

View file

@ -44,12 +44,12 @@ if (isset($_POST['submit']))
if (!verify_ephemeral_key(@$_POST['key'])) if (!verify_ephemeral_key(@$_POST['key']))
{ {
set_status_header(403); 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']) 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'] = $page['errors'] =

View file

@ -149,7 +149,7 @@ INSERT INTO '.SEARCH_TABLE.'
} }
else else
{ {
array_push($page['errors'], l10n('Empty query. No criteria has been entered.')); $page['errors'][] = l10n('Empty query. No criteria has been entered.');
} }
} }
//----------------------------------------------------------------- redirection //----------------------------------------------------------------- redirection

View file

@ -138,7 +138,7 @@ SELECT id, uppercats, global_rank
{ {
while ($row = pwg_db_fetch_assoc($result)) while ($row = pwg_db_fetch_assoc($result))
{ {
array_push($categories, $row); $categories[] = $row;
} }
} }
usort($categories, 'global_rank_compare'); usort($categories, 'global_rank_compare');

View file

@ -131,17 +131,10 @@ if ($page['display_mode'] == 'letters') {
); );
} }
array_push( $letter['tags'][] = array_merge(
$letter['tags'], $tag,
array_merge( array(
$tag, 'URL' => make_index_url(array('tags' => array($tag))),
array(
'URL' => make_index_url(
array(
'tags' => array($tag),
)
),
)
) )
); );

View file

@ -73,7 +73,7 @@ SHOW TABLES
{ {
if (preg_match('/^'.PREFIX_TABLE.'/', $row[0])) 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)) 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)) if (!@file_put_contents($config_file, $config_file_contents))
{ {
array_push( $page['infos'][] = l10n(
$page['infos'], 'In <i>%s</i>, before <b>?></b>, insert:',
sprintf( PWG_LOCAL_DIR.'config/database.inc.php'
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>';
.'<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'], $page['infos'][] = l10n('Perform a maintenance check in [Administration>Tools>Maintenance] if you encounter any problem.');
l10n('Perform a maintenance check in [Administration>Tools>Maintenance] if you encounter any problem.')
);
// Save $page['infos'] in order to restore after maintenance actions // Save $page['infos'] in order to restore after maintenance actions
$page['infos_sav'] = $page['infos']; $page['infos_sav'] = $page['infos'];