diff options
author | nikrou <nikrou@piwigo.org> | 2010-03-19 19:39:15 +0000 |
---|---|---|
committer | nikrou <nikrou@piwigo.org> | 2010-03-19 19:39:15 +0000 |
commit | 4c461f36b167641fd7e0182d8c2a88f578c14e58 (patch) | |
tree | d44f2b7c8fff005db118f177b8f96a0b7f785246 | |
parent | 6b296b293d7ac666548ec74cecf827699f912ff7 (diff) |
Fix some sql issues :
- permalink that use if() syntax
- add tables themes for other database engines that mysql
git-svn-id: http://piwigo.org/svn/trunk@5192 68402e56-0260-453c-a942-63ccdbb3a9ee
-rw-r--r-- | admin/permalinks.php | 8 | ||||
-rw-r--r-- | include/dblayer/functions_mysql.inc.php | 4 | ||||
-rw-r--r-- | include/functions_category.inc.php | 4 | ||||
-rw-r--r-- | install/piwigo_structure-pdo-sqlite.sql | 13 | ||||
-rw-r--r-- | install/piwigo_structure-pgsql.sql | 15 | ||||
-rw-r--r-- | install/piwigo_structure-sqlite.sql | 13 |
6 files changed, 51 insertions, 6 deletions
diff --git a/admin/permalinks.php b/admin/permalinks.php index 342bf44d5..f12dbc7d0 100644 --- a/admin/permalinks.php +++ b/admin/permalinks.php @@ -98,8 +98,8 @@ elseif ( isset($_GET['delete_permanent']) and !is_adviser() ) DELETE FROM '.OLD_PERMALINKS_TABLE.' WHERE permalink="'.$_GET['delete_permanent'].'" LIMIT 1'; - pwg_query($query); - if (pwg_db_affected_rows()==0) + $result = pwg_query($query); + if (pwg_db_changes($result)==0) array_push($page['errors'], l10n('Cannot delete the old permalink !')); } @@ -108,8 +108,8 @@ $template->set_filename('permalinks', 'permalinks.tpl' ); $query = ' SELECT - id, - '.pwg_db_concat(array('id', '\' - \'', 'name', 'IF(permalink IS NULL, \'\', \' √\')')).' AS name, + id, permalink, + '.pwg_db_concat(array('id', '\' - \'', 'name')).' AS name, uppercats, global_rank FROM '.CATEGORIES_TABLE; diff --git a/include/dblayer/functions_mysql.inc.php b/include/dblayer/functions_mysql.inc.php index 8f757ac30..24b075f85 100644 --- a/include/dblayer/functions_mysql.inc.php +++ b/include/dblayer/functions_mysql.inc.php @@ -124,7 +124,7 @@ SELECT IF(MAX('.$column.')+1 IS NULL, 1, MAX('.$column.')+1) function pwg_db_changes($result) { - return mysql_affected_rows($result); + return mysql_affected_rows(); } function pwg_db_num_rows($result) @@ -461,7 +461,7 @@ function do_maintenance_all_tables() function pwg_db_concat($array) { $string = implode($array, ','); - return 'CONCAT(\''. $string.'\')'; + return 'CONCAT('. $string.')'; } function pwg_db_concat_ws($array, $separator) diff --git a/include/functions_category.inc.php b/include/functions_category.inc.php index 4ce30a75a..187ecbe8f 100644 --- a/include/functions_category.inc.php +++ b/include/functions_category.inc.php @@ -311,6 +311,10 @@ function display_select_categories($categories, $tpl_cats = array(); foreach ($categories as $category) { + if (!empty($category['permalink'])) + { + $category['name'] .= ' √'; + } if ($fullname) { $option = get_cat_display_name_cache($category['uppercats'], diff --git a/install/piwigo_structure-pdo-sqlite.sql b/install/piwigo_structure-pdo-sqlite.sql index 56022d66a..34d4fa0c4 100644 --- a/install/piwigo_structure-pdo-sqlite.sql +++ b/install/piwigo_structure-pdo-sqlite.sql @@ -341,6 +341,19 @@ CREATE TABLE piwigo_tags CREATE INDEX "tags_i1" ON "piwigo_tags" ("url_name"); ----------------------------------------------------------------------------- +-- piwigo_themes +----------------------------------------------------------------------------- + +DROP TABLE IF EXISTS "piwigo_themes" CASCADE; +CREATE TABLE "piwigo_themes" +( + "id" varchar(64) default '' NOT NULL, + "version" varchar(64) NOT NULL default '0', + "name" varchar(64) default NULL, + PRIMARY KEY ("id") +); + +----------------------------------------------------------------------------- -- piwigo_upgrade ----------------------------------------------------------------------------- diff --git a/install/piwigo_structure-pgsql.sql b/install/piwigo_structure-pgsql.sql index ae32d52d6..e3b830eb0 100644 --- a/install/piwigo_structure-pgsql.sql +++ b/install/piwigo_structure-pgsql.sql @@ -415,6 +415,21 @@ SET search_path TO public; CREATE INDEX "tags_i1" ON "piwigo_tags" ("url_name"); ----------------------------------------------------------------------------- +-- piwigo_themes +----------------------------------------------------------------------------- + +DROP TABLE IF EXISTS "piwigo_themes" CASCADE; +CREATE TABLE "piwigo_themes" +( + "id" varchar(64) default '' NOT NULL, + "version" varchar(64) NOT NULL default '0', + "name" varchar(64) default NULL, + PRIMARY KEY ("id") +); + +COMMENT ON TABLE "piwigo_themes" IS ''; + +----------------------------------------------------------------------------- -- piwigo_upgrade ----------------------------------------------------------------------------- diff --git a/install/piwigo_structure-sqlite.sql b/install/piwigo_structure-sqlite.sql index 56022d66a..34d4fa0c4 100644 --- a/install/piwigo_structure-sqlite.sql +++ b/install/piwigo_structure-sqlite.sql @@ -341,6 +341,19 @@ CREATE TABLE piwigo_tags CREATE INDEX "tags_i1" ON "piwigo_tags" ("url_name"); ----------------------------------------------------------------------------- +-- piwigo_themes +----------------------------------------------------------------------------- + +DROP TABLE IF EXISTS "piwigo_themes" CASCADE; +CREATE TABLE "piwigo_themes" +( + "id" varchar(64) default '' NOT NULL, + "version" varchar(64) NOT NULL default '0', + "name" varchar(64) default NULL, + PRIMARY KEY ("id") +); + +----------------------------------------------------------------------------- -- piwigo_upgrade ----------------------------------------------------------------------------- |