aboutsummaryrefslogtreecommitdiffstats
path: root/admin/include/functions.php
diff options
context:
space:
mode:
authorrvelices <rv-github@modusoptimus.com>2007-02-08 01:31:05 +0000
committerrvelices <rv-github@modusoptimus.com>2007-02-08 01:31:05 +0000
commitb6fc0fa5eb94301d5611b5385371aeda821da0fe (patch)
tree6571c02ac29d5e99ab747f48d97c62b5cde4ec46 /admin/include/functions.php
parent5631a3fc545bd736cb4b82a93fa7d2b48814973c (diff)
- correct php warnings (section_init and mass_inserts)
- flat category view url is now 'flat' instead of 'flat_cat' (it is nicer and shorter) - small html validation (double class attribute) - removed unnecessary class="" - changed 2 times hard coded index.php?recent_pics with make_index_url(...) git-svn-id: http://piwigo.org/svn/trunk@1789 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'admin/include/functions.php')
-rw-r--r--admin/include/functions.php47
1 files changed, 17 insertions, 30 deletions
diff --git a/admin/include/functions.php b/admin/include/functions.php
index 2e3b428f8..c3494d266 100644
--- a/admin/include/functions.php
+++ b/admin/include/functions.php
@@ -527,67 +527,54 @@ function mass_inserts($table_name, $dbfields, $datas)
{
// inserts all found categories
$query_begin = '
- INSERT INTO '.$table_name.'
- ('.implode(',', $dbfields).')
- VALUES';
+INSERT INTO '.$table_name.'
+ ('.implode(',', $dbfields).')
+ VALUES';
$first = true;
- $query_value = array();
- $query_value_index = 0;
+ $query_value = '';
foreach ($datas as $insert)
{
- $query_value[$query_value_index] .= '
- ';
if ($first)
{
$first = false;
- if (strlen($query_value[$query_value_index]) > 6)
- {
- $query_value[$query_value_index] .= ',';
- }
}
else
{
- if (strlen($query_value[$query_value_index]) >= $conf['max_allowed_packet'])
+ if (strlen($query_value) >= $conf['max_allowed_packet'])
{
- $query_value_index ++;
- $query_value[$query_value_index] .= '
- ';
- $first = true;
+ pwg_query( $query_begin.$query_value );
+ $query_value = '';
}
else
{
- $query_value[$query_value_index] .= ',';
+ $query_value .= ',';
}
}
- $query_value[$query_value_index] .= '(';
+
+ $query_value .= '
+ (';
+
foreach ($dbfields as $field_id => $dbfield)
{
if ($field_id > 0)
{
- $query_value[$query_value_index] .= ',';
+ $query_value .= ',';
}
if (!isset($insert[$dbfield]) or $insert[$dbfield] === '')
{
- $query_value[$query_value_index] .= 'NULL';
+ $query_value .= 'NULL';
}
else
{
- $query_value[$query_value_index] .= "'".$insert[$dbfield]."'";
+ $query_value .= "'".$insert[$dbfield]."'";
}
}
- $query_value[$query_value_index] .= ')';
- }
-
- $query_end .= '
-;';
- foreach ($query_value as $value)
- {
- $final_query = $query_begin.$value.$query_end;
- pwg_query($final_query);
+ $query_value .= ')';
}
+ pwg_query($query_begin.$query_value);
}
}