aboutsummaryrefslogtreecommitdiffstats
path: root/admin
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--admin/include/functions.php47
-rw-r--r--admin/infos_images.php4
-rw-r--r--admin/picture_modify.php4
-rw-r--r--admin/remote_site.php52
-rw-r--r--admin/update.php53
5 files changed, 62 insertions, 98 deletions
diff --git a/admin/include/functions.php b/admin/include/functions.php
index 54ec9d8b2..63f59471b 100644
--- a/admin/include/functions.php
+++ b/admin/include/functions.php
@@ -784,4 +784,51 @@ function my_error($header, $echo = true)
return $error;
}
}
+
+/**
+ * inserts multiple lines in a table
+ *
+ * @param string table_name
+ * @param array dbields
+ * @param array inserts
+ * @return void
+ */
+function mass_inserts($table_name, $dbfields, $inserts)
+{
+ // inserts all found categories
+ $query = '
+INSERT INTO '.$table_name.'
+ ('.implode(',', $dbfields).')
+ VALUES';
+ foreach ($inserts as $insert_id => $insert)
+ {
+ $query.= '
+ ';
+ if ($insert_id > 0)
+ {
+ $query.= ',';
+ }
+ $query.= '(';
+ foreach ($dbfields as $field_id => $dbfield)
+ {
+ if ($field_id > 0)
+ {
+ $query.= ',';
+ }
+
+ if (!isset($insert[$dbfield]) or $insert[$dbfield] == '')
+ {
+ $query.= 'NULL';
+ }
+ else
+ {
+ $query.= "'".$insert[$dbfield]."'";
+ }
+ }
+ $query.=')';
+ }
+ $query.= '
+;';
+ pwg_query($query);
+}
?>
diff --git a/admin/infos_images.php b/admin/infos_images.php
index 0f13b829e..9c055a830 100644
--- a/admin/infos_images.php
+++ b/admin/infos_images.php
@@ -319,9 +319,7 @@ SELECT *
$result = pwg_query($query);
while ($row = mysql_fetch_array($result))
{
- $thumbnail_url = get_thumbnail_src($row['file'],
- $row['storage_category_id'],
- @$row['tn_ext']);
+ $thumbnail_url = get_thumbnail_src($row['path'], @$row['tn_ext']);
$template->assign_block_vars(
'picture',
diff --git a/admin/picture_modify.php b/admin/picture_modify.php
index 90d99d5fa..476ddb359 100644
--- a/admin/picture_modify.php
+++ b/admin/picture_modify.php
@@ -199,9 +199,7 @@ else
$current_category = get_cat_info($row['storage_category_id']);
$dir_path = get_cat_display_name($current_category['name'], '->', '');
-$thumbnail_url = get_thumbnail_src($row['file'],
- $row['storage_category_id'],
- @$row['tn_ext']);
+$thumbnail_url = get_thumbnail_src($row['path'], @$row['tn_ext']);
$url_img = PHPWG_ROOT_PATH.'picture.php?image_id='.$_GET['image_id'];
$url_img .= '&cat='.$row['storage_category_id'];
diff --git a/admin/remote_site.php b/admin/remote_site.php
index 5aaf1a08f..082658ab0 100644
--- a/admin/remote_site.php
+++ b/admin/remote_site.php
@@ -112,53 +112,6 @@ SELECT id,dir
}
/**
- * inserts multiple lines in a table
- *
- * @param string table_name
- * @param array dbields
- * @param array inserts
- * @return void
- */
-function mass_inserts($table_name, $dbfields, $inserts)
-{
- // inserts all found categories
- $query = '
-INSERT INTO '.$table_name.'
- ('.implode(',', $dbfields).')
- VALUES';
- foreach ($inserts as $insert_id => $insert)
- {
- $query.= '
- ';
- if ($insert_id > 0)
- {
- $query.= ',';
- }
- $query.= '(';
- foreach ($dbfields as $field_id => $dbfield)
- {
- if ($field_id > 0)
- {
- $query.= ',';
- }
-
- if (!isset($insert[$dbfield]) or $insert[$dbfield] == '')
- {
- $query.= 'NULL';
- }
- else
- {
- $query.= "'".$insert[$dbfield]."'";
- }
- }
- $query.=')';
- }
- $query.= '
-;';
- pwg_query($query);
-}
-
-/**
* read $listing_file and update a remote site according to its id
*
* @param string listing_file
@@ -418,7 +371,8 @@ SELECT file
'author',
'keywords',
'name',
- 'comment');
+ 'comment',
+ 'path');
foreach ($optional_atts as $att)
{
if (getAttribute($xml_element, $att) != '')
@@ -434,7 +388,7 @@ SELECT file
{
$dbfields = array('file','storage_category_id','date_available','tn_ext',
'filesize','width','height','date_creation','author',
- 'keywords','name','comment');
+ 'keywords','name','comment','path');
mass_inserts(IMAGES_TABLE, $dbfields, $inserts);
$counts{'new_elements'}+= count($inserts);
diff --git a/admin/update.php b/admin/update.php
index fc920ebb6..817a67aae 100644
--- a/admin/update.php
+++ b/admin/update.php
@@ -31,7 +31,7 @@ if( !defined("PHPWG_ROOT_PATH") )
}
include_once( PHPWG_ROOT_PATH.'admin/include/isadmin.inc.php');
-define('CURRENT_DATE', "'".date('Y-m-d')."'");
+define('CURRENT_DATE', date('Y-m-d'));
// +-----------------------------------------------------------------------+
// | functions |
// +-----------------------------------------------------------------------+
@@ -407,10 +407,11 @@ SELECT file
if ($tn_ext != '')
{
$insert = array();
- $insert['file'] = "'".$unregistered_element."'";
+ $insert['file'] = $unregistered_element;
$insert['storage_category_id'] = $category_id;
$insert['date_available'] = CURRENT_DATE;
- $insert['tn_ext'] = "'".$tn_ext."'";
+ $insert['tn_ext'] = $tn_ext;
+ $insert['path'] = $dir.$unregistered_element;
$counts['new_elements']++;
array_push($inserts, $insert);
@@ -446,16 +447,17 @@ SELECT file
}
$insert = array();
- $insert['file'] = "'".$unregistered_element."'";
+ $insert['file'] = $unregistered_element;
+ $insert['path'] = $dir.$unregistered_element;
$insert['storage_category_id'] = $category_id;
$insert['date_available'] = CURRENT_DATE;
if ( $tn_ext != '' )
{
- $insert['tn_ext'] = "'".$tn_ext."'";
+ $insert['tn_ext'] = $tn_ext;
}
if ( $representative_ext != '' )
{
- $insert['representative_ext'] = "'".$representative_ext."'";
+ $insert['representative_ext'] = $representative_ext;
}
$counts['new_elements']++;
@@ -475,44 +477,9 @@ SELECT file
// inserts all found pictures
$dbfields = array(
'file','storage_category_id','date_available','tn_ext'
- ,'representative_ext'
+ ,'representative_ext','path'
);
- $query = '
-INSERT INTO '.IMAGES_TABLE.'
- ('.implode(',', $dbfields).')
- VALUES
- ';
- foreach ($inserts as $insert_id => $insert)
- {
- $query.= '
-';
- if ($insert_id > 0)
- {
- $query.= ',';
- }
- $query.= '(';
- foreach ($dbfields as $field_id => $dbfield)
- {
- if ($field_id > 0)
- {
- $query.= ',';
- }
-
- if (!isset($insert[$dbfield]) or $insert[$dbfield] == '')
- {
- $query.= 'NULL';
- }
- else
- {
- $query.= $insert[$dbfield];
- }
- }
- $query.=')';
- }
- $query.= '
-;';
-
- pwg_query($query);
+ mass_inserts(IMAGES_TABLE, $dbfields, $inserts);
// what are the ids of the pictures in the $category_id ?
$ids = array();