// gallery object just to increment/decrement one value in the table.
// TODO: Change this - should always use the appropriate object, not
// direct manipulation of the share table...
- $sql = 'UPDATE ' . $this->_shareOb->_table
+ $sql = 'UPDATE ' . $this->_shareOb->getTable()
. ' SET attribute_images = attribute_images '
. ($add ? ' + ' : ' - ') . $images . ' WHERE share_id = '
. ($gallery_id ? $gallery_id : $this->id);
$GLOBALS['cache']->expire('Ansel_Gallery' . $id);
}
- return $this->_shareOb->_write_db->exec($sql);
+ return $this->_shareOb->getWriteDb()->exec($sql);
}
/**
throw new Horde_Exception(sprintf(_("Access denied copying photos to \"%s\"."), $gallery->get('name')));
}
- $db = $this->_shareOb->_write_db;
+ $db = $this->_shareOb->getWriteDb();
$imgCnt = 0;
foreach ($images as $imageId) {
$img = &$this->getImage($imageId);
// go through Ansel_Tags::writeTags() - this saves us a SELECT query
// for each tag - just write the data into the DB ourselves.
$tags = $img->getTags();
- $query = $this->_shareOb->_write_db->prepare('INSERT INTO ansel_images_tags (image_id, tag_id) VALUES(' . $newId . ',?);');
+ $query = $this->_shareOb->getWriteDb()->prepare('INSERT INTO ansel_images_tags (image_id, tag_id) VALUES(' . $newId . ',?);');
if (is_a($query, 'PEAR_Error')) {
throw new Horde_Exception($query->getMessage());
}
*/
public function setImageOrder($imageId, $pos)
{
- return $this->_shareOb->_write_db->exec('UPDATE ansel_images SET image_sort = ' . (int)$pos . ' WHERE image_id = ' . (int)$imageId);
+ return $this->_shareOb->getWriteDb()->exec('UPDATE ansel_images SET image_sort = ' . (int)$pos . ' WHERE image_id = ' . (int)$imageId);
}
/**
/* Update the backend, but only this current change */
if ($update) {
- $db = $this->_shareOb->_write_db;
+ $db = $this->_shareOb->getWriteDb();
// Manually convert the charset since we're not going through save()
+ // @TODO: Look at this usage - maybe each app's share object should
+ // have this method or just keep it public?
$data = $this->_shareOb->_toDriverCharset(array($driver_key => $value));
- $query = $db->prepare('UPDATE ' . $this->_shareOb->_table . ' SET ' . $driver_key . ' = ? WHERE share_id = ?', null, MDB2_PREPARE_MANIP);
+ $query = $db->prepare('UPDATE ' . $this->_shareOb->getTable() . ' SET ' . $driver_key . ' = ? WHERE share_id = ?', null, MDB2_PREPARE_MANIP);
if ($GLOBALS['conf']['ansel_cache']['usecache']) {
$GLOBALS['cache']->expire('Ansel_Gallery' . $this->id);
}
}
/* Bulk update the images to their new gallery_id */
- $result = $this->_gallery->_shareOb->getWriteDb()->exec('UPDATE ansel_images SET gallery_id = ' . $gallery->id . ' WHERE image_id IN (' . implode(',', $ids) . ')');
+ $result = $this->_gallery->getShareOb()->getWriteDb()->exec('UPDATE ansel_images SET gallery_id = ' . $gallery->id . ' WHERE image_id IN (' . implode(',', $ids) . ')');
if (is_a($result, 'PEAR_Error')) {
return $result;
}
} catch (VFS_Exception $e) {}
/* Delete from SQL. */
- $this->_gallery->_shareOb->getWriteDb()->exec('DELETE FROM ansel_images WHERE image_id = ' . (int)$image->id);
+ $this->_gallery->getShareOb()->getWriteDb()->exec('DELETE FROM ansel_images WHERE image_id = ' . (int)$image->id);
/* Remove any attributes */
- $this->_gallery->_shareOb->getWriteDb()->exec('DELETE FROM ansel_image_attributes WHERE image_id = ' . (int)$image->id);
+ $this->_gallery->getShareOb()->getWriteDb()->exec('DELETE FROM ansel_image_attributes WHERE image_id = ' . (int)$image->id);
if (!$isStack) {
$this->_gallery->updateImageCount(1, false, $image_gallery);
*/
function countChildren($perm = Horde_Perms::SHOW, $allLevels = true)
{
- return $this->_gallery->_shareOb->countShares(Horde_Auth::getAuth(), $perm, null, $this, $allLevels);
+ return $this->_gallery->getShareOb()->countShares(Horde_Auth::getAuth(), $perm, null, $this, $allLevels);
}
/**
*/
function getParent()
{
- return $this->_gallery->_shareOb->getParent($this);
+ return $this->_gallery->getShareOb()->getParent($this);
}
/**
}
}
- $result = $this->_gallery->_shareOb->getWriteDb()->exec('UPDATE ansel_images SET gallery_id = ' . $gallery->id . ' WHERE image_id IN (' . implode(',', $ids) . ')');
+ $result = $this->_gallery->getShareOb()->getWriteDb()->exec('UPDATE ansel_images SET gallery_id = ' . $gallery->id . ' WHERE image_id IN (' . implode(',', $ids) . ')');
if ($result instanceof PEAR_Error) {
throw new Ansel_Exception($result->getMessage());
}
} catch (VFS_Exception $e) {}
/* Delete from SQL. */
- $this->_gallery->_shareOb->getWriteDb()->exec('DELETE FROM ansel_images WHERE image_id = ' . (int)$image->id);
+ $this->_gallery->getShareOb()->getWriteDb()->exec('DELETE FROM ansel_images WHERE image_id = ' . (int)$image->id);
/* Remove any attributes */
- $this->_gallery->_shareOb->getWriteDb()->exec('DELETE FROM ansel_image_attributes WHERE image_id = ' . (int)$image->id);
+ $this->_gallery->getShareOb()->getWriteDb()->exec('DELETE FROM ansel_image_attributes WHERE image_id = ' . (int)$image->id);
if (!$isStack) {
$this->_gallery->updateImageCount(1, false);
}
$query = 'DELETE FROM ' . $this->_params['friends']
- . ' WHERE user_uid = ' . $share->_shareOb->_write_db->quote($this->_user)
- . ' AND group_id = ' . $share->_shareOb->_write_db->quote($share->getId());
+ . ' WHERE user_uid = ' . $share->getShareOb()->getWriteDb()->quote($this->_user)
+ . ' AND group_id = ' . $share->getShareOb()->getWriteDb()->quote($share->getId());
- $result = $share->_shareOb->_write_db->exec($query);
+ $result = $share->getShareOb()->getWriteDb()->exec($query);
if ($result instanceof PEAR_Error) {
return $result;
}