aboutsummaryrefslogtreecommitdiffstats
path: root/admin/include
diff options
context:
space:
mode:
Diffstat (limited to 'admin/include')
-rw-r--r--admin/include/check_integrity.class.php28
-rw-r--r--admin/include/configuration_sizes_process.inc.php5
-rw-r--r--admin/include/configuration_watermark_process.inc.php5
-rw-r--r--admin/include/functions.php79
-rw-r--r--admin/include/functions_history.inc.php38
-rw-r--r--admin/include/functions_install.inc.php2
-rw-r--r--admin/include/functions_metadata.php11
-rw-r--r--admin/include/functions_notification_by_mail.inc.php65
-rw-r--r--admin/include/functions_plugins.inc.php2
-rw-r--r--admin/include/functions_upgrade.php20
-rw-r--r--admin/include/functions_upload.inc.php21
-rw-r--r--admin/include/languages.class.php12
-rw-r--r--admin/include/photos_add_direct_prepare.inc.php20
-rw-r--r--admin/include/photos_add_direct_process.inc.php78
-rw-r--r--admin/include/plugins.class.php4
-rw-r--r--admin/include/themes.class.php33
-rw-r--r--admin/include/updates.class.php25
-rw-r--r--admin/include/uploadify/uploadify.php15
18 files changed, 183 insertions, 280 deletions
diff --git a/admin/include/check_integrity.class.php b/admin/include/check_integrity.class.php
index 62372e214..3e8089a58 100644
--- a/admin/include/check_integrity.class.php
+++ b/admin/include/check_integrity.class.php
@@ -71,9 +71,10 @@ class check_integrity
// Information
if (count($this->retrieve_list) > 0)
{
- $header_notes[] =
- l10n_dec('%d anomaly has been detected.', '%d anomalies have been detected.',
- count($this->retrieve_list));
+ $header_notes[] = l10n_dec(
+ '%d anomaly has been detected.', '%d anomalies have been detected.',
+ count($this->retrieve_list)
+ );
}
// Treatments
@@ -116,15 +117,17 @@ class check_integrity
if ($corrected_count > 0)
{
- $page['infos'][] =
- l10n_dec('%d anomaly has been corrected.', '%d anomalies have been detected corrected.',
- $corrected_count);
+ $page['infos'][] = l10n_dec(
+ '%d anomaly has been corrected.', '%d anomalies have been detected corrected.',
+ $corrected_count
+ );
}
if ($not_corrected_count > 0)
{
- $page['errors'][] =
- l10n_dec('%d anomaly has not been corrected.', '%d anomalies have not been corrected.',
- $not_corrected_count);
+ $page['errors'][] = l10n_dec(
+ '%d anomaly has not been corrected.', '%d anomalies have not been corrected.',
+ $not_corrected_count
+ );
}
}
else
@@ -145,9 +148,10 @@ class check_integrity
if ($ignored_count > 0)
{
- $page['infos'][] =
- l10n_dec('%d anomaly has been ignored.', '%d anomalies have been ignored.',
- $ignored_count);
+ $page['infos'][] = l10n_dec(
+ '%d anomaly has been ignored.', '%d anomalies have been ignored.',
+ $ignored_count
+ );
}
}
}
diff --git a/admin/include/configuration_sizes_process.inc.php b/admin/include/configuration_sizes_process.inc.php
index e6fa870d6..dc8f2c5d5 100644
--- a/admin/include/configuration_sizes_process.inc.php
+++ b/admin/include/configuration_sizes_process.inc.php
@@ -254,10 +254,7 @@ if (count($errors) == 0)
clear_derivative_cache($changed_types);
}
- array_push(
- $page['infos'],
- l10n('Your configuration settings are saved')
- );
+ $page['infos'][] = l10n('Your configuration settings are saved');
}
else
{
diff --git a/admin/include/configuration_watermark_process.inc.php b/admin/include/configuration_watermark_process.inc.php
index 0d28e32a8..c8dfe991a 100644
--- a/admin/include/configuration_watermark_process.inc.php
+++ b/admin/include/configuration_watermark_process.inc.php
@@ -174,10 +174,7 @@ if (count($errors) == 0)
clear_derivative_cache($changed_types);
}
- array_push(
- $page['infos'],
- l10n('Your configuration settings are saved')
- );
+ $page['infos'][] = l10n('Your configuration settings are saved');
}
else
{
diff --git a/admin/include/functions.php b/admin/include/functions.php
index 7972cb989..39d8f85ee 100644
--- a/admin/include/functions.php
+++ b/admin/include/functions.php
@@ -540,7 +540,7 @@ function get_fs_directories($path, $recursive = true)
and $node != 'pwg_representative'
and is_dir($path.'/'.$node))
{
- array_push($dirs, $path.'/'.$node);
+ $dirs[] = $path.'/'.$node;
if ($recursive)
{
$dirs = array_merge($dirs, get_fs_directories($path.'/'.$node));
@@ -747,12 +747,9 @@ SELECT image_id
;';
list($representative) = pwg_db_fetch_row(pwg_query($query));
- array_push(
- $datas,
- array(
- 'id' => $category_id,
- 'representative_picture_id' => $representative,
- )
+ $datas[] = array(
+ 'id' => $category_id,
+ 'representative_picture_id' => $representative,
);
}
@@ -862,26 +859,26 @@ function get_fs($path, $recursive = true)
{
if (basename($path) == 'thumbnail')
{
- array_push($fs['thumbnails'], $path.'/'.$node);
+ $fs['thumbnails'][] = $path.'/'.$node;
}
else if (basename($path) == 'pwg_representative')
{
- array_push($fs['representatives'], $path.'/'.$node);
+ $fs['representatives'][] = $path.'/'.$node;
}
else
{
- array_push($fs['elements'], $path.'/'.$node);
+ $fs['elements'][] = $path.'/'.$node;
}
}
// else if (in_array($extension, $conf['file_ext']))
else if (isset($conf['flip_file_ext'][$extension]))
{
- array_push($fs['elements'], $path.'/'.$node);
+ $fs['elements'][] = $path.'/'.$node;
}
}
else if (is_dir($path.'/'.$node) and $node != 'pwg_high' and $recursive)
{
- array_push($subdirs, $node);
+ $subdirs[] = $node;
}
}
}
@@ -995,19 +992,16 @@ SELECT id, id_uppercat, uppercats
$uppercat = $id;
while ($uppercat)
{
- array_push($upper_list, $uppercat);
+ $upper_list[] = $uppercat;
$uppercat = $cat_map[$uppercat]['id_uppercat'];
}
$new_uppercats = implode(',', array_reverse($upper_list));
if ($new_uppercats != $cat['uppercats'])
{
- array_push(
- $datas,
- array(
- 'id' => $id,
- 'uppercats' => $new_uppercats
- )
+ $datas[] = array(
+ 'id' => $id,
+ 'uppercats' => $new_uppercats
);
}
}
@@ -1095,10 +1089,7 @@ SELECT uppercats
// into a new parent category with uppercats 12,125,13,14,24
if (preg_match('/^'.$category['uppercats'].'(,|$)/', $new_parent_uppercats))
{
- array_push(
- $page['errors'],
- l10n('You cannot move an album in its own sub album')
- );
+ $page['errors'][] = l10n('You cannot move an album in its own sub album');
return;
}
}
@@ -1177,12 +1168,9 @@ DELETE FROM '.$table.'
}
}
- array_push(
- $page['infos'],
- l10n_dec(
- '%d album moved', '%d albums moved',
- count($categories)
- )
+ $page['infos'][] = l10n_dec(
+ '%d album moved', '%d albums moved',
+ count($categories)
);
}
@@ -1307,12 +1295,9 @@ SELECT id, uppercats, global_rank, visible, status
$inserts = array();
foreach ($granted_grps as $granted_grp)
{
- array_push(
- $inserts,
- array(
- 'group_id' => $granted_grp,
- 'cat_id' => $inserted_id
- )
+ $inserts[] = array(
+ 'group_id' => $granted_grp,
+ 'cat_id' => $inserted_id
);
}
mass_inserts(GROUP_ACCESS_TABLE, array('group_id','cat_id'), $inserts);
@@ -1586,13 +1571,10 @@ SELECT
{
$rank = ++$current_rank_of[$category_id];
- array_push(
- $inserts,
- array(
- 'image_id' => $image_id,
- 'category_id' => $category_id,
- 'rank' => $rank,
- )
+ $inserts[] = array(
+ 'image_id' => $image_id,
+ 'category_id' => $category_id,
+ 'rank' => $rank,
);
}
}
@@ -2315,7 +2297,7 @@ SELECT
$result = pwg_query($query);
while ($row = pwg_db_fetch_assoc($result))
{
- array_push($granteds[$row['cat_id']], $row['user_id']);
+ $granteds[ $row['cat_id'] ][] = $row['user_id'];
}
$inserts = array();
@@ -2326,12 +2308,9 @@ SELECT
foreach ($grant_to_users as $user_id)
{
- array_push(
- $inserts,
- array(
- 'user_id' => $user_id,
- 'cat_id' => $cat_id
- )
+ $inserts[] = array(
+ 'user_id' => $user_id,
+ 'cat_id' => $cat_id
);
}
}
@@ -2513,7 +2492,7 @@ function get_dirs($directory)
and is_dir($directory.'/'.$file)
and $file != '.svn')
{
- array_push($sub_dirs, $file);
+ $sub_dirs[] = $file;
}
}
closedir($opendir);
diff --git a/admin/include/functions_history.inc.php b/admin/include/functions_history.inc.php
index 2b18547dc..fec287263 100644
--- a/admin/include/functions_history.inc.php
+++ b/admin/include/functions_history.inc.php
@@ -58,18 +58,12 @@ SELECT
if (isset($search['fields']['date-after']))
{
- array_push(
- $clauses,
- "date >= '".$search['fields']['date-after']."'"
- );
+ $clauses[] = "date >= '".$search['fields']['date-after']."'";
}
if (isset($search['fields']['date-before']))
{
- array_push(
- $clauses,
- "date <= '".$search['fields']['date-before']."'"
- );
+ $clauses[] = "date <= '".$search['fields']['date-before']."'";
}
if (isset($search['fields']['types']))
@@ -88,34 +82,25 @@ SELECT
$clause.= "= '".$type."'";
}
- array_push($local_clauses, $clause);
+ $local_clauses[] = $clause;
}
}
if (count($local_clauses) > 0)
{
- array_push(
- $clauses,
- implode(' OR ', $local_clauses)
- );
+ $clauses[] = implode(' OR ', $local_clauses);
}
}
if (isset($search['fields']['user'])
and $search['fields']['user'] != -1)
{
- array_push(
- $clauses,
- 'user_id = '.$search['fields']['user']
- );
+ $clauses[] = 'user_id = '.$search['fields']['user'];
}
if (isset($search['fields']['image_id']))
{
- array_push(
- $clauses,
- 'image_id = '.$search['fields']['image_id']
- );
+ $clauses[] = 'image_id = '.$search['fields']['image_id'];
}
if (isset($search['fields']['filename']))
@@ -123,14 +108,11 @@ SELECT
if (count($search['image_ids']) == 0)
{
// a clause that is always false
- array_push($clauses, '1 = 2 ');
+ $clauses[] = '1 = 2 ';
}
else
{
- array_push(
- $clauses,
- 'image_id IN ('.implode(', ', $search['image_ids']).')'
- );
+ $clauses[] = 'image_id IN ('.implode(', ', $search['image_ids']).')';
}
}
@@ -168,7 +150,7 @@ SELECT
while ($row = pwg_db_fetch_assoc($result))
{
- array_push($data, $row);
+ $data[] = $row;
}
return $data;
@@ -177,4 +159,4 @@ SELECT
add_event_handler('get_history', 'get_history', EVENT_HANDLER_PRIORITY_NEUTRAL, 3);
trigger_action('functions_history_included');
-?>
+?> \ No newline at end of file
diff --git a/admin/include/functions_install.inc.php b/admin/include/functions_install.inc.php
index d9643e721..e4d447eef 100644
--- a/admin/include/functions_install.inc.php
+++ b/admin/include/functions_install.inc.php
@@ -96,7 +96,7 @@ function install_db_connect(&$infos, &$errors)
}
catch (Exception $e)
{
- array_push( $errors, l10n($e->getMessage()));
+ $errors[] = l10n($e->getMessage());
}
}
?> \ No newline at end of file
diff --git a/admin/include/functions_metadata.php b/admin/include/functions_metadata.php
index e3fc84d96..4591017bb 100644
--- a/admin/include/functions_metadata.php
+++ b/admin/include/functions_metadata.php
@@ -219,23 +219,20 @@ SELECT id, path, representative_ext
foreach (explode(',', $data[$key]) as $tag_name)
{
- array_push(
- $tags_of[$id],
- tag_id_from_tag_name($tag_name)
- );
+ $tags_of[$id][] = tag_id_from_tag_name($tag_name);
}
}
}
$data['date_metadata_update'] = CURRENT_DATE;
- array_push($datas, $data);
+ $datas[] = $data;
}
if (count($datas) > 0)
{
$update_fields = get_sync_metadata_attributes();
- array_push($update_fields, 'date_metadata_update');
+ $update_fields[] = 'date_metadata_update';
$update_fields = array_diff(
$update_fields,
@@ -297,7 +294,7 @@ SELECT id
$result = pwg_query($query);
while ($row = pwg_db_fetch_assoc($result))
{
- array_push($cat_ids, $row['id']);
+ $cat_ids[] = $row['id'];
}
if (count($cat_ids) == 0)
diff --git a/admin/include/functions_notification_by_mail.inc.php b/admin/include/functions_notification_by_mail.inc.php
index e727e9e6f..9d5e7ecfc 100644
--- a/admin/include/functions_notification_by_mail.inc.php
+++ b/admin/include/functions_notification_by_mail.inc.php
@@ -169,7 +169,7 @@ order by';
{
while ($nbm_user = pwg_db_fetch_assoc($result))
{
- array_push($data_users, $nbm_user);
+ $data_users[] = $nbm_user;
}
}
}
@@ -285,7 +285,7 @@ function inc_mail_sent_success($nbm_user)
global $page, $env_nbm;
$env_nbm['sent_mail_count'] += 1;
- array_push($page['infos'], sprintf($env_nbm['msg_info'], stripslashes($nbm_user['username']), $nbm_user['mail_address']));
+ $page['infos'][] = sprintf($env_nbm['msg_info'], stripslashes($nbm_user['username']), $nbm_user['mail_address']);
}
/*
@@ -298,7 +298,7 @@ function inc_mail_sent_failed($nbm_user)
global $page, $env_nbm;
$env_nbm['error_on_mail_count'] += 1;
- array_push($page['errors'], sprintf($env_nbm['msg_error'], stripslashes($nbm_user['username']), $nbm_user['mail_address']));
+ $page['errors'][] = sprintf($env_nbm['msg_error'], stripslashes($nbm_user['username']), $nbm_user['mail_address']);
}
/*
@@ -312,16 +312,32 @@ function display_counter_info()
if ($env_nbm['error_on_mail_count'] != 0)
{
- array_push($page['errors'], l10n_dec('%d mail was not sent.', '%d mails were not sent.', $env_nbm['error_on_mail_count']));
+ $page['errors'][] = l10n_dec(
+ '%d mail was not sent.', '%d mails were not sent.',
+ $env_nbm['error_on_mail_count']
+ );
+
if ($env_nbm['sent_mail_count'] != 0)
- array_push($page['infos'], l10n_dec('%d mail was sent.', '%d mails were sent.', $env_nbm['sent_mail_count']));
+ {
+ $page['infos'][] = l10n_dec(
+ '%d mail was sent.', '%d mails were sent.',
+ $env_nbm['sent_mail_count']
+ );
+ }
}
else
{
if ($env_nbm['sent_mail_count'] == 0)
- array_push($page['infos'], l10n('No mail to send.'));
+ {
+ $page['infos'][] = l10n('No mail to send.');
+ }
else
- array_push($page['infos'], l10n_dec('%d mail was sent.', '%d mails were sent.', $env_nbm['sent_mail_count']));
+ {
+ $page['infos'][] = l10n_dec(
+ '%d mail was sent.', '%d mails were sent.',
+ $env_nbm['sent_mail_count']
+ );
+ }
}
}
@@ -394,12 +410,12 @@ function do_subscribe_unsubscribe_notification_by_mail($is_admin_request, $is_su
if (check_sendmail_timeout())
{
// Stop fill list on 'send', if the quota is override
- array_push($page['errors'], $msg_break_timeout);
+ $page['errors'][] = $msg_break_timeout;
break;
}
// Fill return list
- array_push($check_key_treated, $nbm_user['check_key']);
+ $check_key_treated[] = $nbm_user['check_key'];
$do_update = true;
if ($nbm_user['mail_address'] != '')
@@ -453,22 +469,17 @@ function do_subscribe_unsubscribe_notification_by_mail($is_admin_request, $is_su
if ($do_update)
{
- array_push
- (
- $updates,
- array
- (
- 'check_key' => $nbm_user['check_key'],
- 'enabled' => $enabled_value
- )
- );
+ $updates[] = array(
+ 'check_key' => $nbm_user['check_key'],
+ 'enabled' => $enabled_value
+ );
$updated_data_count += 1;
- array_push($page['infos'], sprintf($msg_info, stripslashes($nbm_user['username']), $nbm_user['mail_address']));
+ $page['infos'][] = sprintf($msg_info, stripslashes($nbm_user['username']), $nbm_user['mail_address']);
}
else
{
$error_on_updated_data_count += 1;
- array_push($page['errors'], sprintf($msg_error, stripslashes($nbm_user['username']), $nbm_user['mail_address']));
+ $page['errors'][] = sprintf($msg_error, stripslashes($nbm_user['username']), $nbm_user['mail_address']);
}
}
@@ -489,13 +500,17 @@ function do_subscribe_unsubscribe_notification_by_mail($is_admin_request, $is_su
}
- array_push($page['infos'], l10n_dec('%d user was updated.', '%d users were updated.', $updated_data_count));
+ $page['infos'][] = l10n_dec(
+ '%d user was updated.', '%d users were updated.',
+ $updated_data_count
+ );
+
if ($error_on_updated_data_count != 0)
{
- array_push($page['errors'],
- l10n_dec('%d user was not updated.',
- '%d users were not updated.',
- $error_on_updated_data_count));
+ $page['errors'][] = l10n_dec(
+ '%d user was not updated.', '%d users were not updated.',
+ $error_on_updated_data_count
+ );
}
unset_make_full_url();
diff --git a/admin/include/functions_plugins.inc.php b/admin/include/functions_plugins.inc.php
index 682e05d06..7e3774b73 100644
--- a/admin/include/functions_plugins.inc.php
+++ b/admin/include/functions_plugins.inc.php
@@ -39,7 +39,7 @@ function get_admin_plugin_menu_link($file)
}
else if (isset($page['errors']))
{
- array_push($page['errors'], 'PLUGIN ERROR: "'.$file.'" is not a valid file');
+ $page['errors'][] = 'PLUGIN ERROR: "'.$file.'" is not a valid file';
}
return $url;
}
diff --git a/admin/include/functions_upgrade.php b/admin/include/functions_upgrade.php
index ed4b0f410..5ede711fe 100644
--- a/admin/include/functions_upgrade.php
+++ b/admin/include/functions_upgrade.php
@@ -93,7 +93,7 @@ AND id NOT IN (\'' . implode('\',\'', $standard_plugins) . '\')
$plugins = array();
while ($row = pwg_db_fetch_assoc($result))
{
- array_push($plugins, $row['id']);
+ $plugins[] = $row['id'];
}
if (!empty($plugins))
@@ -105,8 +105,8 @@ WHERE id IN (\'' . implode('\',\'', $plugins) . '\')
;';
pwg_query($query);
- array_push($page['infos'],
- l10n('As a precaution, following plugins have been deactivated. You must check for plugins upgrade before reactiving them:').'<p><i>'.implode(', ', $plugins).'</i></p>');
+ $page['infos'][] = l10n('As a precaution, following plugins have been deactivated. You must check for plugins upgrade before reactiving them:')
+ .'<p><i>'.implode(', ', $plugins).'</i></p>';
}
}
@@ -135,8 +135,8 @@ SELECT
$theme_names = array();
while ($row = pwg_db_fetch_assoc($result))
{
- array_push($theme_ids, $row['id']);
- array_push($theme_names, $row['name']);
+ $theme_ids[] = $row['id'];
+ $theme_names[] = $row['name'];
}
if (!empty($theme_ids))
@@ -148,8 +148,8 @@ DELETE
;';
pwg_query($query);
- array_push($page['infos'],
- l10n('As a precaution, following themes have been deactivated. You must check for themes upgrade before reactiving them:').'<p><i>'.implode(', ', $theme_names).'</i></p>');
+ $page['infos'][] = l10n('As a precaution, following themes have been deactivated. You must check for themes upgrade before reactiving them:')
+ .'<p><i>'.implode(', ', $theme_names).'</i></p>';
// what is the default theme?
$query = '
@@ -249,11 +249,11 @@ WHERE '.$conf['user_fields']['username'].'=\''.$username.'\'
if (!$conf['password_verify']($password, $row['password']))
{
- array_push($page['errors'], l10n('Invalid password!'));
+ $page['errors'][] = l10n('Invalid password!');
}
elseif ($row['status'] != 'admin' and $row['status'] != 'webmaster')
{
- array_push($page['errors'], l10n('You do not have access rights to run upgrade'));
+ $page['errors'][] = l10n('You do not have access rights to run upgrade');
}
else
{
@@ -279,7 +279,7 @@ function get_available_upgrade_ids()
if (is_file($upgrades_path.'/'.$node)
and preg_match('/^(.*?)-database\.php$/', $node, $match))
{
- array_push($available_upgrade_ids, $match[1]);
+ $available_upgrade_ids[] = $match[1];
}
}
}
diff --git a/admin/include/functions_upload.inc.php b/admin/include/functions_upload.inc.php
index a23977910..d136e8928 100644
--- a/admin/include/functions_upload.inc.php
+++ b/admin/include/functions_upload.inc.php
@@ -122,13 +122,9 @@ function save_upload_form_config($data, &$errors=array(), &$form_errors=array())
}
else
{
- array_push(
- $errors,
- sprintf(
- $upload_form_config[$field]['error_message'],
- $min,
- $max
- )
+ $errors[] = sprintf(
+ $upload_form_config[$field]['error_message'],
+ $min, $max
);
$form_errors[$field] = '['.$min.' .. '.$max.']';
@@ -494,16 +490,7 @@ function convert_shorthand_notation_to_bytes($value)
function add_upload_error($upload_id, $error_message)
{
- if (!isset($_SESSION['uploads_error']))
- {
- $_SESSION['uploads_error'] = array();
- }
- if (!isset($_SESSION['uploads_error'][$upload_id]))
- {
- $_SESSION['uploads_error'][$upload_id] = array();
- }
-
- array_push($_SESSION['uploads_error'][$upload_id], $error_message);
+ $_SESSION['uploads_error'][$upload_id][] = $error_message;
}
function ready_for_upload_message()
diff --git a/admin/include/languages.class.php b/admin/include/languages.class.php
index c024d881b..450e39dad 100644
--- a/admin/include/languages.class.php
+++ b/admin/include/languages.class.php
@@ -57,7 +57,7 @@ class languages
case 'activate':
if (isset($crt_db_language))
{
- array_push($errors, 'CANNOT ACTIVATE - LANGUAGE IS ALREADY ACTIVATED');
+ $errors[] = 'CANNOT ACTIVATE - LANGUAGE IS ALREADY ACTIVATED';
break;
}
@@ -74,13 +74,13 @@ INSERT INTO '.LANGUAGES_TABLE.'
case 'deactivate':
if (!isset($crt_db_language))
{
- array_push($errors, 'CANNOT DEACTIVATE - LANGUAGE IS ALREADY DEACTIVATED');
+ $errors[] = 'CANNOT DEACTIVATE - LANGUAGE IS ALREADY DEACTIVATED';
break;
}
if ($language_id == get_default_language())
{
- array_push($errors, 'CANNOT DEACTIVATE - LANGUAGE IS DEFAULT LANGUAGE');
+ $errors[] = 'CANNOT DEACTIVATE - LANGUAGE IS DEFAULT LANGUAGE';
break;
}
@@ -95,12 +95,12 @@ DELETE
case 'delete':
if (!empty($crt_db_language))
{
- array_push($errors, 'CANNOT DELETE - LANGUAGE IS ACTIVATED');
+ $errors[] = 'CANNOT DELETE - LANGUAGE IS ACTIVATED';
break;
}
if (!isset($this->fs_languages[$language_id]))
{
- array_push($errors, 'CANNOT DELETE - LANGUAGE DOES NOT EXIST');
+ $errors[] = 'CANNOT DELETE - LANGUAGE DOES NOT EXIST';
break;
}
@@ -368,7 +368,7 @@ UPDATE '.USER_INFOS_TABLE.'
and $old_files = file($extract_path.'/obsolete.list', FILE_IGNORE_NEW_LINES)
and !empty($old_files))
{
- array_push($old_files, 'obsolete.list');
+ $old_files[] = 'obsolete.list';
foreach($old_files as $old_file)
{
$path = $extract_path.'/'.$old_file;
diff --git a/admin/include/photos_add_direct_prepare.inc.php b/admin/include/photos_add_direct_prepare.inc.php
index 4f5f61187..fb5331a47 100644
--- a/admin/include/photos_add_direct_prepare.inc.php
+++ b/admin/include/photos_add_direct_prepare.inc.php
@@ -209,12 +209,12 @@ $setup_errors = array();
$error_message = ready_for_upload_message();
if (!empty($error_message))
{
- array_push($setup_errors, $error_message);
+ $setup_errors[] = $error_message;
}
if (!function_exists('gd_info'))
{
- array_push($setup_errors, l10n('GD library is missing'));
+ $setup_errors[] = l10n('GD library is missing');
}
$template->assign(
@@ -235,21 +235,15 @@ if (!isset($_SESSION['upload_hide_warnings']))
if ($conf['use_exif'] and !function_exists('read_exif_data'))
{
- array_push(
- $setup_warnings,
- l10n('Exif extension not available, admin should disable exif use')
- );
+ $setup_warnings[] = l10n('Exif extension not available, admin should disable exif use');
}
if (get_ini_size('upload_max_filesize') > get_ini_size('post_max_size'))
{
- array_push(
- $setup_warnings,
- sprintf(
- l10n('In your php.ini file, the upload_max_filesize (%sB) is bigger than post_max_size (%sB), you should change this setting'),
- get_ini_size('upload_max_filesize', false),
- get_ini_size('post_max_size', false)
- )
+ $setup_warnings[] = l10n(
+ 'In your php.ini file, the upload_max_filesize (%sB) is bigger than post_max_size (%sB), you should change this setting',
+ get_ini_size('upload_max_filesize', false),
+ get_ini_size('post_max_size', false)
);
}
$template->assign(
diff --git a/admin/include/photos_add_direct_process.inc.php b/admin/include/photos_add_direct_process.inc.php
index eb5536342..9cb8e60ba 100644
--- a/admin/include/photos_add_direct_process.inc.php
+++ b/admin/include/photos_add_direct_process.inc.php
@@ -34,12 +34,9 @@ if (isset($_GET['processed']))
// exceeded the post_max_size (but not the upload_max_size)
if (!isset($_POST['submit_upload']))
{
- array_push(
- $page['errors'],
- sprintf(
- l10n('The uploaded files exceed the post_max_size directive in php.ini: %sB'),
- ini_get('post_max_size')
- )
+ $page['errors'][] = l10n(
+ 'The uploaded files exceed the post_max_size directive in php.ini: %sB',
+ ini_get('post_max_size')
);
}
else
@@ -51,7 +48,7 @@ if (isset($_GET['processed']))
{
foreach ($_POST['onUploadError'] as $error)
{
- array_push($page['errors'], $error);
+ $page['errors'][] = $error;
}
}
@@ -97,14 +94,11 @@ if (isset($_GET['processed']))
if (is_valid_image_extension(pathinfo($node['filename'], PATHINFO_EXTENSION)))
{
- array_push($indexes_to_extract, $node['index']);
+ $indexes_to_extract[] = $node['index'];
- array_push(
- $images_to_add,
- array(
- 'source_filepath' => $upload_dir.'/'.$temporary_archive_name.'/'.$node['filename'],
- 'original_filename' => basename($node['filename']),
- )
+ $images_to_add[] = array(
+ 'source_filepath' => $upload_dir.'/'.$temporary_archive_name.'/'.$node['filename'],
+ 'original_filename' => basename($node['filename']),
);
}
}
@@ -121,12 +115,9 @@ if (isset($_GET['processed']))
}
elseif (is_valid_image_extension($extension))
{
- array_push(
- $images_to_add,
- array(
- 'source_filepath' => $_FILES['image_upload']['tmp_name'][$idx],
- 'original_filename' => $_FILES['image_upload']['name'][$idx],
- )
+ $images_to_add[] = array(
+ 'source_filepath' => $_FILES['image_upload']['tmp_name'][$idx],
+ 'original_filename' => $_FILES['image_upload']['name'][$idx],
);
}
@@ -139,7 +130,7 @@ if (isset($_GET['processed']))
$_POST['level']
);
- array_push($image_ids, $image_id);
+ $image_ids[] = $image_id;
// TODO: if $image_id is not an integer, something went wrong
}
@@ -148,13 +139,10 @@ if (isset($_GET['processed']))
{
$error_message = file_upload_error_message($error);
- array_push(
- $page['errors'],
- sprintf(
- l10n('Error on file "%s" : %s'),
- $_FILES['image_upload']['name'][$idx],
- $error_message
- )
+ $page['errors'][] = l10n(
+ 'Error on file "%s" : %s',
+ $_FILES['image_upload']['name'][$idx],
+ $error_message
);
}
}
@@ -172,7 +160,7 @@ if (isset($_GET['processed']))
{
foreach ($_SESSION['uploads_error'][ $_POST['upload_id'] ] as $error)
{
- array_push($page['errors'], $error);
+ $page['errors'][] = $error;
}
}
@@ -216,29 +204,18 @@ SELECT
$thumbnail['link'] = get_root_url().'admin.php?page=photo-'.$image_id.'&amp;cat_id='.$category_id;
- array_push($page['thumbnails'], $thumbnail);
+ $page['thumbnails'][] = $thumbnail;
}
if (!empty($page['thumbnails']))
{
- array_push(
- $page['infos'],
- sprintf(
- l10n('%d photos uploaded'),
- count($page['thumbnails'])
- )
- );
+ $page['infos'][] = l10n('%d photos uploaded', count($page['thumbnails']));
if (0 != $_POST['level'])
{
- array_push(
- $page['infos'],
- sprintf(
- l10n('Privacy level set to "%s"'),
- l10n(
- sprintf('Level %d', $_POST['level'])
- )
- )
+ $page['infos'][] = l10n(
+ 'Privacy level set to "%s"',
+ l10n(sprintf('Level %d', $_POST['level']))
);
}
@@ -252,13 +229,10 @@ SELECT
$category_name = get_cat_display_name_from_id($category_id, 'admin.php?page=album-');
// information
- array_push(
- $page['infos'],
- sprintf(
- l10n('Album "%s" now contains %d photos'),
- '<em>'.$category_name.'</em>',
- $count
- )
+ $page['infos'][] = l10n(
+ 'Album "%s" now contains %d photos',
+ '<em>'.$category_name.'</em>',
+ $count
);
$page['batch_link'] = PHOTOS_ADD_BASE_URL.'&batch='.implode(',', $image_ids);
diff --git a/admin/include/plugins.class.php b/admin/include/plugins.class.php
index ca4aa161c..45de49a01 100644
--- a/admin/include/plugins.class.php
+++ b/admin/include/plugins.class.php
@@ -399,7 +399,7 @@ DELETE FROM ' . PLUGINS_TABLE . ' WHERE id=\'' . $plugin_id . '\'';
{
$server_plugins[$plugin['extension_id']] = array();
}
- array_push($server_plugins[$plugin['extension_id']], $plugin['revision_name']);
+ $server_plugins[$plugin['extension_id']][] = $plugin['revision_name'];
}
foreach ($this->fs_plugins as $plugin_id => $fs_plugin)
@@ -503,7 +503,7 @@ DELETE FROM ' . PLUGINS_TABLE . ' WHERE id=\'' . $plugin_id . '\'';
and $old_files = file($extract_path.'/obsolete.list', FILE_IGNORE_NEW_LINES)
and !empty($old_files))
{
- array_push($old_files, 'obsolete.list');
+ $old_files[] = 'obsolete.list';
foreach($old_files as $old_file)
{
$path = $extract_path.'/'.$old_file;
diff --git a/admin/include/themes.class.php b/admin/include/themes.class.php
index dbc0d1c92..52e465446 100644
--- a/admin/include/themes.class.php
+++ b/admin/include/themes.class.php
@@ -77,12 +77,9 @@ class themes
$missing_parent = $this->missing_parent_theme($theme_id);
if (isset($missing_parent))
{
- array_push(
- $errors,
- sprintf(
- l10n('Impossible to activate this theme, the parent theme is missing: %s'),
- $missing_parent
- )
+ $errors[] = l10n(
+ 'Impossible to activate this theme, the parent theme is missing: %s',
+ $missing_parent
);
break;
@@ -93,7 +90,7 @@ class themes
and !empty($conf['mobile_theme'])
and $conf['mobile_theme'] != $theme_id)
{
- array_push($errors, l10n('You can activate only one mobile theme.'));
+ $errors[] = l10n('You can activate only one mobile theme.');
break;
}
@@ -134,10 +131,7 @@ INSERT INTO '.THEMES_TABLE.'
// you can't deactivate the last theme
if (count($this->db_themes_by_id) <= 1)
{
- array_push(
- $errors,
- l10n('Impossible to deactivate this theme, you need at least one theme.')
- );
+ $errors[] = l10n('Impossible to deactivate this theme, you need at least one theme.');
break;
}
@@ -190,7 +184,7 @@ DELETE
case 'delete':
if (!empty($crt_db_theme))
{
- array_push($errors, 'CANNOT DELETE - THEME IS INSTALLED');
+ $errors[] = 'CANNOT DELETE - THEME IS INSTALLED';
break;
}
if (!isset($this->fs_themes[$theme_id]))
@@ -202,12 +196,9 @@ DELETE
$children = $this->get_children_themes($theme_id);
if (count($children) > 0)
{
- array_push(
- $errors,
- sprintf(
- l10n('Impossible to delete this theme. Other themes depends on it: %s'),
- implode(', ', $children)
- )
+ $errors[] = l10n(
+ 'Impossible to delete this theme. Other themes depends on it: %s',
+ implode(', ', $children)
);
break;
}
@@ -262,7 +253,7 @@ DELETE
{
if (isset($test_child['parent']) and $test_child['parent'] == $theme_id)
{
- array_push($children, $test_child['name']);
+ $children[] = $test_child['name'];
}
}
@@ -322,7 +313,7 @@ SELECT
$themes = array();
while ($row = pwg_db_fetch_assoc($result))
{
- array_push($themes, $row);
+ $themes[] = $row;
}
return $themes;
}
@@ -628,7 +619,7 @@ SELECT
and $old_files = file($extract_path.'/obsolete.list', FILE_IGNORE_NEW_LINES)
and !empty($old_files))
{
- array_push($old_files, 'obsolete.list');
+ $old_files[] = 'obsolete.list';
foreach($old_files as $old_file)
{
$path = $extract_path.'/'.$old_file;
diff --git a/admin/include/updates.class.php b/admin/include/updates.class.php
index d25a75af7..5a1f48c70 100644
--- a/admin/include/updates.class.php
+++ b/admin/include/updates.class.php
@@ -161,7 +161,7 @@ class updates
{
if (in_array($ext_id, $conf['updates_ignored'][$type]))
{
- array_push($ignore_list, $ext_id);
+ $ignore_list[] = $ext_id;
}
else
{
@@ -248,7 +248,7 @@ class updates
and $old_files = file(PHPWG_ROOT_PATH.$file, FILE_IGNORE_NEW_LINES)
and !empty($old_files))
{
- array_push($old_files, $file);
+ $old_files[] = $file;
foreach($old_files as $old_file)
{
$path = PHPWG_ROOT_PATH.$old_file;
@@ -314,7 +314,7 @@ class updates
}
else
{
- array_push($page['errors'], l10n('Unable to dump database.'));
+ $page['errors'][] = l10n('Unable to dump database.');
}
}
@@ -414,7 +414,8 @@ class updates
unset($_SESSION['need_update']);
if ($step == 2)
{
- array_push($page['infos'], l10n('Update Complete'), $upgrade_to);
+ $page['infos'][] = l10n('Update Complete');
+ $page['infos'][] = $upgrade_to;
$step = -1;
}
else
@@ -425,24 +426,22 @@ class updates
else
{
file_put_contents(PHPWG_ROOT_PATH.$conf['data_location'].'update/log_error.txt', $error);
- array_push(
- $page['errors'],
- sprintf(
- l10n('An error has occured during extract. Please check files permissions of your piwigo installation.<br><a href="%s">Click here to show log error</a>.'),
- get_root_url().$conf['data_location'].'update/log_error.txt'
- )
- );
+
+ $page['errors'][] = l10n(
+ 'An error has occured during extract. Please check files permissions of your piwigo installation.<br><a href="%s">Click here to show log error</a>.',
+ get_root_url().$conf['data_location'].'update/log_error.txt'
+ );
}
}
else
{
deltree(PHPWG_ROOT_PATH.$conf['data_location'].'update');
- array_push($page['errors'], l10n('An error has occured during upgrade.'));
+ $page['errors'][] = l10n('An error has occured during upgrade.');
}
}
else
{
- array_push($page['errors'], l10n('Piwigo cannot retrieve upgrade file from server'));
+ $page['errors'][] = l10n('Piwigo cannot retrieve upgrade file from server');
}
}
}
diff --git a/admin/include/uploadify/uploadify.php b/admin/include/uploadify/uploadify.php
index 1e36f3268..9bd8f9eb5 100644
--- a/admin/include/uploadify/uploadify.php
+++ b/admin/include/uploadify/uploadify.php
@@ -47,20 +47,7 @@ $image_id = add_uploaded_file(
$_POST['level']
);
-if (!isset($_SESSION['uploads']))
-{
- $_SESSION['uploads'] = array();
-}
-
-if (!isset($_SESSION['uploads'][ $_POST['upload_id'] ]))
-{
- $_SESSION['uploads'][ $_POST['upload_id'] ] = array();
-}
-
-array_push(
- $_SESSION['uploads'][ $_POST['upload_id'] ],
- $image_id
- );
+$_SESSION['uploads'][ $_POST['upload_id'] ][] = $image_id;
$query = '
SELECT