From b4d2a1362fa6dc15d8a1e849d5e36fe341953baf Mon Sep 17 00:00:00 2001 From: plegall Date: Tue, 4 Jan 2011 10:55:08 +0000 Subject: [PATCH] feature 2095 added: new column images.added_by (foreign key on users.id) git-svn-id: http://piwigo.org/svn/trunk@8464 68402e56-0260-453c-a942-63ccdbb3a9ee --- admin/include/functions_upload.inc.php | 3 +- admin/site_update.php | 1 + include/ws_functions.inc.php | 3 +- install/db/92-database.php | 57 +++++++++++++++++++++++++ install/piwigo_structure-mysql.sql | 1 + install/piwigo_structure-pdo-sqlite.sql | 1 + install/piwigo_structure-pgsql.sql | 1 + install/piwigo_structure-sqlite.sql | 1 + 8 files changed, 66 insertions(+), 2 deletions(-) create mode 100644 install/db/92-database.php diff --git a/admin/include/functions_upload.inc.php b/admin/include/functions_upload.inc.php index 84c00a90e..fe7b888bb 100644 --- a/admin/include/functions_upload.inc.php +++ b/admin/include/functions_upload.inc.php @@ -184,7 +184,7 @@ function add_uploaded_file($source_filepath, $original_filename=null, $categorie // TODO // * check md5sum (already exists?) - global $conf; + global $conf, $user; // current date list($dbnow) = pwg_db_fetch_row(pwg_query('SELECT NOW();')); @@ -306,6 +306,7 @@ function add_uploaded_file($source_filepath, $original_filename=null, $categorie 'width' => $file_infos['width'], 'height' => $file_infos['height'], 'md5sum' => $md5sum, + 'added_by' => $user['id'], ); if (isset($high_infos)) diff --git a/admin/site_update.php b/admin/site_update.php index 6c2e74c60..d0577070c 100644 --- a/admin/site_update.php +++ b/admin/site_update.php @@ -449,6 +449,7 @@ SELECT file,storage_category_id ? $fs[$path]['tn_ext'] : null, 'storage_category_id' => $db_fulldirs[$dirname], + 'added_by' => $user['id'], ); if ( $_POST['privacy_level']!=0 ) diff --git a/include/ws_functions.inc.php b/include/ws_functions.inc.php index ab4c342cc..56194f32a 100644 --- a/include/ws_functions.inc.php +++ b/include/ws_functions.inc.php @@ -1209,7 +1209,7 @@ SELECT function ws_images_add($params, &$service) { - global $conf; + global $conf, $user; if (!is_admin()) { return new PwgError(401, 'Access denied'); @@ -1284,6 +1284,7 @@ SELECT 'width' => $file_infos['width'], 'height' => $file_infos['height'], 'md5sum' => $params['original_sum'], + 'added_by' => $user['id'], ); $info_columns = array( diff --git a/install/db/92-database.php b/install/db/92-database.php new file mode 100644 index 000000000..7ac5c52da --- /dev/null +++ b/install/db/92-database.php @@ -0,0 +1,57 @@ + \ No newline at end of file diff --git a/install/piwigo_structure-mysql.sql b/install/piwigo_structure-mysql.sql index 44124f072..a241ab1f4 100644 --- a/install/piwigo_structure-mysql.sql +++ b/install/piwigo_structure-mysql.sql @@ -195,6 +195,7 @@ CREATE TABLE `piwigo_images` ( `high_filesize` mediumint(9) unsigned default NULL, `level` tinyint unsigned NOT NULL default '0', `md5sum` char(32) default NULL, + `added_by` smallint(5) NOT NULL default '0', PRIMARY KEY (`id`), KEY `images_i2` (`date_available`), KEY `images_i3` (`average_rate`), diff --git a/install/piwigo_structure-pdo-sqlite.sql b/install/piwigo_structure-pdo-sqlite.sql index e4aa71ca3..0c38b4008 100644 --- a/install/piwigo_structure-pdo-sqlite.sql +++ b/install/piwigo_structure-pdo-sqlite.sql @@ -191,6 +191,7 @@ CREATE TABLE piwigo_images "high_filesize" INTEGER, "level" INTEGER default 0 NOT NULL, "md5sum" CHAR(32), + "added_by" INTEGER default 0 NOT NULL, PRIMARY KEY ("id") ); diff --git a/install/piwigo_structure-pgsql.sql b/install/piwigo_structure-pgsql.sql index f4679cc83..5f9d5a8cf 100644 --- a/install/piwigo_structure-pgsql.sql +++ b/install/piwigo_structure-pgsql.sql @@ -235,6 +235,7 @@ CREATE TABLE "piwigo_images" "high_filesize" INTEGER, "level" INTEGER default 0 NOT NULL, "md5sum" CHAR(32), + "added_by" INTEGER default 0 NOT NULL, PRIMARY KEY ("id") ); diff --git a/install/piwigo_structure-sqlite.sql b/install/piwigo_structure-sqlite.sql index e4aa71ca3..0c38b4008 100644 --- a/install/piwigo_structure-sqlite.sql +++ b/install/piwigo_structure-sqlite.sql @@ -191,6 +191,7 @@ CREATE TABLE piwigo_images "high_filesize" INTEGER, "level" INTEGER default 0 NOT NULL, "md5sum" CHAR(32), + "added_by" INTEGER default 0 NOT NULL, PRIMARY KEY ("id") );