diff options
| author | Lester Caine <lester@lsces.co.uk> | 2006-02-19 19:55:14 +0000 |
|---|---|---|
| committer | Lester Caine <lester@lsces.co.uk> | 2006-02-19 19:55:14 +0000 |
| commit | 4d66b3f79725e5c9efe9605815ea5091679f5c79 (patch) | |
| tree | 1abd79bed24dff8d681f301b326730efd8a0b5c7 | |
| parent | 5bda6ec56941b93a3d4e6d215c929825fb801b0f (diff) | |
| download | fisheye-4d66b3f79725e5c9efe9605815ea5091679f5c79.tar.gz fisheye-4d66b3f79725e5c9efe9605815ea5091679f5c79.tar.bz2 fisheye-4d66b3f79725e5c9efe9605815ea5091679f5c79.zip | |
Fix reserved word field names
POSITION - SQL Reserved
| -rw-r--r-- | FisheyeBase.php | 6 | ||||
| -rw-r--r-- | FisheyeGallery.php | 16 | ||||
| -rw-r--r-- | admin/schema_inc.php | 2 | ||||
| -rw-r--r-- | templates/image_order.tpl | 2 |
4 files changed, 13 insertions, 13 deletions
diff --git a/FisheyeBase.php b/FisheyeBase.php index fbf8346..15f7666 100644 --- a/FisheyeBase.php +++ b/FisheyeBase.php @@ -1,6 +1,6 @@ <?php /** - * @version $Header: /cvsroot/bitweaver/_bit_fisheye/FisheyeBase.php,v 1.17 2006/02/01 18:41:04 squareing Exp $ + * @version $Header: /cvsroot/bitweaver/_bit_fisheye/FisheyeBase.php,v 1.18 2006/02/19 19:54:17 lsces Exp $ * @package fisheye */ @@ -57,8 +57,8 @@ class FisheyeBase extends LibertyAttachable function updatePosition($pGalleryContentId, $newPosition = NULL) { if( $pGalleryContentId && $newPosition && $this->verifyId($this->mContentId) ) { // SQL optimization to prevent stupid updates of identical data - $sql = "UPDATE `".BIT_DB_PREFIX."fisheye_gallery_image_map` SET `position` = ? - WHERE `item_content_id` = ? AND `gallery_content_id` = ? AND (`position` IS NULL OR `position`!=?)"; + $sql = "UPDATE `".BIT_DB_PREFIX."fisheye_gallery_image_map` SET `item_position` = ? + WHERE `item_content_id` = ? AND `gallery_content_id` = ? AND (`item_position` IS NULL OR `item_position`!=?)"; $rs = $this->mDb->query($sql, array($newPosition, $this->mContentId, $pGalleryContentId, $newPosition)); } } diff --git a/FisheyeGallery.php b/FisheyeGallery.php index 65df3e9..8888550 100644 --- a/FisheyeGallery.php +++ b/FisheyeGallery.php @@ -1,6 +1,6 @@ <?php /** - * @version $Header: /cvsroot/bitweaver/_bit_fisheye/FisheyeGallery.php,v 1.20 2006/02/17 11:20:54 squareing Exp $ + * @version $Header: /cvsroot/bitweaver/_bit_fisheye/FisheyeGallery.php,v 1.21 2006/02/19 19:54:17 lsces Exp $ * @package fisheye */ @@ -110,7 +110,7 @@ class FisheyeGallery extends FisheyeBase { INNER JOIN `".BIT_DB_PREFIX."fisheye_image` fi ON ( fi.`content_id`=fgim.`item_content_id` ) INNER JOIN `".BIT_DB_PREFIX."liberty_files` lf ON ( lf.`file_id`=fi.`image_id` ) WHERE fgim.`gallery_content_id` = ? - ORDER BY fgim.`position`, fi.`content_id` "; + ORDER BY fgim.`item_position`, fi.`content_id` "; if( $rs = $this->mDb->query($query, array( $this->mContentId ) ) ) { $rows = $rs->getRows(); for( $i = 0; $i < count( $rows ); $i++ ) { @@ -169,7 +169,7 @@ class FisheyeGallery extends FisheyeBase { $query = "SELECT fgim.*, lc.`content_type_guid`, lc.`user_id`, ufm.`favorite_content_id` AS is_favorite $select FROM `".BIT_DB_PREFIX."fisheye_gallery_image_map` fgim INNER JOIN `".BIT_DB_PREFIX."liberty_content` lc ON ( lc.`content_id`=fgim.`item_content_id` ) $join LEFT OUTER JOIN `".BIT_DB_PREFIX."users_favorites_map` ufm ON ( ufm.`favorite_content_id`=lc.`content_id` AND lc.`user_id`=ufm.`user_id` ) WHERE fgim.`gallery_content_id` = ? $where - ORDER BY fgim.`position`, fgim.`item_content_id` $mid"; + ORDER BY fgim.`item_position`, fgim.`item_content_id` $mid"; $rs = $this->mDb->query($query, $bindVars, $pMaxRows, $pOffset); $rows = $rs->getRows(); @@ -181,7 +181,7 @@ class FisheyeGallery extends FisheyeBase { if( $pass && $item = $gLibertySystem->getLibertyObject( $row['item_content_id'], $row['content_type_guid'] ) ) { $item->loadThumbnail( $this->mInfo['thumbnail_size'] ); $item->setGalleryPath( $this->mGalleryPath.'/'.$this->mGalleryId ); - $item->mInfo['position'] = $row['position']; + $item->mInfo['item_position'] = $row['item_position']; $this->mItems[$row['item_content_id']] = $item; } } @@ -207,9 +207,9 @@ class FisheyeGallery extends FisheyeBase { $ret = 0; if ($this->mGalleryId) { - $query = "SELECT COUNT(*) AS `count` - FROM `".BIT_DB_PREFIX."fisheye_gallery_image_map` - WHERE `gallery_content_id` = ?"; + $query = 'SELECT COUNT(*) AS "count"` + FROM `'.BIT_DB_PREFIX.'fisheye_gallery_image_map` + WHERE `gallery_content_id` = ?'; $rs = $this->mDb->query($query, array($this->mContentId)); $ret = $rs->fields['count']; } @@ -380,7 +380,7 @@ class FisheyeGallery extends FisheyeBase { function addItem( $pContentId, $pPosition=NULL ) { $ret = FALSE; if( $this->isValid() && @$this->verifyId( $pContentId ) && ( $this->mContentId != $pContentId ) && !$this->isInGallery( $this->mContentId, $pContentId ) && !$this->isInGallery( $pContentId, $this->mContentId ) ) { - $query = "INSERT INTO `".BIT_DB_PREFIX."fisheye_gallery_image_map` (`item_content_id`, `gallery_content_id`, `position`) VALUES (?,?,?)"; + $query = "INSERT INTO `".BIT_DB_PREFIX."fisheye_gallery_image_map` (`item_content_id`, `gallery_content_id`, `item_position`) VALUES (?,?,?)"; $rs = $this->mDb->query($query, array($pContentId, $this->mContentId, $pPosition ) ); $ret = TRUE; } diff --git a/admin/schema_inc.php b/admin/schema_inc.php index 1a06318..c037a12 100644 --- a/admin/schema_inc.php +++ b/admin/schema_inc.php @@ -14,7 +14,7 @@ $tables = array( 'fisheye_gallery_image_map' => " gallery_content_id I4 NOTNULL, item_content_id I4 NOTNULL, - position I4 + item_position I4 ", 'fisheye_image' => " diff --git a/templates/image_order.tpl b/templates/image_order.tpl index 67f13f7..b7e277c 100644 --- a/templates/image_order.tpl +++ b/templates/image_order.tpl @@ -56,7 +56,7 @@ <label>{tr}Gallery Image{/tr}: <input type="radio" name="gallery_preview_content_id" value="{$galItem->mContentId}" {if $gContent->getField('preview_content_id') == $galItem->mContentId}checked="checked"{/if}/></label><br /> <label>{if $galItem->getField('is_favorite')}{biticon iname="favorite" ipackage="users" iexplain=""}{/if}{tr}Favorite Image{/tr}: <input type="checkbox" name="is_favorite[]" value="{$galItem->mContentId}" {if $galItem->getField('is_favorite')}checked="checked"{/if}/></label><br /> <label>{tr}Batch Select{/tr}: <input type="checkbox" name="batch[]" value="{$galItem->mContentId}" /></label><br /> - <label>{tr}Position{/tr}</label>: <input type="text" size="5" style="text-align:right;" maxlength="15" name="imagePosition[{$galItem->mContentId}]" id="imagePosition-{$galItem->mContentId}" value="{$galItem->mInfo.position}"/> + <label>{tr}Position{/tr}</label>: <input type="text" size="5" style="text-align:right;" maxlength="15" name="imagePosition[{$galItem->mContentId}]" id="imagePosition-{$galItem->mContentId}" value="{$galItem->mInfo.item_position}"/> </td> </tr> {/foreach} |
