Skip to content

Commit

Permalink
- correct php warnings (section_init and mass_inserts)
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
rvelices committed Feb 8, 2007
1 parent 5631a3f commit b6fc0fa
Show file tree
Hide file tree
Showing 7 changed files with 158 additions and 177 deletions.
47 changes: 17 additions & 30 deletions admin/include/functions.php
Expand Up @@ -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);
}
}

Expand Down
12 changes: 4 additions & 8 deletions include/functions_html.inc.php
Expand Up @@ -286,8 +286,7 @@ function get_cat_display_name($cat_informations,
}
elseif ($url == '')
{
$output.= '<a class=""';
$output.= ' href="'
$output.= '<a href="'
.make_index_url(
array(
'category'=>$id,
Expand All @@ -299,8 +298,7 @@ function get_cat_display_name($cat_informations,
}
else
{
$output.= '<a class=""';
$output.= ' href="'.PHPWG_ROOT_PATH.$url.$id.'">';
$output.= '<a href="'.PHPWG_ROOT_PATH.$url.$id.'">';
$output.= $name.'</a>';
}
}
Expand Down Expand Up @@ -368,8 +366,7 @@ function get_cat_display_name_cache($uppercats,
elseif ($url == '')
{
$output.= '
<a class=""
href="'
<a href="'
.make_index_url(
array(
'category'=>$category_id,
Expand All @@ -381,8 +378,7 @@ function get_cat_display_name_cache($uppercats,
else
{
$output.= '
<a class=""
href="'.PHPWG_ROOT_PATH.$url.$category_id.'">'.$name.'</a>';
<a href="'.PHPWG_ROOT_PATH.$url.$category_id.'">'.$name.'</a>';
}
}
if ($replace_space)
Expand Down

0 comments on commit b6fc0fa

Please sign in to comment.