ported oc_db
This commit is contained in:
parent
f85d076a4e
commit
97a8af7f25
|
@ -35,7 +35,7 @@ $params=array(
|
|||
OCP\USER::getUser()
|
||||
);
|
||||
|
||||
$query = OC_DB::prepare("
|
||||
$query = OCP\DB::prepare("
|
||||
SELECT id FROM *PREFIX*bookmarks
|
||||
WHERE url LIKE ?
|
||||
AND user_id = ?
|
||||
|
@ -43,7 +43,7 @@ $query = OC_DB::prepare("
|
|||
|
||||
$id = $query->execute($params)->fetchOne();
|
||||
|
||||
$query = OC_DB::prepare("
|
||||
$query = OCP\DB::prepare("
|
||||
DELETE FROM *PREFIX*bookmarks
|
||||
WHERE id = $id
|
||||
");
|
||||
|
@ -51,7 +51,7 @@ $query = OC_DB::prepare("
|
|||
$result = $query->execute();
|
||||
|
||||
|
||||
$query = OC_DB::prepare("
|
||||
$query = OCP\DB::prepare("
|
||||
DELETE FROM *PREFIX*bookmarks_tags
|
||||
WHERE bookmark_id = $id
|
||||
");
|
||||
|
|
|
@ -41,7 +41,7 @@ if( $CONFIG_DBTYPE == 'sqlite' or $CONFIG_DBTYPE == 'sqlite3' ){
|
|||
|
||||
$bookmark_id = (int)$_GET["id"];
|
||||
|
||||
$query = OC_DB::prepare("
|
||||
$query = OCP\DB::prepare("
|
||||
UPDATE *PREFIX*bookmarks
|
||||
SET url = ?, title =?, lastmodified = $_ut
|
||||
WHERE id = $bookmark_id
|
||||
|
@ -54,14 +54,14 @@ $params=array(
|
|||
$query->execute($params);
|
||||
|
||||
# Remove old tags and insert new ones.
|
||||
$query = OC_DB::prepare("
|
||||
$query = OCP\DB::prepare("
|
||||
DELETE FROM *PREFIX*bookmarks_tags
|
||||
WHERE bookmark_id = $bookmark_id
|
||||
");
|
||||
|
||||
$query->execute();
|
||||
|
||||
$query = OC_DB::prepare("
|
||||
$query = OCP\DB::prepare("
|
||||
INSERT INTO *PREFIX*bookmarks_tags
|
||||
(bookmark_id, tag)
|
||||
VALUES (?, ?)
|
||||
|
|
|
@ -30,7 +30,7 @@ $RUNTIME_NOSETUPFS=true;
|
|||
OCP\JSON::checkLoggedIn();
|
||||
OCP\JSON::checkAppEnabled('bookmarks');
|
||||
|
||||
$query = OC_DB::prepare("
|
||||
$query = OCP\DB::prepare("
|
||||
UPDATE *PREFIX*bookmarks
|
||||
SET clickcount = clickcount + 1
|
||||
WHERE user_id = ?
|
||||
|
|
|
@ -40,10 +40,10 @@ class OC_Migration_Provider_Bookmarks extends OC_Migration_Provider{
|
|||
$idmap = array();
|
||||
while( $row = $results->fetchRow() ){
|
||||
// Import each bookmark, saving its id into the map
|
||||
$query = OC_DB::prepare( "INSERT INTO *PREFIX*bookmarks(url, title, user_id, public, added, lastmodified) VALUES (?, ?, ?, ?, ?, ?)" );
|
||||
$query = OCP\DB::prepare( "INSERT INTO *PREFIX*bookmarks(url, title, user_id, public, added, lastmodified) VALUES (?, ?, ?, ?, ?, ?)" );
|
||||
$query->execute( array( $row['url'], $row['title'], $this->uid, $row['public'], $row['added'], $row['lastmodified'] ) );
|
||||
// Map the id
|
||||
$idmap[$row['id']] = OC_DB::insertid();
|
||||
$idmap[$row['id']] = OCP\DB::insertid();
|
||||
}
|
||||
// Now tags
|
||||
foreach($idmap as $oldid => $newid){
|
||||
|
@ -51,7 +51,7 @@ class OC_Migration_Provider_Bookmarks extends OC_Migration_Provider{
|
|||
$results = $query->execute( array( $oldid ) );
|
||||
while( $row = $results->fetchRow() ){
|
||||
// Import the tags for this bookmark, using the new bookmark id
|
||||
$query = OC_DB::prepare( "INSERT INTO *PREFIX*bookmarks_tags(bookmark_id, tag) VALUES (?, ?)" );
|
||||
$query = OCP\DB::prepare( "INSERT INTO *PREFIX*bookmarks_tags(bookmark_id, tag) VALUES (?, ?)" );
|
||||
$query->execute( array( $newid, $row['tag'] ) );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -82,7 +82,7 @@ function addBookmark($url, $title, $tags='') {
|
|||
}
|
||||
|
||||
//FIXME: Detect when user adds a known URL
|
||||
$query = OC_DB::prepare("
|
||||
$query = OCP\DB::prepare("
|
||||
INSERT INTO *PREFIX*bookmarks
|
||||
(url, title, user_id, public, added, lastmodified)
|
||||
VALUES (?, ?, ?, 0, $_ut, $_ut)
|
||||
|
@ -105,10 +105,10 @@ function addBookmark($url, $title, $tags='') {
|
|||
);
|
||||
$query->execute($params);
|
||||
|
||||
$b_id = OC_DB::insertid('*PREFIX*bookmarks');
|
||||
$b_id = OCP\DB::insertid('*PREFIX*bookmarks');
|
||||
|
||||
if($b_id !== false) {
|
||||
$query = OC_DB::prepare("
|
||||
$query = OCP\DB::prepare("
|
||||
INSERT INTO *PREFIX*bookmarks_tags
|
||||
(bookmark_id, tag)
|
||||
VALUES (?, ?)
|
||||
|
|
|
@ -70,7 +70,7 @@ class OC_Bookmarks_Bookmarks{
|
|||
}
|
||||
|
||||
if($CONFIG_DBTYPE == 'pgsql' ){
|
||||
$query = OC_DB::prepare('
|
||||
$query = OCP\DB::prepare('
|
||||
SELECT id, url, title, '.($filterTagOnly?'':'url || title ||').' array_to_string(array_agg(tag), \' \') as tags
|
||||
FROM *PREFIX*bookmarks
|
||||
LEFT JOIN *PREFIX*bookmarks_tags ON *PREFIX*bookmarks.id = *PREFIX*bookmarks_tags.bookmark_id
|
||||
|
@ -87,7 +87,7 @@ class OC_Bookmarks_Bookmarks{
|
|||
else
|
||||
$concatFunction = 'Concat(Concat( url, title), ';
|
||||
|
||||
$query = OC_DB::prepare('
|
||||
$query = OCP\DB::prepare('
|
||||
SELECT id, url, title, '
|
||||
.($filterTagOnly?'':$concatFunction).
|
||||
'CASE WHEN *PREFIX*bookmarks.id = *PREFIX*bookmarks_tags.bookmark_id
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
$installedVersion=OCP\Config::getAppValue('calendar', 'installed_version');
|
||||
if (version_compare($installedVersion, '0.2.1', '<')) {
|
||||
$stmt = OC_DB::prepare( 'SELECT id, calendarcolor FROM *PREFIX*calendar_calendars WHERE calendarcolor IS NOT NULL' );
|
||||
$stmt = OCP\DB::prepare( 'SELECT id, calendarcolor FROM *PREFIX*calendar_calendars WHERE calendarcolor IS NOT NULL' );
|
||||
$result = $stmt->execute();
|
||||
while( $row = $result->fetchRow()) {
|
||||
$id = $row['id'];
|
||||
|
@ -11,7 +11,7 @@ if (version_compare($installedVersion, '0.2.1', '<')) {
|
|||
continue;
|
||||
}
|
||||
$color = '#' .$color;
|
||||
$stmt = OC_DB::prepare( 'UPDATE *PREFIX*calendar_calendars SET calendarcolor=? WHERE id=?' );
|
||||
$stmt = OCP\DB::prepare( 'UPDATE *PREFIX*calendar_calendars SET calendarcolor=? WHERE id=?' );
|
||||
$r = $stmt->execute(array($color,$id));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ class OC_Calendar_Calendar{
|
|||
$active_where = ' AND active = ?';
|
||||
$values[] = $active;
|
||||
}
|
||||
$stmt = OC_DB::prepare( 'SELECT * FROM *PREFIX*calendar_calendars WHERE userid = ?' . $active_where );
|
||||
$stmt = OCP\DB::prepare( 'SELECT * FROM *PREFIX*calendar_calendars WHERE userid = ?' . $active_where );
|
||||
$result = $stmt->execute($values);
|
||||
|
||||
$calendars = array();
|
||||
|
@ -81,7 +81,7 @@ class OC_Calendar_Calendar{
|
|||
* @return associative array
|
||||
*/
|
||||
public static function find($id){
|
||||
$stmt = OC_DB::prepare( 'SELECT * FROM *PREFIX*calendar_calendars WHERE id = ?' );
|
||||
$stmt = OCP\DB::prepare( 'SELECT * FROM *PREFIX*calendar_calendars WHERE id = ?' );
|
||||
$result = $stmt->execute(array($id));
|
||||
|
||||
return $result->fetchRow();
|
||||
|
@ -106,10 +106,10 @@ class OC_Calendar_Calendar{
|
|||
|
||||
$uri = self::createURI($name, $uris );
|
||||
|
||||
$stmt = OC_DB::prepare( 'INSERT INTO *PREFIX*calendar_calendars (userid,displayname,uri,ctag,calendarorder,calendarcolor,timezone,components) VALUES(?,?,?,?,?,?,?,?)' );
|
||||
$stmt = OCP\DB::prepare( 'INSERT INTO *PREFIX*calendar_calendars (userid,displayname,uri,ctag,calendarorder,calendarcolor,timezone,components) VALUES(?,?,?,?,?,?,?,?)' );
|
||||
$result = $stmt->execute(array($userid,$name,$uri,1,$order,$color,$timezone,$components));
|
||||
|
||||
return OC_DB::insertid('*PREFIX*calendar_calendar');
|
||||
return OCP\DB::insertid('*PREFIX*calendar_calendar');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -126,10 +126,10 @@ class OC_Calendar_Calendar{
|
|||
public static function addCalendarFromDAVData($principaluri,$uri,$name,$components,$timezone,$order,$color){
|
||||
$userid = self::extractUserID($principaluri);
|
||||
|
||||
$stmt = OC_DB::prepare( 'INSERT INTO *PREFIX*calendar_calendars (userid,displayname,uri,ctag,calendarorder,calendarcolor,timezone,components) VALUES(?,?,?,?,?,?,?,?)' );
|
||||
$stmt = OCP\DB::prepare( 'INSERT INTO *PREFIX*calendar_calendars (userid,displayname,uri,ctag,calendarorder,calendarcolor,timezone,components) VALUES(?,?,?,?,?,?,?,?)' );
|
||||
$result = $stmt->execute(array($userid,$name,$uri,1,$order,$color,$timezone,$components));
|
||||
|
||||
return OC_DB::insertid('*PREFIX*calendar_calendars');
|
||||
return OCP\DB::insertid('*PREFIX*calendar_calendars');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -155,7 +155,7 @@ class OC_Calendar_Calendar{
|
|||
if(is_null($order)) $order = $calendar['calendarorder'];
|
||||
if(is_null($color)) $color = $calendar['calendarcolor'];
|
||||
|
||||
$stmt = OC_DB::prepare( 'UPDATE *PREFIX*calendar_calendars SET displayname=?,calendarorder=?,calendarcolor=?,timezone=?,components=?,ctag=ctag+1 WHERE id=?' );
|
||||
$stmt = OCP\DB::prepare( 'UPDATE *PREFIX*calendar_calendars SET displayname=?,calendarorder=?,calendarcolor=?,timezone=?,components=?,ctag=ctag+1 WHERE id=?' );
|
||||
$result = $stmt->execute(array($name,$order,$color,$timezone,$components,$id));
|
||||
|
||||
return true;
|
||||
|
@ -168,7 +168,7 @@ class OC_Calendar_Calendar{
|
|||
* @return boolean
|
||||
*/
|
||||
public static function setCalendarActive($id,$active){
|
||||
$stmt = OC_DB::prepare( 'UPDATE *PREFIX*calendar_calendars SET active = ? WHERE id = ?' );
|
||||
$stmt = OCP\DB::prepare( 'UPDATE *PREFIX*calendar_calendars SET active = ? WHERE id = ?' );
|
||||
$stmt->execute(array($active, $id));
|
||||
|
||||
return true;
|
||||
|
@ -180,7 +180,7 @@ class OC_Calendar_Calendar{
|
|||
* @return boolean
|
||||
*/
|
||||
public static function touchCalendar($id){
|
||||
$stmt = OC_DB::prepare( 'UPDATE *PREFIX*calendar_calendars SET ctag = ctag + 1 WHERE id = ?' );
|
||||
$stmt = OCP\DB::prepare( 'UPDATE *PREFIX*calendar_calendars SET ctag = ctag + 1 WHERE id = ?' );
|
||||
$stmt->execute(array($id));
|
||||
|
||||
return true;
|
||||
|
@ -192,10 +192,10 @@ class OC_Calendar_Calendar{
|
|||
* @return boolean
|
||||
*/
|
||||
public static function deleteCalendar($id){
|
||||
$stmt = OC_DB::prepare( 'DELETE FROM *PREFIX*calendar_calendars WHERE id = ?' );
|
||||
$stmt = OCP\DB::prepare( 'DELETE FROM *PREFIX*calendar_calendars WHERE id = ?' );
|
||||
$stmt->execute(array($id));
|
||||
|
||||
$stmt = OC_DB::prepare( 'DELETE FROM *PREFIX*calendar_objects WHERE calendarid = ?' );
|
||||
$stmt = OCP\DB::prepare( 'DELETE FROM *PREFIX*calendar_objects WHERE calendarid = ?' );
|
||||
$stmt->execute(array($id));
|
||||
|
||||
return true;
|
||||
|
|
|
@ -19,7 +19,7 @@ class OC_Calendar_Object{
|
|||
* ['calendardata']
|
||||
*/
|
||||
public static function all($id){
|
||||
$stmt = OC_DB::prepare( 'SELECT * FROM *PREFIX*calendar_objects WHERE calendarid = ?' );
|
||||
$stmt = OCP\DB::prepare( 'SELECT * FROM *PREFIX*calendar_objects WHERE calendarid = ?' );
|
||||
$result = $stmt->execute(array($id));
|
||||
|
||||
$calendarobjects = array();
|
||||
|
@ -41,7 +41,7 @@ class OC_Calendar_Object{
|
|||
* in ['calendardata']
|
||||
*/
|
||||
public static function allInPeriod($id, $start, $end){
|
||||
$stmt = OC_DB::prepare( 'SELECT * FROM *PREFIX*calendar_objects WHERE calendarid = ?'
|
||||
$stmt = OCP\DB::prepare( 'SELECT * FROM *PREFIX*calendar_objects WHERE calendarid = ?'
|
||||
.' AND ((startdate >= ? AND startdate <= ? AND repeating = 0)'
|
||||
.' OR (enddate >= ? AND enddate <= ? AND repeating = 0)'
|
||||
.' OR (startdate <= ? AND repeating = 1))' );
|
||||
|
@ -66,7 +66,7 @@ class OC_Calendar_Object{
|
|||
* @return associative array
|
||||
*/
|
||||
public static function find($id){
|
||||
$stmt = OC_DB::prepare( 'SELECT * FROM *PREFIX*calendar_objects WHERE id = ?' );
|
||||
$stmt = OCP\DB::prepare( 'SELECT * FROM *PREFIX*calendar_objects WHERE id = ?' );
|
||||
$result = $stmt->execute(array($id));
|
||||
|
||||
return $result->fetchRow();
|
||||
|
@ -79,7 +79,7 @@ class OC_Calendar_Object{
|
|||
* @return associative array
|
||||
*/
|
||||
public static function findWhereDAVDataIs($cid,$uri){
|
||||
$stmt = OC_DB::prepare( 'SELECT * FROM *PREFIX*calendar_objects WHERE calendarid = ? AND uri = ?' );
|
||||
$stmt = OCP\DB::prepare( 'SELECT * FROM *PREFIX*calendar_objects WHERE calendarid = ? AND uri = ?' );
|
||||
$result = $stmt->execute(array($cid,$uri));
|
||||
|
||||
return $result->fetchRow();
|
||||
|
@ -103,12 +103,12 @@ class OC_Calendar_Object{
|
|||
|
||||
$uri = 'owncloud-'.md5($data.rand().time()).'.ics';
|
||||
|
||||
$stmt = OC_DB::prepare( 'INSERT INTO *PREFIX*calendar_objects (calendarid,objecttype,startdate,enddate,repeating,summary,calendardata,uri,lastmodified) VALUES(?,?,?,?,?,?,?,?,?)' );
|
||||
$stmt = OCP\DB::prepare( 'INSERT INTO *PREFIX*calendar_objects (calendarid,objecttype,startdate,enddate,repeating,summary,calendardata,uri,lastmodified) VALUES(?,?,?,?,?,?,?,?,?)' );
|
||||
$stmt->execute(array($id,$type,$startdate,$enddate,$repeating,$summary,$data,$uri,time()));
|
||||
|
||||
OC_Calendar_Calendar::touchCalendar($id);
|
||||
|
||||
return OC_DB::insertid('*PREFIX*calendar_objects');
|
||||
return OCP\DB::insertid('*PREFIX*calendar_objects');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -122,12 +122,12 @@ class OC_Calendar_Object{
|
|||
$object = OC_VObject::parse($data);
|
||||
list($type,$startdate,$enddate,$summary,$repeating,$uid) = self::extractData($object);
|
||||
|
||||
$stmt = OC_DB::prepare( 'INSERT INTO *PREFIX*calendar_objects (calendarid,objecttype,startdate,enddate,repeating,summary,calendardata,uri,lastmodified) VALUES(?,?,?,?,?,?,?,?,?)' );
|
||||
$stmt = OCP\DB::prepare( 'INSERT INTO *PREFIX*calendar_objects (calendarid,objecttype,startdate,enddate,repeating,summary,calendardata,uri,lastmodified) VALUES(?,?,?,?,?,?,?,?,?)' );
|
||||
$stmt->execute(array($id,$type,$startdate,$enddate,$repeating,$summary,$data,$uri,time()));
|
||||
|
||||
OC_Calendar_Calendar::touchCalendar($id);
|
||||
|
||||
return OC_DB::insertid('*PREFIX*calendar_objects');
|
||||
return OCP\DB::insertid('*PREFIX*calendar_objects');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -143,7 +143,7 @@ class OC_Calendar_Object{
|
|||
OC_Calendar_App::loadCategoriesFromVCalendar($object);
|
||||
list($type,$startdate,$enddate,$summary,$repeating,$uid) = self::extractData($object);
|
||||
|
||||
$stmt = OC_DB::prepare( 'UPDATE *PREFIX*calendar_objects SET objecttype=?,startdate=?,enddate=?,repeating=?,summary=?,calendardata=?, lastmodified = ? WHERE id = ?' );
|
||||
$stmt = OCP\DB::prepare( 'UPDATE *PREFIX*calendar_objects SET objecttype=?,startdate=?,enddate=?,repeating=?,summary=?,calendardata=?, lastmodified = ? WHERE id = ?' );
|
||||
$stmt->execute(array($type,$startdate,$enddate,$repeating,$summary,$data,time(),$id));
|
||||
|
||||
OC_Calendar_Calendar::touchCalendar($oldobject['calendarid']);
|
||||
|
@ -164,7 +164,7 @@ class OC_Calendar_Object{
|
|||
$object = OC_VObject::parse($data);
|
||||
list($type,$startdate,$enddate,$summary,$repeating,$uid) = self::extractData($object);
|
||||
|
||||
$stmt = OC_DB::prepare( 'UPDATE *PREFIX*calendar_objects SET objecttype=?,startdate=?,enddate=?,repeating=?,summary=?,calendardata=?, lastmodified = ? WHERE id = ?' );
|
||||
$stmt = OCP\DB::prepare( 'UPDATE *PREFIX*calendar_objects SET objecttype=?,startdate=?,enddate=?,repeating=?,summary=?,calendardata=?, lastmodified = ? WHERE id = ?' );
|
||||
$stmt->execute(array($type,$startdate,$enddate,$repeating,$summary,$data,time(),$oldobject['id']));
|
||||
|
||||
OC_Calendar_Calendar::touchCalendar($oldobject['calendarid']);
|
||||
|
@ -179,7 +179,7 @@ class OC_Calendar_Object{
|
|||
*/
|
||||
public static function delete($id){
|
||||
$oldobject = self::find($id);
|
||||
$stmt = OC_DB::prepare( 'DELETE FROM *PREFIX*calendar_objects WHERE id = ?' );
|
||||
$stmt = OCP\DB::prepare( 'DELETE FROM *PREFIX*calendar_objects WHERE id = ?' );
|
||||
$stmt->execute(array($id));
|
||||
OC_Calendar_Calendar::touchCalendar($oldobject['calendarid']);
|
||||
|
||||
|
@ -193,7 +193,7 @@ class OC_Calendar_Object{
|
|||
* @return boolean
|
||||
*/
|
||||
public static function deleteFromDAVData($cid,$uri){
|
||||
$stmt = OC_DB::prepare( 'DELETE FROM *PREFIX*calendar_objects WHERE calendarid = ? AND uri=?' );
|
||||
$stmt = OCP\DB::prepare( 'DELETE FROM *PREFIX*calendar_objects WHERE calendarid = ? AND uri=?' );
|
||||
$stmt->execute(array($cid,$uri));
|
||||
OC_Calendar_Calendar::touchCalendar($cid);
|
||||
|
||||
|
@ -201,7 +201,7 @@ class OC_Calendar_Object{
|
|||
}
|
||||
|
||||
public static function moveToCalendar($id, $calendarid){
|
||||
$stmt = OC_DB::prepare( 'UPDATE *PREFIX*calendar_objects SET calendarid=? WHERE id = ?' );
|
||||
$stmt = OCP\DB::prepare( 'UPDATE *PREFIX*calendar_objects SET calendarid=? WHERE id = ?' );
|
||||
$stmt->execute(array($calendarid,$id));
|
||||
|
||||
OC_Calendar_Calendar::touchCalendar($id);
|
||||
|
|
|
@ -25,7 +25,7 @@ class OC_Calendar_Share{
|
|||
}else{
|
||||
$active_where = '';
|
||||
}
|
||||
$stmt = OC_DB::prepare('SELECT * FROM *PREFIX*calendar_share_' . $type . ' WHERE ((share = ? AND sharetype = "user") ' . $group_where . ') AND owner <> ? ' . $permission_where . ' ' . $active_where);
|
||||
$stmt = OCP\DB::prepare('SELECT * FROM *PREFIX*calendar_share_' . $type . ' WHERE ((share = ? AND sharetype = "user") ' . $group_where . ') AND owner <> ? ' . $permission_where . ' ' . $active_where);
|
||||
$result = $stmt->execute(array($userid, $userid));
|
||||
$return = array();
|
||||
while( $row = $result->fetchRow()){
|
||||
|
@ -40,7 +40,7 @@ class OC_Calendar_Share{
|
|||
* @return: (array) $users - information about users a calendar / event is shared with
|
||||
*/
|
||||
public static function allUsersSharedwith($id, $type){
|
||||
$stmt = OC_DB::prepare('SELECT * FROM *PREFIX*calendar_share_' . $type . ' WHERE ' . $type . 'id = ? ORDER BY share');
|
||||
$stmt = OCP\DB::prepare('SELECT * FROM *PREFIX*calendar_share_' . $type . ' WHERE ' . $type . 'id = ? ORDER BY share');
|
||||
$result = $stmt->execute(array($id));
|
||||
$users = array();
|
||||
while( $row = $result->fetchRow()){
|
||||
|
@ -72,7 +72,7 @@ class OC_Calendar_Share{
|
|||
if($sharetype == 'public'){
|
||||
$share = self::generate_token($id, $type);
|
||||
}
|
||||
$stmt = OC_DB::prepare('INSERT INTO *PREFIX*calendar_share_' . $type . ' (owner,share,sharetype,' . $type . 'id,permissions' . (($type == self::CALENDAR)?', active':'') . ') VALUES(?,?,?,?,0' . (($type == self::CALENDAR)?', 1':'') . ')' );
|
||||
$stmt = OCP\DB::prepare('INSERT INTO *PREFIX*calendar_share_' . $type . ' (owner,share,sharetype,' . $type . 'id,permissions' . (($type == self::CALENDAR)?', active':'') . ') VALUES(?,?,?,?,0' . (($type == self::CALENDAR)?', 1':'') . ')' );
|
||||
$result = $stmt->execute(array($owner,$share,$sharetype,$id));
|
||||
if($sharetype == 'public'){
|
||||
return $share;
|
||||
|
@ -90,7 +90,7 @@ class OC_Calendar_Share{
|
|||
* @return (bool)
|
||||
*/
|
||||
public static function unshare($owner, $share, $sharetype, $id, $type){
|
||||
$stmt = OC_DB::prepare('DELETE FROM *PREFIX*calendar_share_' . $type . ' WHERE owner = ? ' . (($sharetype != 'public')?'AND share = ?':'') . ' AND sharetype = ? AND ' . $type . 'id = ?');
|
||||
$stmt = OCP\DB::prepare('DELETE FROM *PREFIX*calendar_share_' . $type . ' WHERE owner = ? ' . (($sharetype != 'public')?'AND share = ?':'') . ' AND sharetype = ? AND ' . $type . 'id = ?');
|
||||
if($sharetype != 'public'){
|
||||
$stmt->execute(array($owner,$share,$sharetype,$id));
|
||||
}else{
|
||||
|
@ -111,7 +111,7 @@ class OC_Calendar_Share{
|
|||
if($sharetype == 'public' && $permission == 1){
|
||||
$permission = 0;
|
||||
}
|
||||
$stmt = OC_DB::prepare('UPDATE *PREFIX*calendar_share_' . $type . ' SET permissions = ? WHERE share = ? AND sharetype = ? AND ' . $type . 'id = ?');
|
||||
$stmt = OCP\DB::prepare('UPDATE *PREFIX*calendar_share_' . $type . ' SET permissions = ? WHERE share = ? AND sharetype = ? AND ' . $type . 'id = ?');
|
||||
$stmt->execute(array($permission, $share, $sharetype, $id));
|
||||
return true;
|
||||
}
|
||||
|
@ -148,7 +148,7 @@ class OC_Calendar_Share{
|
|||
* @return (bool)
|
||||
*/
|
||||
public static function is_already_shared($owner, $share, $sharetype, $id, $type){
|
||||
$stmt = OC_DB::prepare('SELECT * FROM *PREFIX*calendar_share_' . $type . ' WHERE owner = ? AND share = ? AND sharetype = ? AND ' . $type . 'id = ?');
|
||||
$stmt = OCP\DB::prepare('SELECT * FROM *PREFIX*calendar_share_' . $type . ' WHERE owner = ? AND share = ? AND sharetype = ? AND ' . $type . 'id = ?');
|
||||
$result = $stmt->execute(array($owner, $share, $sharetype, $id));
|
||||
if($result->numRows() > 0){
|
||||
return true;
|
||||
|
@ -191,7 +191,7 @@ class OC_Calendar_Share{
|
|||
public static function is_editing_allowed($share, $id, $type){
|
||||
$group_where = self::group_sql(OC_Group::getUserGroups($share));
|
||||
$permission_where = self::permission_sql('rw');
|
||||
$stmt = OC_DB::prepare('SELECT * FROM *PREFIX*calendar_share_' . $type . ' WHERE ((share = ? AND sharetype = "user") ' . $group_where . ') ' . $permission_where);
|
||||
$stmt = OCP\DB::prepare('SELECT * FROM *PREFIX*calendar_share_' . $type . ' WHERE ((share = ? AND sharetype = "user") ' . $group_where . ') ' . $permission_where);
|
||||
$result = $stmt->execute(array($share));
|
||||
if($result->numRows() == 1){
|
||||
return true;
|
||||
|
@ -211,7 +211,7 @@ class OC_Calendar_Share{
|
|||
*/
|
||||
public static function check_access($share, $id, $type){
|
||||
$group_where = self::group_sql(OC_Group::getUserGroups($share));
|
||||
$stmt = OC_DB::prepare('SELECT * FROM *PREFIX*calendar_share_' . $type . ' WHERE (' . $type . 'id = ? AND (share = ? AND sharetype = "user") ' . $group_where . ')');
|
||||
$stmt = OCP\DB::prepare('SELECT * FROM *PREFIX*calendar_share_' . $type . ' WHERE (' . $type . 'id = ? AND (share = ? AND sharetype = "user") ' . $group_where . ')');
|
||||
$result = $stmt->execute(array($id,$share));
|
||||
$rows = $result->numRows();
|
||||
if($rows > 0){
|
||||
|
@ -229,9 +229,9 @@ class OC_Calendar_Share{
|
|||
* @return: mixed - bool if false, array with type and id if true
|
||||
*/
|
||||
public static function getElementByToken($token){
|
||||
$stmt_calendar = OC_DB::prepare('SELECT * FROM *PREFIX*calendar_share_' . OC_Calendar_Share::CALENDAR . ' WHERE sharetype = "public" AND share = ?');
|
||||
$stmt_calendar = OCP\DB::prepare('SELECT * FROM *PREFIX*calendar_share_' . OC_Calendar_Share::CALENDAR . ' WHERE sharetype = "public" AND share = ?');
|
||||
$result_calendar = $stmt_calendar->execute(array($token));
|
||||
$stmt_event = OC_DB::prepare('SELECT * FROM *PREFIX*calendar_share_' . OC_Calendar_Share::EVENT . ' WHERE sharetype = "public" AND share = ?');
|
||||
$stmt_event = OCP\DB::prepare('SELECT * FROM *PREFIX*calendar_share_' . OC_Calendar_Share::EVENT . ' WHERE sharetype = "public" AND share = ?');
|
||||
$result_event = $stmt_event->execute(array($token));
|
||||
$return = array();
|
||||
if($result_calendar->numRows() == 0 && $result_event->numRows() == 0){
|
||||
|
@ -253,7 +253,7 @@ class OC_Calendar_Share{
|
|||
* @param (string) $
|
||||
*/
|
||||
public static function set_active($share, $id, $active){
|
||||
$stmt = OC_DB::prepare('UPDATE *PREFIX*calendar_share_calendar SET active = ? WHERE share = ? AND sharetype = "user" AND calendarid = ?');
|
||||
$stmt = OCP\DB::prepare('UPDATE *PREFIX*calendar_share_calendar SET active = ? WHERE share = ? AND sharetype = "user" AND calendarid = ?');
|
||||
$stmt->execute(array($active, $share, $id));
|
||||
}
|
||||
}
|
|
@ -40,10 +40,10 @@ class OC_Migration_Provider_Contacts extends OC_Migration_Provider{
|
|||
$idmap = array();
|
||||
while( $row = $results->fetchRow() ){
|
||||
// Import each bookmark, saving its id into the map
|
||||
$query = OC_DB::prepare( "INSERT INTO *PREFIX*contacts_addressbooks (`userid`, `displayname`, `uri`, `description`, `ctag`) VALUES (?, ?, ?, ?, ?)" );
|
||||
$query = OCP\DB::prepare( "INSERT INTO *PREFIX*contacts_addressbooks (`userid`, `displayname`, `uri`, `description`, `ctag`) VALUES (?, ?, ?, ?, ?)" );
|
||||
$query->execute( array( $this->uid, $row['displayname'], $row['uri'], $row['description'], $row['ctag'] ) );
|
||||
// Map the id
|
||||
$idmap[$row['id']] = OC_DB::insertid();
|
||||
$idmap[$row['id']] = OCP\DB::insertid();
|
||||
}
|
||||
// Now tags
|
||||
foreach($idmap as $oldid => $newid){
|
||||
|
@ -51,7 +51,7 @@ class OC_Migration_Provider_Contacts extends OC_Migration_Provider{
|
|||
$results = $query->execute( array( $oldid ) );
|
||||
while( $row = $results->fetchRow() ){
|
||||
// Import the tags for this bookmark, using the new bookmark id
|
||||
$query = OC_DB::prepare( "INSERT INTO *PREFIX*contacts_cards (`addressbookid`, `fullname`, `carddata`, `uri`, `lastmodified`) VALUES (?, ?, ?, ?, ?)" );
|
||||
$query = OCP\DB::prepare( "INSERT INTO *PREFIX*contacts_cards (`addressbookid`, `fullname`, `carddata`, `uri`, `lastmodified`) VALUES (?, ?, ?, ?, ?)" );
|
||||
$query->execute( array( $newid, $row['fullname'], $row['carddata'], $row['uri'], $row['lastmodified'] ) );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ class OC_Contacts_Addressbook{
|
|||
* @return array
|
||||
*/
|
||||
public static function all($uid){
|
||||
$stmt = OC_DB::prepare( 'SELECT * FROM *PREFIX*contacts_addressbooks WHERE userid = ? ORDER BY displayname' );
|
||||
$stmt = OCP\DB::prepare( 'SELECT * FROM *PREFIX*contacts_addressbooks WHERE userid = ? ORDER BY displayname' );
|
||||
$result = $stmt->execute(array($uid));
|
||||
|
||||
$addressbooks = array();
|
||||
|
@ -71,7 +71,7 @@ class OC_Contacts_Addressbook{
|
|||
* @return associative array
|
||||
*/
|
||||
public static function find($id){
|
||||
$stmt = OC_DB::prepare( 'SELECT * FROM *PREFIX*contacts_addressbooks WHERE id = ?' );
|
||||
$stmt = OCP\DB::prepare( 'SELECT * FROM *PREFIX*contacts_addressbooks WHERE id = ?' );
|
||||
$result = $stmt->execute(array($id));
|
||||
|
||||
return $result->fetchRow();
|
||||
|
@ -93,10 +93,10 @@ class OC_Contacts_Addressbook{
|
|||
|
||||
$uri = self::createURI($name, $uris );
|
||||
|
||||
$stmt = OC_DB::prepare( 'INSERT INTO *PREFIX*contacts_addressbooks (userid,displayname,uri,description,ctag) VALUES(?,?,?,?,?)' );
|
||||
$stmt = OCP\DB::prepare( 'INSERT INTO *PREFIX*contacts_addressbooks (userid,displayname,uri,description,ctag) VALUES(?,?,?,?,?)' );
|
||||
$result = $stmt->execute(array($userid,$name,$uri,$description,1));
|
||||
|
||||
return OC_DB::insertid('*PREFIX*contacts_addressbooks');
|
||||
return OCP\DB::insertid('*PREFIX*contacts_addressbooks');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -110,10 +110,10 @@ class OC_Contacts_Addressbook{
|
|||
public static function addFromDAVData($principaluri,$uri,$name,$description){
|
||||
$userid = self::extractUserID($principaluri);
|
||||
|
||||
$stmt = OC_DB::prepare( 'INSERT INTO *PREFIX*contacts_addressbooks (userid,displayname,uri,description,ctag) VALUES(?,?,?,?,?)' );
|
||||
$stmt = OCP\DB::prepare( 'INSERT INTO *PREFIX*contacts_addressbooks (userid,displayname,uri,description,ctag) VALUES(?,?,?,?,?)' );
|
||||
$result = $stmt->execute(array($userid,$name,$uri,$description,1));
|
||||
|
||||
return OC_DB::insertid('*PREFIX*contacts_addressbooks');
|
||||
return OCP\DB::insertid('*PREFIX*contacts_addressbooks');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -134,7 +134,7 @@ class OC_Contacts_Addressbook{
|
|||
$description = $addressbook['description'];
|
||||
}
|
||||
|
||||
$stmt = OC_DB::prepare( 'UPDATE *PREFIX*contacts_addressbooks SET displayname=?,description=?, ctag=ctag+1 WHERE id=?' );
|
||||
$stmt = OCP\DB::prepare( 'UPDATE *PREFIX*contacts_addressbooks SET displayname=?,description=?, ctag=ctag+1 WHERE id=?' );
|
||||
$result = $stmt->execute(array($name,$description,$id));
|
||||
|
||||
return true;
|
||||
|
@ -192,7 +192,7 @@ class OC_Contacts_Addressbook{
|
|||
$ids_sql = join(',', array_fill(0, count($active), '?'));
|
||||
$prep = 'SELECT * FROM *PREFIX*contacts_addressbooks WHERE id IN ('.$ids_sql.') ORDER BY displayname';
|
||||
try {
|
||||
$stmt = OC_DB::prepare( $prep );
|
||||
$stmt = OCP\DB::prepare( $prep );
|
||||
$result = $stmt->execute($active);
|
||||
} catch(Exception $e) {
|
||||
OCP\Util::writeLog('contacts','OC_Contacts_Addressbook:active:, exception: '.$e->getMessage(),OCP\Util::DEBUG);
|
||||
|
@ -258,7 +258,7 @@ class OC_Contacts_Addressbook{
|
|||
public static function delete($id){
|
||||
// FIXME: There's no error checking at all.
|
||||
self::setActive($id, false);
|
||||
$stmt = OC_DB::prepare( 'DELETE FROM *PREFIX*contacts_addressbooks WHERE id = ?' );
|
||||
$stmt = OCP\DB::prepare( 'DELETE FROM *PREFIX*contacts_addressbooks WHERE id = ?' );
|
||||
$stmt->execute(array($id));
|
||||
|
||||
$cards = OC_Contacts_VCard::all($id);
|
||||
|
@ -275,7 +275,7 @@ class OC_Contacts_Addressbook{
|
|||
* @return boolean
|
||||
*/
|
||||
public static function touch($id){
|
||||
$stmt = OC_DB::prepare( 'UPDATE *PREFIX*contacts_addressbooks SET ctag = ctag + 1 WHERE id = ?' );
|
||||
$stmt = OCP\DB::prepare( 'UPDATE *PREFIX*contacts_addressbooks SET ctag = ctag + 1 WHERE id = ?' );
|
||||
$stmt->execute(array($id));
|
||||
|
||||
return true;
|
||||
|
|
|
@ -53,7 +53,7 @@ class OC_Contacts_VCard{
|
|||
$id_sql = join(',', array_fill(0, count($id), '?'));
|
||||
$prep = 'SELECT * FROM *PREFIX*contacts_cards WHERE addressbookid IN ('.$id_sql.') ORDER BY fullname';
|
||||
try {
|
||||
$stmt = OC_DB::prepare( $prep );
|
||||
$stmt = OCP\DB::prepare( $prep );
|
||||
$result = $stmt->execute($id);
|
||||
} catch(Exception $e) {
|
||||
OCP\Util::writeLog('contacts','OC_Contacts_VCard:all:, exception: '.$e->getMessage(),OCP\Util::DEBUG);
|
||||
|
@ -62,7 +62,7 @@ class OC_Contacts_VCard{
|
|||
}
|
||||
} elseif($id) {
|
||||
try {
|
||||
$stmt = OC_DB::prepare( 'SELECT * FROM *PREFIX*contacts_cards WHERE addressbookid = ? ORDER BY fullname' );
|
||||
$stmt = OCP\DB::prepare( 'SELECT * FROM *PREFIX*contacts_cards WHERE addressbookid = ? ORDER BY fullname' );
|
||||
$result = $stmt->execute(array($id));
|
||||
} catch(Exception $e) {
|
||||
OCP\Util::writeLog('contacts','OC_Contacts_VCard:all:, exception: '.$e->getMessage(),OCP\Util::DEBUG);
|
||||
|
@ -85,7 +85,7 @@ class OC_Contacts_VCard{
|
|||
* @return associative array
|
||||
*/
|
||||
public static function find($id){
|
||||
$stmt = OC_DB::prepare( 'SELECT * FROM *PREFIX*contacts_cards WHERE id = ?' );
|
||||
$stmt = OCP\DB::prepare( 'SELECT * FROM *PREFIX*contacts_cards WHERE id = ?' );
|
||||
$result = $stmt->execute(array($id));
|
||||
|
||||
return $result->fetchRow();
|
||||
|
@ -98,7 +98,7 @@ class OC_Contacts_VCard{
|
|||
* @return associative array
|
||||
*/
|
||||
public static function findWhereDAVDataIs($aid,$uri){
|
||||
$stmt = OC_DB::prepare( 'SELECT * FROM *PREFIX*contacts_cards WHERE addressbookid = ? AND uri = ?' );
|
||||
$stmt = OCP\DB::prepare( 'SELECT * FROM *PREFIX*contacts_cards WHERE addressbookid = ? AND uri = ?' );
|
||||
$result = $stmt->execute(array($aid,$uri));
|
||||
|
||||
return $result->fetchRow();
|
||||
|
@ -147,7 +147,7 @@ class OC_Contacts_VCard{
|
|||
* @returns true if the UID has been changed.
|
||||
*/
|
||||
protected static function trueUID($aid, &$uid) {
|
||||
$stmt = OC_DB::prepare( 'SELECT * FROM *PREFIX*contacts_cards WHERE addressbookid = ? AND uri = ?' );
|
||||
$stmt = OCP\DB::prepare( 'SELECT * FROM *PREFIX*contacts_cards WHERE addressbookid = ? AND uri = ?' );
|
||||
$uri = $uid.'.vcf';
|
||||
$result = $stmt->execute(array($aid,$uri));
|
||||
if($result->numRows() > 0){
|
||||
|
@ -282,9 +282,9 @@ class OC_Contacts_VCard{
|
|||
}
|
||||
|
||||
$data = $card->serialize();
|
||||
$stmt = OC_DB::prepare( 'INSERT INTO *PREFIX*contacts_cards (addressbookid,fullname,carddata,uri,lastmodified) VALUES(?,?,?,?,?)' );
|
||||
$stmt = OCP\DB::prepare( 'INSERT INTO *PREFIX*contacts_cards (addressbookid,fullname,carddata,uri,lastmodified) VALUES(?,?,?,?,?)' );
|
||||
$result = $stmt->execute(array($aid,$fn,$data,$uri,time()));
|
||||
$newid = OC_DB::insertid('*PREFIX*contacts_cards');
|
||||
$newid = OCP\DB::insertid('*PREFIX*contacts_cards');
|
||||
|
||||
OC_Contacts_Addressbook::touch($aid);
|
||||
|
||||
|
@ -308,7 +308,7 @@ class OC_Contacts_VCard{
|
|||
* @param array $objects An array of [id, carddata].
|
||||
*/
|
||||
public static function updateDataByID($objects){
|
||||
$stmt = OC_DB::prepare( 'UPDATE *PREFIX*contacts_cards SET carddata = ?, lastmodified = ? WHERE id = ?' );
|
||||
$stmt = OCP\DB::prepare( 'UPDATE *PREFIX*contacts_cards SET carddata = ?, lastmodified = ? WHERE id = ?' );
|
||||
$now = new DateTime;
|
||||
foreach($objects as $object) {
|
||||
$vcard = OC_VObject::parse($object[1]);
|
||||
|
@ -350,7 +350,7 @@ class OC_Contacts_VCard{
|
|||
$card->setString('REV', $now->format(DateTime::W3C));
|
||||
|
||||
$data = $card->serialize();
|
||||
$stmt = OC_DB::prepare( 'UPDATE *PREFIX*contacts_cards SET fullname = ?,carddata = ?, lastmodified = ? WHERE id = ?' );
|
||||
$stmt = OCP\DB::prepare( 'UPDATE *PREFIX*contacts_cards SET fullname = ?,carddata = ?, lastmodified = ? WHERE id = ?' );
|
||||
$result = $stmt->execute(array($fn,$data,time(),$id));
|
||||
|
||||
OC_Contacts_Addressbook::touch($oldcard['addressbookid']);
|
||||
|
@ -378,7 +378,7 @@ class OC_Contacts_VCard{
|
|||
*/
|
||||
public static function delete($id){
|
||||
// FIXME: Add error checking.
|
||||
$stmt = OC_DB::prepare( 'DELETE FROM *PREFIX*contacts_cards WHERE id = ?' );
|
||||
$stmt = OCP\DB::prepare( 'DELETE FROM *PREFIX*contacts_cards WHERE id = ?' );
|
||||
$stmt->execute(array($id));
|
||||
|
||||
return true;
|
||||
|
@ -392,7 +392,7 @@ class OC_Contacts_VCard{
|
|||
*/
|
||||
public static function deleteFromDAVData($aid,$uri){
|
||||
// FIXME: Add error checking. Deleting a card gives an Kontact/Akonadi error.
|
||||
$stmt = OC_DB::prepare( 'DELETE FROM *PREFIX*contacts_cards WHERE addressbookid = ? AND uri=?' );
|
||||
$stmt = OCP\DB::prepare( 'DELETE FROM *PREFIX*contacts_cards WHERE addressbookid = ? AND uri=?' );
|
||||
$stmt->execute(array($aid,$uri));
|
||||
OC_Contacts_Addressbook::touch($aid);
|
||||
|
||||
|
@ -521,7 +521,7 @@ class OC_Contacts_VCard{
|
|||
$id_sql = join(',', array_fill(0, count($id), '?'));
|
||||
$prep = 'UPDATE *PREFIX*contacts_cards SET addressbookid = ? WHERE id IN ('.$id_sql.')';
|
||||
try {
|
||||
$stmt = OC_DB::prepare( $prep );
|
||||
$stmt = OCP\DB::prepare( $prep );
|
||||
//$aid = array($aid);
|
||||
$vals = array_merge((array)$aid, $id);
|
||||
$result = $stmt->execute($vals);
|
||||
|
@ -533,7 +533,7 @@ class OC_Contacts_VCard{
|
|||
}
|
||||
} else {
|
||||
try {
|
||||
$stmt = OC_DB::prepare( 'UPDATE *PREFIX*contacts_cards SET addressbookid = ? WHERE id = ?' );
|
||||
$stmt = OCP\DB::prepare( 'UPDATE *PREFIX*contacts_cards SET addressbookid = ? WHERE id = ?' );
|
||||
$result = $stmt->execute(array($aid, $id));
|
||||
} catch(Exception $e) {
|
||||
OCP\Util::writeLog('contacts','OC_Contacts_VCard::moveToAddressBook:, exception: '.$e->getMessage(),OCP\Util::DEBUG);
|
||||
|
|
|
@ -14,10 +14,10 @@ if(!$checkOnly){
|
|||
//create the file cache if necesary
|
||||
if($force or !OC_FileCache::inCache('')){
|
||||
if(!$checkOnly){
|
||||
OC_DB::beginTransaction();
|
||||
OCP\DB::beginTransaction();
|
||||
OC_FileCache::scan($dir,$eventSource);
|
||||
OC_FileCache::clean();
|
||||
OC_DB::commit();
|
||||
OCP\DB::commit();
|
||||
$eventSource->send('success',true);
|
||||
}else{
|
||||
OCP\JSON::success(array('data'=>array('done'=>true)));
|
||||
|
|
|
@ -40,7 +40,7 @@ class OC_Share {
|
|||
*/
|
||||
public function __construct($source, $uid_shared_with, $permissions) {
|
||||
$uid_owner = OCP\USER::getUser();
|
||||
$query = OC_DB::prepare("INSERT INTO *PREFIX*sharing VALUES(?,?,?,?,?)");
|
||||
$query = OCP\DB::prepare("INSERT INTO *PREFIX*sharing VALUES(?,?,?,?,?)");
|
||||
if ($uid_shared_with == self::PUBLICLINK) {
|
||||
$token = sha1("$uid_shared_with-$source");
|
||||
$query->execute(array($uid_owner, self::PUBLICLINK, $source, $token, $permissions));
|
||||
|
@ -69,7 +69,7 @@ class OC_Share {
|
|||
}
|
||||
foreach ($uid_shared_with as $uid) {
|
||||
// Check if this item is already shared with the user
|
||||
$checkSource = OC_DB::prepare("SELECT source FROM *PREFIX*sharing WHERE source = ? AND uid_shared_with ".self::getUsersAndGroups($uid));
|
||||
$checkSource = OCP\DB::prepare("SELECT source FROM *PREFIX*sharing WHERE source = ? AND uid_shared_with ".self::getUsersAndGroups($uid));
|
||||
$resultCheckSource = $checkSource->execute(array($source))->fetchAll();
|
||||
// TODO Check if the source is inside a folder
|
||||
if (count($resultCheckSource) > 0 && !isset($gid)) {
|
||||
|
@ -101,11 +101,11 @@ class OC_Share {
|
|||
// Add file to filesystem cache
|
||||
$userDirectory = "/".OCP\USER::getUser()."/files";
|
||||
$data = OC_Filecache::get(substr($source, strlen($userDirectory)));
|
||||
$parentQuery = OC_DB::prepare('SELECT id FROM *PREFIX*fscache WHERE path=?');
|
||||
$parentQuery = OCP\DB::prepare('SELECT id FROM *PREFIX*fscache WHERE path=?');
|
||||
$parentResult = $parentQuery->execute(array($sharedFolder))->fetchRow();
|
||||
$parent = $parentResult['id'];
|
||||
$is_writeable = $permissions & OC_Share::WRITE;
|
||||
$cacheQuery = OC_DB::prepare('INSERT INTO *PREFIX*fscache(parent, name, path, size, mtime, ctime, mimetype, mimepart, user, writable) VALUES(?,?,?,?,?,?,?,?,?,?)');
|
||||
$cacheQuery = OCP\DB::prepare('INSERT INTO *PREFIX*fscache(parent, name, path, size, mtime, ctime, mimetype, mimepart, user, writable) VALUES(?,?,?,?,?,?,?,?,?,?)');
|
||||
$cacheQuery->execute(array($parent, basename($target), $target, $data['size'], $data['mtime'], $data['ctime'], $data['mimetype'], dirname($data['mimetype']), $uid, $is_writeable));
|
||||
}
|
||||
}
|
||||
|
@ -169,7 +169,7 @@ class OC_Share {
|
|||
$folders = self::getParentFolders($oldTarget);
|
||||
$source = $folders['source'].substr($oldTarget, strlen($folders['target']));
|
||||
$item = self::getItem($folders['target']);
|
||||
$query = OC_DB::prepare("INSERT INTO *PREFIX*sharing VALUES(?,?,?,?,?)");
|
||||
$query = OCP\DB::prepare("INSERT INTO *PREFIX*sharing VALUES(?,?,?,?,?)");
|
||||
$query->execute(array($item[0]['uid_owner'], OCP\USER::getUser(), $source, $newTarget, $item[0]['permissions']));
|
||||
}
|
||||
|
||||
|
@ -180,7 +180,7 @@ class OC_Share {
|
|||
*/
|
||||
public static function getItem($target) {
|
||||
$target = self::cleanPath($target);
|
||||
$query = OC_DB::prepare("SELECT uid_owner, source, permissions FROM *PREFIX*sharing WHERE target = ? AND uid_shared_with = ? LIMIT 1");
|
||||
$query = OCP\DB::prepare("SELECT uid_owner, source, permissions FROM *PREFIX*sharing WHERE target = ? AND uid_shared_with = ? LIMIT 1");
|
||||
return $query->execute(array($target, OCP\USER::getUser()))->fetchAll();
|
||||
}
|
||||
|
||||
|
@ -191,7 +191,7 @@ class OC_Share {
|
|||
*/
|
||||
public static function getMySharedItem($source) {
|
||||
$source = self::cleanPath($source);
|
||||
$query = OC_DB::prepare("SELECT uid_shared_with, permissions FROM *PREFIX*sharing WHERE source = ? AND uid_owner = ?");
|
||||
$query = OCP\DB::prepare("SELECT uid_shared_with, permissions FROM *PREFIX*sharing WHERE source = ? AND uid_owner = ?");
|
||||
$result = $query->execute(array($source, OCP\USER::getUser()))->fetchAll();
|
||||
if (count($result) > 0) {
|
||||
return $result;
|
||||
|
@ -207,7 +207,7 @@ class OC_Share {
|
|||
* @return An array with all items the user is sharing
|
||||
*/
|
||||
public static function getMySharedItems() {
|
||||
$query = OC_DB::prepare("SELECT uid_shared_with, source, permissions FROM *PREFIX*sharing WHERE uid_owner = ?");
|
||||
$query = OCP\DB::prepare("SELECT uid_shared_with, source, permissions FROM *PREFIX*sharing WHERE uid_owner = ?");
|
||||
return $query->execute(array(OCP\USER::getUser()))->fetchAll();
|
||||
}
|
||||
|
||||
|
@ -226,7 +226,7 @@ class OC_Share {
|
|||
$folder .= "/";
|
||||
}
|
||||
$length = strlen($folder);
|
||||
$query = OC_DB::prepare("SELECT uid_owner, source, target, permissions FROM *PREFIX*sharing WHERE SUBSTR(source, 1, ?) = ? OR SUBSTR(target, 1, ?) = ? AND uid_shared_with ".self::getUsersAndGroups());
|
||||
$query = OCP\DB::prepare("SELECT uid_owner, source, target, permissions FROM *PREFIX*sharing WHERE SUBSTR(source, 1, ?) = ? OR SUBSTR(target, 1, ?) = ? AND uid_shared_with ".self::getUsersAndGroups());
|
||||
return $query->execute(array($length, $folder, $length, $folder))->fetchAll();
|
||||
}
|
||||
|
||||
|
@ -237,7 +237,7 @@ class OC_Share {
|
|||
*/
|
||||
public static function getParentFolders($target) {
|
||||
$target = self::cleanPath($target);
|
||||
$query = OC_DB::prepare("SELECT source FROM *PREFIX*sharing WHERE target = ? AND uid_shared_with".self::getUsersAndGroups()." LIMIT 1");
|
||||
$query = OCP\DB::prepare("SELECT source FROM *PREFIX*sharing WHERE target = ? AND uid_shared_with".self::getUsersAndGroups()." LIMIT 1");
|
||||
// Prevent searching for user directory e.g. '/MTGap/files'
|
||||
$userDirectory = substr($target, 0, strpos($target, "files") + 5);
|
||||
$target = dirname($target);
|
||||
|
@ -265,7 +265,7 @@ class OC_Share {
|
|||
*/
|
||||
public static function getSource($target) {
|
||||
$target = self::cleanPath($target);
|
||||
$query = OC_DB::prepare("SELECT source FROM *PREFIX*sharing WHERE target = ? AND uid_shared_with ".self::getUsersAndGroups()." LIMIT 1");
|
||||
$query = OCP\DB::prepare("SELECT source FROM *PREFIX*sharing WHERE target = ? AND uid_shared_with ".self::getUsersAndGroups()." LIMIT 1");
|
||||
$result = $query->execute(array($target))->fetchAll();
|
||||
if (count($result) > 0) {
|
||||
return $result[0]['source'];
|
||||
|
@ -281,7 +281,7 @@ class OC_Share {
|
|||
|
||||
public static function getTarget($source) {
|
||||
$source = self::cleanPath($source);
|
||||
$query = OC_DB::prepare("SELECT target FROM *PREFIX*sharing WHERE source = ? AND uid_owner = ? LIMIT 1");
|
||||
$query = OCP\DB::prepare("SELECT target FROM *PREFIX*sharing WHERE source = ? AND uid_owner = ? LIMIT 1");
|
||||
$result = $query->execute(array($source, OCP\USER::getUser()))->fetchAll();
|
||||
if (count($result) > 0) {
|
||||
return $result[0]['target'];
|
||||
|
@ -298,7 +298,7 @@ class OC_Share {
|
|||
*/
|
||||
public static function getPermissions($target) {
|
||||
$target = self::cleanPath($target);
|
||||
$query = OC_DB::prepare("SELECT permissions FROM *PREFIX*sharing WHERE target = ? AND uid_shared_with ".self::getUsersAndGroups()." LIMIT 1");
|
||||
$query = OCP\DB::prepare("SELECT permissions FROM *PREFIX*sharing WHERE target = ? AND uid_shared_with ".self::getUsersAndGroups()." LIMIT 1");
|
||||
$result = $query->execute(array($target))->fetchAll();
|
||||
if (count($result) > 0) {
|
||||
return $result[0]['permissions'];
|
||||
|
@ -330,7 +330,7 @@ class OC_Share {
|
|||
* @return The token of the public link, a sha1 hash
|
||||
*/
|
||||
public static function getTokenFromSource($source) {
|
||||
$query = OC_DB::prepare("SELECT target FROM *PREFIX*sharing WHERE source = ? AND uid_shared_with = ? AND uid_owner = ? LIMIT 1");
|
||||
$query = OCP\DB::prepare("SELECT target FROM *PREFIX*sharing WHERE source = ? AND uid_shared_with = ? AND uid_owner = ? LIMIT 1");
|
||||
$result = $query->execute(array($source, self::PUBLICLINK, OCP\USER::getUser()))->fetchAll();
|
||||
if (count($result) > 0) {
|
||||
return $result[0]['target'];
|
||||
|
@ -350,7 +350,7 @@ class OC_Share {
|
|||
public static function setTarget($oldTarget, $newTarget) {
|
||||
$oldTarget = self::cleanPath($oldTarget);
|
||||
$newTarget = self::cleanPath($newTarget);
|
||||
$query = OC_DB::prepare("UPDATE *PREFIX*sharing SET target = REPLACE(target, ?, ?) WHERE uid_shared_with ".self::getUsersAndGroups());
|
||||
$query = OCP\DB::prepare("UPDATE *PREFIX*sharing SET target = REPLACE(target, ?, ?) WHERE uid_shared_with ".self::getUsersAndGroups());
|
||||
$query->execute(array($oldTarget, $newTarget));
|
||||
}
|
||||
|
||||
|
@ -365,7 +365,7 @@ class OC_Share {
|
|||
*/
|
||||
public static function setPermissions($source, $uid_shared_with, $permissions) {
|
||||
$source = self::cleanPath($source);
|
||||
$query = OC_DB::prepare("UPDATE *PREFIX*sharing SET permissions = ? WHERE SUBSTR(source, 1, ?) = ? AND uid_owner = ? AND uid_shared_with ".self::getUsersAndGroups($uid_shared_with));
|
||||
$query = OCP\DB::prepare("UPDATE *PREFIX*sharing SET permissions = ? WHERE SUBSTR(source, 1, ?) = ? AND uid_owner = ? AND uid_shared_with ".self::getUsersAndGroups($uid_shared_with));
|
||||
$query->execute(array($permissions, strlen($source), $source, OCP\USER::getUser()));
|
||||
}
|
||||
|
||||
|
@ -379,7 +379,7 @@ class OC_Share {
|
|||
*/
|
||||
public static function unshare($source, $uid_shared_with) {
|
||||
$source = self::cleanPath($source);
|
||||
$query = OC_DB::prepare("DELETE FROM *PREFIX*sharing WHERE SUBSTR(source, 1, ?) = ? AND uid_owner = ? AND uid_shared_with ".self::getUsersAndGroups($uid_shared_with));
|
||||
$query = OCP\DB::prepare("DELETE FROM *PREFIX*sharing WHERE SUBSTR(source, 1, ?) = ? AND uid_owner = ? AND uid_shared_with ".self::getUsersAndGroups($uid_shared_with));
|
||||
$query->execute(array(strlen($source), $source, OCP\USER::getUser()));
|
||||
}
|
||||
|
||||
|
@ -394,10 +394,10 @@ class OC_Share {
|
|||
public static function unshareFromMySelf($target, $delete = true) {
|
||||
$target = self::cleanPath($target);
|
||||
if ($delete) {
|
||||
$query = OC_DB::prepare("DELETE FROM *PREFIX*sharing WHERE SUBSTR(target, 1, ?) = ? AND uid_shared_with ".self::getUsersAndGroups());
|
||||
$query = OCP\DB::prepare("DELETE FROM *PREFIX*sharing WHERE SUBSTR(target, 1, ?) = ? AND uid_shared_with ".self::getUsersAndGroups());
|
||||
$query->execute(array(strlen($target), $target));
|
||||
} else {
|
||||
$query = OC_DB::prepare("UPDATE *PREFIX*sharing SET permissions = ? WHERE SUBSTR(target, 1, ?) = ? AND uid_shared_with ".self::getUsersAndGroups());
|
||||
$query = OCP\DB::prepare("UPDATE *PREFIX*sharing SET permissions = ? WHERE SUBSTR(target, 1, ?) = ? AND uid_shared_with ".self::getUsersAndGroups());
|
||||
$query->execute(array(self::UNSHARED, strlen($target), $target));
|
||||
}
|
||||
}
|
||||
|
@ -411,7 +411,7 @@ class OC_Share {
|
|||
if ($target = self::getTarget($source)) {
|
||||
// Forward hook to notify of changes to target file
|
||||
OC_Hook::emit("OC_Filesystem", "post_delete", array('path' => $target));
|
||||
$query = OC_DB::prepare("DELETE FROM *PREFIX*sharing WHERE SUBSTR(source, 1, ?) = ? AND uid_owner = ?");
|
||||
$query = OCP\DB::prepare("DELETE FROM *PREFIX*sharing WHERE SUBSTR(source, 1, ?) = ? AND uid_owner = ?");
|
||||
$query->execute(array(strlen($source), $source, OCP\USER::getUser()));
|
||||
}
|
||||
|
||||
|
@ -424,7 +424,7 @@ class OC_Share {
|
|||
public static function renameItem($arguments) {
|
||||
$oldSource = "/".OCP\USER::getUser()."/files".self::cleanPath($arguments['oldpath']);
|
||||
$newSource = "/".OCP\USER::getUser()."/files".self::cleanPath($arguments['newpath']);
|
||||
$query = OC_DB::prepare("UPDATE *PREFIX*sharing SET source = REPLACE(source, ?, ?) WHERE uid_owner = ?");
|
||||
$query = OCP\DB::prepare("UPDATE *PREFIX*sharing SET source = REPLACE(source, ?, ?) WHERE uid_owner = ?");
|
||||
$query->execute(array($oldSource, $newSource, OCP\USER::getUser()));
|
||||
}
|
||||
|
||||
|
@ -437,17 +437,17 @@ class OC_Share {
|
|||
}
|
||||
|
||||
public static function removeUser($arguments) {
|
||||
$query = OC_DB::prepare('DELETE FROM *PREFIX*sharing WHERE uid_owner = ? OR uid_shared_with '.self::getUsersAndGroups($arguments['uid']));
|
||||
$query = OCP\DB::prepare('DELETE FROM *PREFIX*sharing WHERE uid_owner = ? OR uid_shared_with '.self::getUsersAndGroups($arguments['uid']));
|
||||
$query->execute(array($arguments['uid']));
|
||||
}
|
||||
|
||||
public static function addToGroupShare($arguments) {
|
||||
$length = -strlen($arguments['gid']) - 1;
|
||||
$query = OC_DB::prepare('SELECT uid_owner, source, permissions FROM *PREFIX*sharing WHERE SUBSTR(uid_shared_with, '.$length.') = ?');
|
||||
$query = OCP\DB::prepare('SELECT uid_owner, source, permissions FROM *PREFIX*sharing WHERE SUBSTR(uid_shared_with, '.$length.') = ?');
|
||||
$gid = '@'.$arguments['gid'];
|
||||
$result = $query->execute(array($gid))->fetchAll();
|
||||
if (count($result) > 0) {
|
||||
$query = OC_DB::prepare('INSERT INTO *PREFIX*sharing VALUES(?,?,?,?,?)');
|
||||
$query = OCP\DB::prepare('INSERT INTO *PREFIX*sharing VALUES(?,?,?,?,?)');
|
||||
$sharedFolder = '/'.$arguments['uid'].'/files/Shared/';
|
||||
$lastSource = '';
|
||||
for ($i = 0; $i < count($result) - 1; $i++) {
|
||||
|
@ -460,7 +460,7 @@ class OC_Share {
|
|||
}
|
||||
|
||||
public static function removeFromGroupShare($arguments) {
|
||||
$query = OC_DB::prepare('DELETE FROM *PREFIX*sharing WHERE uid_shared_with = ?');
|
||||
$query = OCP\DB::prepare('DELETE FROM *PREFIX*sharing WHERE uid_shared_with = ?');
|
||||
$query->execute(array($arguments['uid'].'@'.$arguments['gid']));
|
||||
}
|
||||
|
||||
|
|
|
@ -227,7 +227,7 @@ class OC_Filestorage_Shared extends OC_Filestorage {
|
|||
}
|
||||
if ($size > 0) {
|
||||
$dbpath = rtrim($this->datadir.$path, "/");
|
||||
// $query = OC_DB::prepare("INSERT INTO *PREFIX*foldersize VALUES(?,?)");
|
||||
// $query = OCP\DB::prepare("INSERT INTO *PREFIX*foldersize VALUES(?,?)");
|
||||
// $result = $query->execute(array($dbpath, $size));
|
||||
}
|
||||
}
|
||||
|
@ -241,7 +241,7 @@ class OC_Filestorage_Shared extends OC_Filestorage {
|
|||
$path = dirname($path);
|
||||
}
|
||||
$dbpath = rtrim($this->datadir.$path, "/");
|
||||
// $query = OC_DB::prepare("DELETE FROM *PREFIX*/*foldersize*/ WHERE path = ?");
|
||||
// $query = OCP\DB::prepare("DELETE FROM *PREFIX*/*foldersize*/ WHERE path = ?");
|
||||
// $result = $query->execute(array($dbpath));
|
||||
if ($path != "/" && $path != "") {
|
||||
$parts = explode("/", $path);
|
||||
|
|
|
@ -48,13 +48,13 @@ function handleGetThumbnails($albumname) {
|
|||
}
|
||||
|
||||
function handleGalleryScanning() {
|
||||
OC_DB::beginTransaction();
|
||||
OCP\DB::beginTransaction();
|
||||
set_time_limit(0);
|
||||
OC_Gallery_Album::cleanup();
|
||||
$eventSource = new OC_EventSource();
|
||||
OC_Gallery_Scanner::scan($eventSource);
|
||||
$eventSource->close();
|
||||
OC_DB::commit();
|
||||
OCP\DB::commit();
|
||||
}
|
||||
|
||||
function handleFilescan($cleanup) {
|
||||
|
|
|
@ -43,7 +43,7 @@ OCP\App::addNavigationEntry( array(
|
|||
|
||||
class OC_GallerySearchProvider extends OC_Search_Provider{
|
||||
function search($query){
|
||||
$stmt = OC_DB::prepare('SELECT * FROM *PREFIX*gallery_albums WHERE uid_owner = ? AND album_name LIKE ?');
|
||||
$stmt = OCP\DB::prepare('SELECT * FROM *PREFIX*gallery_albums WHERE uid_owner = ? AND album_name LIKE ?');
|
||||
$result = $stmt->execute(array(OCP\USER::getUser(),'%'.$query.'%'));
|
||||
$results=array();
|
||||
while($row=$result->fetchRow()){
|
||||
|
|
|
@ -25,7 +25,7 @@ require_once('base.php');
|
|||
|
||||
class OC_Gallery_Album {
|
||||
public static function create($owner, $name, $path){
|
||||
$stmt = OC_DB::prepare('INSERT INTO *PREFIX*gallery_albums (uid_owner, album_name, album_path, parent_path) VALUES (?, ?, ?, ?)');
|
||||
$stmt = OCP\DB::prepare('INSERT INTO *PREFIX*gallery_albums (uid_owner, album_name, album_path, parent_path) VALUES (?, ?, ?, ?)');
|
||||
$stmt->execute(array($owner, $name, $path, self::getParentPath($path)));
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,7 @@ class OC_Gallery_Album {
|
|||
$sql .= ' AND parent_path LIKE ?';
|
||||
$args[] = $parent;
|
||||
}
|
||||
$stmt = OC_DB::prepare($sql);
|
||||
$stmt = OCP\DB::prepare($sql);
|
||||
return $stmt->execute($args);
|
||||
}
|
||||
|
||||
|
@ -82,12 +82,12 @@ class OC_Gallery_Album {
|
|||
$order = OCP\Config::getUserValue($owner, 'gallery', 'order', 'ASC');
|
||||
$sql .= ' ORDER BY album_name ' . $order;
|
||||
|
||||
$stmt = OC_DB::prepare($sql);
|
||||
$stmt = OCP\DB::prepare($sql);
|
||||
return $stmt->execute($args);
|
||||
}
|
||||
|
||||
public static function changePath($oldname, $newname, $owner) {
|
||||
$stmt = OC_DB::prepare('UPDATE *PREFIX*gallery_albums SET album_path=? WHERE uid_owner=? AND album_path=?');
|
||||
$stmt = OCP\DB::prepare('UPDATE *PREFIX*gallery_albums SET album_path=? WHERE uid_owner=? AND album_path=?');
|
||||
$stmt->execute(array($newname, $owner, $oldname));
|
||||
}
|
||||
|
||||
|
@ -99,7 +99,7 @@ class OC_Gallery_Album {
|
|||
|
||||
public static function getAlbumSize($id){
|
||||
$sql = 'SELECT COUNT(*) as size FROM *PREFIX*gallery_photos WHERE album_id = ?';
|
||||
$stmt = OC_DB::prepare($sql);
|
||||
$stmt = OCP\DB::prepare($sql);
|
||||
$result=$stmt->execute(array($id))->fetchRow();
|
||||
return $result['size'];
|
||||
}
|
||||
|
@ -107,7 +107,7 @@ class OC_Gallery_Album {
|
|||
public static function getIntermediateGallerySize($path) {
|
||||
$path .= '%';
|
||||
$sql = 'SELECT COUNT(*) as size FROM *PREFIX*gallery_photos photos, *PREFIX*gallery_albums albums WHERE photos.album_id = albums.album_id AND uid_owner = ? AND file_path LIKE ?';
|
||||
$stmt = OC_DB::prepare($sql);
|
||||
$stmt = OCP\DB::prepare($sql);
|
||||
$result = $stmt->execute(array(OCP\USER::getUser(), $path))->fetchRow();
|
||||
return $result['size'];
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
class OC_Gallery_Photo {
|
||||
public static function create($albumId, $img){
|
||||
$stmt = OC_DB::prepare('INSERT INTO *PREFIX*gallery_photos (album_id, file_path) VALUES (?, ?)');
|
||||
$stmt = OCP\DB::prepare('INSERT INTO *PREFIX*gallery_photos (album_id, file_path) VALUES (?, ?)');
|
||||
$stmt->execute(array($albumId, $img));
|
||||
}
|
||||
public static function find($albumId, $img=null){
|
||||
|
@ -33,11 +33,11 @@ class OC_Gallery_Photo {
|
|||
$sql .= ' AND file_path = ?';
|
||||
$args[] = $img;
|
||||
}
|
||||
$stmt = OC_DB::prepare($sql);
|
||||
$stmt = OCP\DB::prepare($sql);
|
||||
return $stmt->execute($args);
|
||||
}
|
||||
public static function findForAlbum($owner, $album_name){
|
||||
$stmt = OC_DB::prepare('SELECT *'
|
||||
$stmt = OCP\DB::prepare('SELECT *'
|
||||
.' FROM *PREFIX*gallery_photos photos,'
|
||||
.' *PREFIX*gallery_albums albums'
|
||||
.' WHERE albums.uid_owner = ?'
|
||||
|
@ -47,22 +47,22 @@ class OC_Gallery_Photo {
|
|||
}
|
||||
|
||||
public static function removeByPath($path, $album_id) {
|
||||
$stmt = OC_DB::prepare('DELETE FROM *PREFIX*gallery_photos WHERE file_path LIKE ? and album_id = ?');
|
||||
$stmt = OCP\DB::prepare('DELETE FROM *PREFIX*gallery_photos WHERE file_path LIKE ? and album_id = ?');
|
||||
$stmt->execute(array($path, $album_id));
|
||||
}
|
||||
|
||||
public static function removeById($id) {
|
||||
$stmt = OC_DB::prepare('DELETE FROM *PREFIX*gallery_photos WHERE photo_id = ?');
|
||||
$stmt = OCP\DB::prepare('DELETE FROM *PREFIX*gallery_photos WHERE photo_id = ?');
|
||||
$stmt->execute(array($id));
|
||||
}
|
||||
|
||||
public static function removeByAlbumId($albumid) {
|
||||
$stmt = OC_DB::prepare('DELETE FROM *PREFIX*gallery_photos WHERE album_id = ?');
|
||||
$stmt = OCP\DB::prepare('DELETE FROM *PREFIX*gallery_photos WHERE album_id = ?');
|
||||
$stmt->execute(array($albumid));
|
||||
}
|
||||
|
||||
public static function changePath($oldAlbumId, $newAlbumId, $oldpath, $newpath) {
|
||||
$stmt = OC_DB::prepare("UPDATE *PREFIX*gallery_photos SET file_path = ?, album_id = ? WHERE album_id = ? and file_path = ?");
|
||||
$stmt = OCP\DB::prepare("UPDATE *PREFIX*gallery_photos SET file_path = ?, album_id = ? WHERE album_id = ? and file_path = ?");
|
||||
$stmt->execute(array($newpath, $newAlbumId, $oldAlbumId, $oldpath));
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
class OC_Gallery_Sharing {
|
||||
private static function getEntries($token) {
|
||||
$sql = 'SELECT * FROM *PREFIX*gallery_sharing WHERE token = ?';
|
||||
$stmt = OC_DB::prepare($sql);
|
||||
$stmt = OCP\DB::prepare($sql);
|
||||
return $stmt->execute(array($token));
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,7 @@ class OC_Gallery_Sharing {
|
|||
if ($row = $r->fetchRow()) {
|
||||
$galleryId = $row['gallery_id'];
|
||||
$sql = 'SELECT * FROM *PREFIX*gallery_albums WHERE album_id = ?';
|
||||
$stmt = OC_DB::prepare($sql);
|
||||
$stmt = OCP\DB::prepare($sql);
|
||||
$r = $stmt->execute(array($galleryId));
|
||||
if ($row = $r->fetchRow())
|
||||
return $row['uid_owner'];
|
||||
|
@ -58,7 +58,7 @@ class OC_Gallery_Sharing {
|
|||
if ($row = $r->fetchRow()) {
|
||||
$galleryId = $row['gallery_id'];
|
||||
$sql = 'SELECT * FROM *PREFIX*gallery_albums WHERE album_id = ?';
|
||||
$stmt = OC_DB::prepare($sql);
|
||||
$stmt = OCP\DB::prepare($sql);
|
||||
$r = $stmt->execute(array($galleryId));
|
||||
if ($row = $r->fetchRow())
|
||||
return $row['album_path'];
|
||||
|
@ -66,23 +66,23 @@ class OC_Gallery_Sharing {
|
|||
}
|
||||
|
||||
public static function updateSharingByToken($token, $recursive) {
|
||||
$stmt = OC_DB::prepare('UPDATE *PREFIX*gallery_sharing SET recursive = ? WHERE token = ?');
|
||||
$stmt = OCP\DB::prepare('UPDATE *PREFIX*gallery_sharing SET recursive = ? WHERE token = ?');
|
||||
$stmt->execute(array($recursive, $token));
|
||||
}
|
||||
|
||||
public static function getEntryByAlbumId($album_id) {
|
||||
$stmt = OC_DB::prepare('SELECT * FROM *PREFIX*gallery_sharing WHERE gallery_id = ?');
|
||||
$stmt = OCP\DB::prepare('SELECT * FROM *PREFIX*gallery_sharing WHERE gallery_id = ?');
|
||||
return $stmt->execute(array($album_id));
|
||||
}
|
||||
|
||||
public static function addShared($token, $albumId, $recursive) {
|
||||
$sql = 'INSERT INTO *PREFIX*gallery_sharing (token, gallery_id, recursive) VALUES (?, ?, ?)';
|
||||
$stmt = OC_DB::prepare($sql);
|
||||
$stmt = OCP\DB::prepare($sql);
|
||||
$stmt->execute(array($token, $albumId, $recursive));
|
||||
}
|
||||
|
||||
public static function remove($albumId) {
|
||||
$stmt = OC_DB::prepare('DELETE FROM *PREFIX*gallery_sharing WHERE gallery_id = ?');
|
||||
$stmt = OCP\DB::prepare('DELETE FROM *PREFIX*gallery_sharing WHERE gallery_id = ?');
|
||||
$stmt->execute(array($albumId));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -67,12 +67,12 @@ if($arguments['action']){
|
|||
OCP\JSON::encodedPrint($data);
|
||||
break;
|
||||
case 'scan':
|
||||
OC_DB::beginTransaction();
|
||||
OCP\DB::beginTransaction();
|
||||
set_time_limit(0); //recursive scan can take a while
|
||||
$eventSource=new OC_EventSource();
|
||||
OC_MEDIA_SCANNER::scanCollection($eventSource);
|
||||
$eventSource->close();
|
||||
OC_DB::commit();
|
||||
OCP\DB::commit();
|
||||
break;
|
||||
case 'scanFile':
|
||||
echo (OC_MEDIA_SCANNER::scanFile($arguments['path']))?'true':'false';
|
||||
|
|
|
@ -65,7 +65,7 @@ class OC_MEDIA_AMPACHE{
|
|||
</root>");
|
||||
}
|
||||
if($auth and $user and $time){
|
||||
$query=OC_DB::prepare("SELECT user_id, user_password_sha256 from *PREFIX*media_users WHERE user_id=?");
|
||||
$query=OCP\DB::prepare("SELECT user_id, user_password_sha256 from *PREFIX*media_users WHERE user_id=?");
|
||||
$users=$query->execute(array($user))->fetchAll();
|
||||
if(count($users)>0){
|
||||
$pass=$users[0]['user_password_sha256'];
|
||||
|
@ -77,7 +77,7 @@ class OC_MEDIA_AMPACHE{
|
|||
$songs=OC_MEDIA_COLLECTION::getSongCount();
|
||||
$artists=OC_MEDIA_COLLECTION::getArtistCount();
|
||||
$albums=OC_MEDIA_COLLECTION::getAlbumCount();
|
||||
$query=OC_DB::prepare("INSERT INTO *PREFIX*media_sessions (`session_id`, `token`, `user_id`, `start`) VALUES (NULL, ?, ?, now());");
|
||||
$query=OCP\DB::prepare("INSERT INTO *PREFIX*media_sessions (`session_id`, `token`, `user_id`, `start`) VALUES (NULL, ?, ?, now());");
|
||||
$query->execute(array($token,$user));
|
||||
$expire=date('c',time()+600);
|
||||
echo('<?xml version="1.0" encoding="UTF-8"?>');
|
||||
|
@ -137,10 +137,10 @@ class OC_MEDIA_AMPACHE{
|
|||
}
|
||||
}
|
||||
//remove old sessions
|
||||
$query=OC_DB::prepare("DELETE from *PREFIX*media_sessions WHERE start<(NOW()-600)");
|
||||
$query=OCP\DB::prepare("DELETE from *PREFIX*media_sessions WHERE start<(NOW()-600)");
|
||||
$query->execute();
|
||||
|
||||
$query=OC_DB::prepare("SELECT user_id from *PREFIX*media_sessions WHERE token=?");
|
||||
$query=OCP\DB::prepare("SELECT user_id from *PREFIX*media_sessions WHERE token=?");
|
||||
$users=$query->execute(array($auth))->fetchAll();
|
||||
if(count($users)>0){
|
||||
OC_MEDIA_COLLECTION::$uid=$users[0]['user_id'];
|
||||
|
@ -151,7 +151,7 @@ class OC_MEDIA_AMPACHE{
|
|||
}
|
||||
|
||||
public static function updateAuth($auth){
|
||||
$query=OC_DB::prepare("UPDATE *PREFIX*media_sessions SET start=CURRENT_TIMESTAMP WHERE token=?");
|
||||
$query=OCP\DB::prepare("UPDATE *PREFIX*media_sessions SET start=CURRENT_TIMESTAMP WHERE token=?");
|
||||
$query->execute(array($auth));
|
||||
}
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ class OC_MEDIA_COLLECTION{
|
|||
if(isset(self::$artistIdCache[$name])){
|
||||
return self::$artistIdCache[$name];
|
||||
}else{
|
||||
$query=OC_DB::prepare("SELECT artist_id FROM *PREFIX*media_artists WHERE lower(artist_name) LIKE ?");
|
||||
$query=OCP\DB::prepare("SELECT artist_id FROM *PREFIX*media_artists WHERE lower(artist_name) LIKE ?");
|
||||
$artists=$query->execute(array($name))->fetchAll();
|
||||
if(is_array($artists) and isset($artists[0])){
|
||||
self::$artistIdCache[$name]=$artists[0]['artist_id'];
|
||||
|
@ -71,7 +71,7 @@ class OC_MEDIA_COLLECTION{
|
|||
if(isset(self::$albumIdCache[$artistId][$name])){
|
||||
return self::$albumIdCache[$artistId][$name];
|
||||
}else{
|
||||
$query=OC_DB::prepare("SELECT album_id FROM *PREFIX*media_albums WHERE lower(album_name) LIKE ? AND album_artist=?");
|
||||
$query=OCP\DB::prepare("SELECT album_id FROM *PREFIX*media_albums WHERE lower(album_name) LIKE ? AND album_artist=?");
|
||||
$albums=$query->execute(array($name,$artistId))->fetchAll();
|
||||
if(is_array($albums) and isset($albums[0])){
|
||||
self::$albumIdCache[$artistId][$name]=$albums[0]['album_id'];
|
||||
|
@ -104,7 +104,7 @@ class OC_MEDIA_COLLECTION{
|
|||
return self::$albumIdCache[$artistId][$albumId][$name];
|
||||
}else{
|
||||
$uid=$_SESSION['user_id'];
|
||||
$query=OC_DB::prepare("SELECT song_id FROM *PREFIX*media_songs WHERE song_user=? AND song_name LIKE ? AND song_artist=? AND song_album=?");
|
||||
$query=OCP\DB::prepare("SELECT song_id FROM *PREFIX*media_songs WHERE song_user=? AND song_name LIKE ? AND song_artist=? AND song_album=?");
|
||||
$songs=$query->execute(array($uid,$name,$artistId,$albumId))->fetchAll();
|
||||
if(is_array($songs) and isset($songs[0])){
|
||||
self::$albumIdCache[$artistId][$albumId][$name]=$songs[0]['song_id'];
|
||||
|
@ -130,7 +130,7 @@ class OC_MEDIA_COLLECTION{
|
|||
}elseif($search==''){
|
||||
$search='%';
|
||||
}
|
||||
$query=OC_DB::prepare("SELECT DISTINCT artist_name, artist_id FROM *PREFIX*media_artists
|
||||
$query=OCP\DB::prepare("SELECT DISTINCT artist_name, artist_id FROM *PREFIX*media_artists
|
||||
INNER JOIN *PREFIX*media_songs ON artist_id=song_artist WHERE artist_name LIKE ? AND song_user=? ORDER BY artist_name");
|
||||
$result=$query->execute(array($search,self::$uid));
|
||||
return $result->fetchAll();
|
||||
|
@ -151,7 +151,7 @@ class OC_MEDIA_COLLECTION{
|
|||
if($artistId!=0){
|
||||
return $artistId;
|
||||
}else{
|
||||
$query=OC_DB::prepare("INSERT INTO `*PREFIX*media_artists` (`artist_name`) VALUES (?)");
|
||||
$query=OCP\DB::prepare("INSERT INTO `*PREFIX*media_artists` (`artist_name`) VALUES (?)");
|
||||
$result=$query->execute(array($name));
|
||||
return self::getArtistId($name);;
|
||||
}
|
||||
|
@ -183,7 +183,7 @@ class OC_MEDIA_COLLECTION{
|
|||
array_push($params,$search);
|
||||
}
|
||||
$cmd.=' ORDER BY album_name';
|
||||
$query=OC_DB::prepare($cmd);
|
||||
$query=OCP\DB::prepare($cmd);
|
||||
return $query->execute($params)->fetchAll();
|
||||
}
|
||||
|
||||
|
@ -203,7 +203,7 @@ class OC_MEDIA_COLLECTION{
|
|||
if($albumId!=0){
|
||||
return $albumId;
|
||||
}else{
|
||||
$query=OC_DB::prepare("INSERT INTO `*PREFIX*media_albums` (`album_name` ,`album_artist`) VALUES ( ?, ?)");
|
||||
$query=OCP\DB::prepare("INSERT INTO `*PREFIX*media_albums` (`album_name` ,`album_artist`) VALUES ( ?, ?)");
|
||||
$query->execute(array($name,$artist));
|
||||
return self::getAlbumId($name,$artist);
|
||||
}
|
||||
|
@ -243,7 +243,7 @@ class OC_MEDIA_COLLECTION{
|
|||
}else{
|
||||
$searchString='';
|
||||
}
|
||||
$query=OC_DB::prepare("SELECT * FROM *PREFIX*media_songs WHERE song_user=? $artistString $albumString $searchString ORDER BY song_track, song_name, song_path");
|
||||
$query=OCP\DB::prepare("SELECT * FROM *PREFIX*media_songs WHERE song_user=? $artistString $albumString $searchString ORDER BY song_track, song_name, song_path");
|
||||
return $query->execute($params)->fetchAll();
|
||||
}
|
||||
|
||||
|
@ -270,39 +270,39 @@ class OC_MEDIA_COLLECTION{
|
|||
return $songId;
|
||||
}else{
|
||||
if(!isset(self::$queries['addsong'])){
|
||||
$query=OC_DB::prepare("INSERT INTO `*PREFIX*media_songs` (`song_name` ,`song_artist` ,`song_album` ,`song_path` ,`song_user`,`song_length`,`song_track`,`song_size`,`song_playcount`,`song_lastplayed`)
|
||||
$query=OCP\DB::prepare("INSERT INTO `*PREFIX*media_songs` (`song_name` ,`song_artist` ,`song_album` ,`song_path` ,`song_user`,`song_length`,`song_track`,`song_size`,`song_playcount`,`song_lastplayed`)
|
||||
VALUES (?, ?, ?, ?,?,?,?,?,0,0)");
|
||||
self::$queries['addsong']=$query;
|
||||
}else{
|
||||
$query=self::$queries['addsong'];
|
||||
}
|
||||
$query->execute(array($name,$artist,$album,$path,$uid,$length,$track,$size));
|
||||
$songId=OC_DB::insertid('*PREFIX*media_songs');
|
||||
$songId=OCP\DB::insertid('*PREFIX*media_songs');
|
||||
// self::setLastUpdated();
|
||||
return self::getSongId($name,$artist,$album);
|
||||
}
|
||||
}
|
||||
|
||||
public static function getSongCount(){
|
||||
$query=OC_DB::prepare("SELECT COUNT(song_id) AS count FROM *PREFIX*media_songs");
|
||||
$query=OCP\DB::prepare("SELECT COUNT(song_id) AS count FROM *PREFIX*media_songs");
|
||||
$result=$query->execute()->fetchAll();
|
||||
return $result[0]['count'];
|
||||
}
|
||||
|
||||
public static function getArtistCount(){
|
||||
$query=OC_DB::prepare("SELECT COUNT(artist_id) AS count FROM *PREFIX*media_artists");
|
||||
$query=OCP\DB::prepare("SELECT COUNT(artist_id) AS count FROM *PREFIX*media_artists");
|
||||
$result=$query->execute()->fetchAll();
|
||||
return $result[0]['count'];
|
||||
}
|
||||
|
||||
public static function getAlbumCount(){
|
||||
$query=OC_DB::prepare("SELECT COUNT(album_id) AS count FROM *PREFIX*media_albums");
|
||||
$query=OCP\DB::prepare("SELECT COUNT(album_id) AS count FROM *PREFIX*media_albums");
|
||||
$result=$query->execute()->fetchAll();
|
||||
return $result[0]['count'];
|
||||
}
|
||||
|
||||
public static function getArtistName($artistId){
|
||||
$query=OC_DB::prepare("SELECT artist_name FROM *PREFIX*media_artists WHERE artist_id=?");
|
||||
$query=OCP\DB::prepare("SELECT artist_name FROM *PREFIX*media_artists WHERE artist_id=?");
|
||||
$artist=$query->execute(array($artistId))->fetchAll();
|
||||
if(count($artist)>0){
|
||||
return $artist[0]['artist_name'];
|
||||
|
@ -312,7 +312,7 @@ class OC_MEDIA_COLLECTION{
|
|||
}
|
||||
|
||||
public static function getAlbumName($albumId){
|
||||
$query=OC_DB::prepare("SELECT album_name FROM *PREFIX*media_albums WHERE album_id=?");
|
||||
$query=OCP\DB::prepare("SELECT album_name FROM *PREFIX*media_albums WHERE album_id=?");
|
||||
$album=$query->execute(array($albumId))->fetchAll();
|
||||
if(count($album)>0){
|
||||
return $album[0]['album_name'];
|
||||
|
@ -322,7 +322,7 @@ class OC_MEDIA_COLLECTION{
|
|||
}
|
||||
|
||||
public static function getSong($id){
|
||||
$query=OC_DB::prepare("SELECT * FROM *PREFIX*media_songs WHERE song_id=?");
|
||||
$query=OCP\DB::prepare("SELECT * FROM *PREFIX*media_songs WHERE song_id=?");
|
||||
$song=$query->execute(array($id))->fetchAll();
|
||||
if(count($song)>0){
|
||||
return $song[0];
|
||||
|
@ -336,7 +336,7 @@ class OC_MEDIA_COLLECTION{
|
|||
* @param string $path
|
||||
*/
|
||||
public static function getSongCountByPath($path){
|
||||
$query=OC_DB::prepare("SELECT COUNT(song_id) AS count FROM *PREFIX*media_songs WHERE song_path LIKE ?");
|
||||
$query=OCP\DB::prepare("SELECT COUNT(song_id) AS count FROM *PREFIX*media_songs WHERE song_path LIKE ?");
|
||||
$result=$query->execute(array("$path%"))->fetchAll();
|
||||
return $result[0]['count'];
|
||||
}
|
||||
|
@ -348,7 +348,7 @@ class OC_MEDIA_COLLECTION{
|
|||
* if a path of a folder is passed, all songs stored in the folder will be removed from the database
|
||||
*/
|
||||
public static function deleteSongByPath($path){
|
||||
$query=OC_DB::prepare("DELETE FROM *PREFIX*media_songs WHERE song_path LIKE ?");
|
||||
$query=OCP\DB::prepare("DELETE FROM *PREFIX*media_songs WHERE song_path LIKE ?");
|
||||
$query->execute(array("$path%"));
|
||||
}
|
||||
|
||||
|
@ -358,7 +358,7 @@ class OC_MEDIA_COLLECTION{
|
|||
*/
|
||||
public static function registerPlay($songId){
|
||||
$now=time();
|
||||
$query=OC_DB::prepare('UPDATE *PREFIX*media_songs SET song_playcount=song_playcount+1, song_lastplayed=? WHERE song_id=? AND song_lastplayed<?');
|
||||
$query=OCP\DB::prepare('UPDATE *PREFIX*media_songs SET song_playcount=song_playcount+1, song_lastplayed=? WHERE song_id=? AND song_lastplayed<?');
|
||||
$query->execute(array($now,$songId,$now-60));
|
||||
}
|
||||
|
||||
|
@ -368,7 +368,7 @@ class OC_MEDIA_COLLECTION{
|
|||
* @return int
|
||||
*/
|
||||
public static function getSongByPath($path){
|
||||
$query=OC_DB::prepare("SELECT song_id FROM *PREFIX*media_songs WHERE song_path = ?");
|
||||
$query=OCP\DB::prepare("SELECT song_id FROM *PREFIX*media_songs WHERE song_path = ?");
|
||||
$result=$query->execute(array($path));
|
||||
if($row=$result->fetchRow()){
|
||||
return $row['song_id'];
|
||||
|
@ -383,7 +383,7 @@ class OC_MEDIA_COLLECTION{
|
|||
* @param string $newPath
|
||||
*/
|
||||
public static function moveSong($oldPath,$newPath){
|
||||
$query=OC_DB::prepare("UPDATE *PREFIX*media_songs SET song_path = ? WHERE song_path = ?");
|
||||
$query=OCP\DB::prepare("UPDATE *PREFIX*media_songs SET song_path = ? WHERE song_path = ?");
|
||||
$query->execute(array($newPath,$oldPath));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,11 +41,11 @@ class OC_MEDIA{
|
|||
public static function loginListener($params){
|
||||
if(isset($_POST['user']) and $_POST['password']){
|
||||
$name=$_POST['user'];
|
||||
$query=OC_DB::prepare("SELECT user_id from *PREFIX*media_users WHERE user_id LIKE ?");
|
||||
$query=OCP\DB::prepare("SELECT user_id from *PREFIX*media_users WHERE user_id LIKE ?");
|
||||
$uid=$query->execute(array($name))->fetchAll();
|
||||
if(count($uid)==0){
|
||||
$password=hash('sha256',$_POST['password']);
|
||||
$query=OC_DB::prepare("INSERT INTO *PREFIX*media_users (user_id, user_password_sha256) VALUES (?, ?);");
|
||||
$query=OCP\DB::prepare("INSERT INTO *PREFIX*media_users (user_id, user_password_sha256) VALUES (?, ?);");
|
||||
$query->execute(array($name,$password));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
class OC_remoteStorage {
|
||||
public static function getValidTokens($ownCloudUser, $category) {
|
||||
$query=OC_DB::prepare("SELECT token,appUrl,category FROM *PREFIX*authtoken WHERE user=? LIMIT 100");
|
||||
$query=OCP\DB::prepare("SELECT token,appUrl,category FROM *PREFIX*authtoken WHERE user=? LIMIT 100");
|
||||
$result=$query->execute(array($ownCloudUser));
|
||||
$ret = array();
|
||||
while($row=$result->fetchRow()){
|
||||
|
@ -15,7 +15,7 @@ class OC_remoteStorage {
|
|||
|
||||
public static function getAllTokens() {
|
||||
$user=OCP\USER::getUser();
|
||||
$query=OC_DB::prepare("SELECT token,appUrl,category FROM *PREFIX*authtoken WHERE user=? LIMIT 100");
|
||||
$query=OCP\DB::prepare("SELECT token,appUrl,category FROM *PREFIX*authtoken WHERE user=? LIMIT 100");
|
||||
$result=$query->execute(array($user));
|
||||
$ret = array();
|
||||
while($row=$result->fetchRow()){
|
||||
|
@ -29,13 +29,13 @@ class OC_remoteStorage {
|
|||
|
||||
public static function deleteToken($token) {
|
||||
$user=OCP\USER::getUser();
|
||||
$query=OC_DB::prepare("DELETE FROM *PREFIX*authtoken WHERE token=? AND user=?");
|
||||
$query=OCP\DB::prepare("DELETE FROM *PREFIX*authtoken WHERE token=? AND user=?");
|
||||
$result=$query->execute(array($token,$user));
|
||||
return 'unknown';//how can we see if any rows were affected?
|
||||
}
|
||||
private static function addToken($token, $appUrl, $categories){
|
||||
$user=OCP\USER::getUser();
|
||||
$query=OC_DB::prepare("INSERT INTO *PREFIX*authtoken (`token`,`appUrl`,`user`,`category`) VALUES(?,?,?,?)");
|
||||
$query=OCP\DB::prepare("INSERT INTO *PREFIX*authtoken (`token`,`appUrl`,`user`,`category`) VALUES(?,?,?,?)");
|
||||
$result=$query->execute(array($token,$appUrl,$user,$categories));
|
||||
}
|
||||
public static function createCategories($appUrl, $categories) {
|
||||
|
|
|
@ -137,7 +137,7 @@ class OC_LDAP {
|
|||
static private function ocname2dn($name, $isUser) {
|
||||
$table = self::getMapTable($isUser);
|
||||
|
||||
$query = OC_DB::prepare('
|
||||
$query = OCP\DB::prepare('
|
||||
SELECT ldap_dn
|
||||
FROM '.$table.'
|
||||
WHERE owncloud_name = ?
|
||||
|
@ -189,7 +189,7 @@ class OC_LDAP {
|
|||
$nameAttribute = self::conf('ldapGroupDisplayName');
|
||||
}
|
||||
|
||||
$query = OC_DB::prepare('
|
||||
$query = OCP\DB::prepare('
|
||||
SELECT owncloud_name
|
||||
FROM '.$table.'
|
||||
WHERE ldap_dn = ?
|
||||
|
@ -316,7 +316,7 @@ class OC_LDAP {
|
|||
static private function mappedComponents($isUsers) {
|
||||
$table = self::getMapTable($isUsers);
|
||||
|
||||
$query = OC_DB::prepare('
|
||||
$query = OCP\DB::prepare('
|
||||
SELECT ldap_dn, owncloud_name
|
||||
FROM '. $table
|
||||
);
|
||||
|
@ -360,7 +360,7 @@ class OC_LDAP {
|
|||
static private function mapComponent($dn, $ocname, $isUser = true) {
|
||||
$table = self::getMapTable($isUser);
|
||||
|
||||
$insert = OC_DB::prepare('
|
||||
$insert = OCP\DB::prepare('
|
||||
INSERT IGNORE INTO '.$table.'
|
||||
(ldap_dn, owncloud_name)
|
||||
VALUES (?,?)
|
||||
|
@ -368,7 +368,7 @@ class OC_LDAP {
|
|||
|
||||
$res = $insert->execute(array($dn, $ocname));
|
||||
|
||||
return !OC_DB::isError($res);
|
||||
return !OCP\DB::isError($res);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -54,7 +54,7 @@ class OC_USER_OPENID extends OC_User_Backend {
|
|||
* find the user that can be authenticated with an openid identity
|
||||
*/
|
||||
public static function findUserForIdentity($identity){
|
||||
$query=OC_DB::prepare('SELECT userid FROM *PREFIX*preferences WHERE appid=? AND configkey=? AND configvalue=?');
|
||||
$query=OCP\DB::prepare('SELECT userid FROM *PREFIX*preferences WHERE appid=? AND configkey=? AND configvalue=?');
|
||||
$result=$query->execute(array('user_openid','identity',$identity))->fetchAll();
|
||||
if(count($result)>0){
|
||||
return $result[0]['userid'];
|
||||
|
|
|
@ -0,0 +1,92 @@
|
|||
<?php
|
||||
/**
|
||||
* ownCloud
|
||||
*
|
||||
* @author Frank Karlitschek
|
||||
* @copyright 2010 Frank Karlitschek karlitschek@kde.org
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Public interface of ownCloud for apps to use.
|
||||
* DB Class
|
||||
*
|
||||
*/
|
||||
|
||||
// use OCP namespace for all classes that are considered public.
|
||||
// This means that they should be used by apps instead of the internal ownCloud classes
|
||||
namespace OCP;
|
||||
|
||||
class DB {
|
||||
|
||||
|
||||
/**
|
||||
* @brief Prepare a SQL query
|
||||
* @param $query Query string
|
||||
* @returns prepared SQL query
|
||||
*
|
||||
* SQL query via MDB2 prepare(), needs to be execute()'d!
|
||||
*/
|
||||
static public function prepare( $query ){
|
||||
return(\OC_DB::prepare($query));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief gets last value of autoincrement
|
||||
* @param $table string The optional table name (will replace *PREFIX*) and add sequence suffix
|
||||
* @returns id
|
||||
*
|
||||
* MDB2 lastInsertID()
|
||||
*
|
||||
* Call this method right after the insert command or other functions may
|
||||
* cause trouble!
|
||||
*/
|
||||
public static function insertid($table=null){
|
||||
return(\OC_DB::insertid($table));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Start a transaction
|
||||
*/
|
||||
public static function beginTransaction(){
|
||||
return(\OC_DB::beginTransaction());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Commit the database changes done during a transaction that is in progress
|
||||
*/
|
||||
public static function commit(){
|
||||
return(\OC_DB::commit());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* check if a result is an error, works with MDB2 and PDOException
|
||||
* @param mixed $result
|
||||
* @return bool
|
||||
*/
|
||||
public static function isError($result){
|
||||
return(\OC_DB::isError($result));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
Loading…
Reference in New Issue