当前位置: 首页>>代码示例>>PHP>>正文


PHP OC_DB::insertid方法代码示例

本文整理汇总了PHP中OC_DB::insertid方法的典型用法代码示例。如果您正苦于以下问题:PHP OC_DB::insertid方法的具体用法?PHP OC_DB::insertid怎么用?PHP OC_DB::insertid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OC_DB的用法示例。


在下文中一共展示了OC_DB::insertid方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 /**
  * @param \OC\Files\Storage\Storage|string $storage
  * @throws \RuntimeException
  */
 public function __construct($storage)
 {
     if ($storage instanceof \OC\Files\Storage\Storage) {
         $this->storageId = $storage->getId();
     } else {
         $this->storageId = $storage;
     }
     $this->storageId = self::adjustStorageId($this->storageId);
     $sql = 'SELECT `numeric_id` FROM `*PREFIX*storages` WHERE `id` = ?';
     $result = \OC_DB::executeAudited($sql, array($this->storageId));
     if ($row = $result->fetchRow()) {
         $this->numericId = $row['numeric_id'];
     } else {
         $connection = \OC_DB::getConnection();
         if ($connection->insertIfNotExist('*PREFIX*storages', ['id' => $this->storageId])) {
             $this->numericId = \OC_DB::insertid('*PREFIX*storages');
         } else {
             $result = \OC_DB::executeAudited($sql, array($this->storageId));
             if ($row = $result->fetchRow()) {
                 $this->numericId = $row['numeric_id'];
             } else {
                 throw new \RuntimeException('Storage could neither be inserted nor be selected from the database');
             }
         }
     }
 }
开发者ID:samj1912,项目名称:repo,代码行数:30,代码来源:storage.php

示例2: post_addToGroup

 /**
  * Function that is called after a user is added to a group.
  * TODO what does it do?
  * @param array $arguments
  */
 public static function post_addToGroup($arguments)
 {
     // Find the group shares and check if the user needs a unique target
     $query = \OC_DB::prepare('SELECT * FROM `*PREFIX*share` WHERE `share_type` = ? AND `share_with` = ?');
     $result = $query->execute(array(self::SHARE_TYPE_GROUP, $arguments['gid']));
     $query = \OC_DB::prepare('INSERT INTO `*PREFIX*share` (`item_type`, `item_source`,' . ' `item_target`, `parent`, `share_type`, `share_with`, `uid_owner`, `permissions`,' . ' `stime`, `file_source`, `file_target`) VALUES (?,?,?,?,?,?,?,?,?,?,?)');
     while ($item = $result->fetchRow()) {
         $sourceExists = \OC\Share\Share::getItemSharedWithBySource($item['item_type'], $item['item_source'], self::FORMAT_NONE, null, true, $arguments['uid']);
         if ($sourceExists) {
             $fileTarget = $sourceExists['file_target'];
             $itemTarget = $sourceExists['item_target'];
         } else {
             $itemTarget = Helper::generateTarget($item['item_type'], $item['item_source'], self::SHARE_TYPE_USER, $arguments['uid'], $item['owner'], null, $item['parent']);
             // do we also need a file target
             if ($item['item_type'] === 'file' || $item['item_type'] === 'folder') {
                 $fileTarget = Helper::generateTarget('file', $item['file_target'], self::SHARE_TYPE_USER, $arguments['uid'], $item['owner'], null, $item['parent']);
             } else {
                 $fileTarget = null;
             }
         }
         // Insert an extra row for the group share if the item or file target is unique for this user
         if ($itemTarget != $item['item_target'] || $fileTarget != $item['file_target']) {
             $query->execute(array($item['item_type'], $item['item_source'], $itemTarget, $item['id'], self::$shareTypeGroupUserUnique, $arguments['uid'], $item['uid_owner'], $item['permissions'], $item['stime'], $item['file_source'], $fileTarget));
             \OC_DB::insertid('*PREFIX*share');
         }
     }
 }
开发者ID:adolfo2103,项目名称:hcloudfilem,代码行数:32,代码来源:hooks.php

示例3: createStorage

 /**
  * Create a storage entry
  *
  * @param string $storageId
  */
 private function createStorage($storageId)
 {
     $sql = 'INSERT INTO `*PREFIX*storages` (`id`)' . ' VALUES (?)';
     $storageId = \OC\Files\Cache\Storage::adjustStorageId($storageId);
     $numRows = $this->connection->executeUpdate($sql, array($storageId));
     $this->assertEquals(1, $numRows);
     return \OC_DB::insertid('*PREFIX*storages');
 }
开发者ID:heldernl,项目名称:owncloud8-extended,代码行数:13,代码来源:repairlegacystorage.php

示例4: add

    public function add($callback, $topic)
    {
        $queryParts = array('timestamp', 'topic', 'callback');
        $params = array(time(), $topic, $callback);
        $sql = 'INSERT INTO `*PREFIX*hub_subscriptions`
					(`' . implode('`, `', $queryParts) . '`)
				VALUES (?,?,?)';
        \OC_DB::executeAudited($sql, $params);
        return \OC_DB::insertid('*PREFIX*hub_subscriptions');
    }
开发者ID:evaluation-alex,项目名称:web_hooks,代码行数:10,代码来源:subscriptions.php

示例5: __construct

 /**
  * @param \OC\Files\Storage\Storage|string $storage
  */
 public function __construct($storage)
 {
     if ($storage instanceof \OC\Files\Storage\Storage) {
         $this->storageId = $storage->getId();
     } else {
         $this->storageId = $storage;
     }
     $this->storageId = self::adjustStorageId($this->storageId);
     $sql = 'SELECT `numeric_id` FROM `*PREFIX*storages` WHERE `id` = ?';
     $result = \OC_DB::executeAudited($sql, array($this->storageId));
     if ($row = $result->fetchRow()) {
         $this->numericId = $row['numeric_id'];
     } else {
         $sql = 'INSERT INTO `*PREFIX*storages` (`id`) VALUES(?)';
         \OC_DB::executeAudited($sql, array($this->storageId));
         $this->numericId = \OC_DB::insertid('*PREFIX*storages');
     }
 }
开发者ID:Combustible,项目名称:core,代码行数:21,代码来源:storage.php

示例6: checkLastIndexId

 public function checkLastIndexId()
 {
     $query = \OC_DB::prepare('INSERT INTO `*PREFIX*share` (' . ' `item_type`, `item_source`, `item_target`, `share_type`,' . ' `share_with`, `uid_owner`, `permissions`, `stime`, `file_source`,' . ' `file_target`, `token`, `parent`, `expiration`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)');
     $query->bindValue(1, 'file');
     $query->bindValue(2, 949);
     $query->bindValue(3, '/949');
     $query->bindValue(4, 0);
     $query->bindValue(5, 'migrate-test-user');
     $query->bindValue(6, 'migrate-test-owner');
     $query->bindValue(7, 23);
     $query->bindValue(8, 1402493312);
     $query->bindValue(9, 0);
     $query->bindValue(10, '/migration.txt');
     $query->bindValue(11, null);
     $query->bindValue(12, null);
     $query->bindValue(13, null);
     $this->assertEquals(1, $query->execute());
     $this->assertNotEquals('0', \OC_DB::insertid('*PREFIX*share'));
     // cleanup
     $query = \OC_DB::prepare('DELETE FROM `*PREFIX*share` WHERE `file_target` = ?');
     $query->bindValue(1, '/migration.txt');
     $this->assertEquals(1, $query->execute());
 }
开发者ID:olucao,项目名称:owncloud-core,代码行数:23,代码来源:migration.php

示例7: __construct

 /**
  * @param \OC\Files\Storage\Storage|string $storage
  * @param bool $isAvailable
  * @throws \RuntimeException
  */
 public function __construct($storage, $isAvailable = true)
 {
     if ($storage instanceof \OC\Files\Storage\Storage) {
         $this->storageId = $storage->getId();
     } else {
         $this->storageId = $storage;
     }
     $this->storageId = self::adjustStorageId($this->storageId);
     if ($row = self::getStorageById($this->storageId)) {
         $this->numericId = $row['numeric_id'];
     } else {
         $connection = \OC_DB::getConnection();
         if ($connection->insertIfNotExist('*PREFIX*storages', ['id' => $this->storageId, 'available' => $isAvailable])) {
             $this->numericId = \OC_DB::insertid('*PREFIX*storages');
         } else {
             if ($row = self::getStorageById($this->storageId)) {
                 $this->numericId = $row['numeric_id'];
             } else {
                 throw new \RuntimeException('Storage could neither be inserted nor be selected from the database');
             }
         }
     }
 }
开发者ID:rosarion,项目名称:core,代码行数:28,代码来源:storage.php

示例8: put


//.........这里部分代码省略.........
         $itemSource = $result['itemSource'];
         $fileSource = $result['fileSource'];
         $suggestedItemTarget = $result['suggestedItemTarget'];
         $suggestedFileTarget = $result['suggestedFileTarget'];
         $filePath = $result['filePath'];
     }
     $isGroupShare = false;
     if ($shareType == self::SHARE_TYPE_GROUP) {
         $isGroupShare = true;
         if (isset($shareWith['users'])) {
             $users = $shareWith['users'];
         } else {
             $users = \OC_Group::usersInGroup($shareWith['group']);
         }
         // remove current user from list
         if (in_array(\OCP\User::getUser(), $users)) {
             unset($users[array_search(\OCP\User::getUser(), $users)]);
         }
         $groupItemTarget = Helper::generateTarget($itemType, $itemSource, $shareType, $shareWith['group'], $uidOwner, $suggestedItemTarget);
         $groupFileTarget = Helper::generateTarget($itemType, $itemSource, $shareType, $shareWith['group'], $uidOwner, $filePath);
         // add group share to table and remember the id as parent
         $queriesToExecute['groupShare'] = array('itemType' => $itemType, 'itemSource' => $itemSource, 'itemTarget' => $groupItemTarget, 'shareType' => $shareType, 'shareWith' => $shareWith['group'], 'uidOwner' => $uidOwner, 'permissions' => $permissions, 'shareTime' => time(), 'fileSource' => $fileSource, 'fileTarget' => $groupFileTarget, 'token' => $token, 'parent' => $parent, 'expiration' => $expirationDate);
     } else {
         $users = array($shareWith);
         $itemTarget = Helper::generateTarget($itemType, $itemSource, $shareType, $shareWith, $uidOwner, $suggestedItemTarget);
     }
     $run = true;
     $error = '';
     $preHookData = array('itemType' => $itemType, 'itemSource' => $itemSource, 'shareType' => $shareType, 'uidOwner' => $uidOwner, 'permissions' => $permissions, 'fileSource' => $fileSource, 'expiration' => $expirationDate, 'token' => $token, 'run' => &$run, 'error' => &$error);
     $preHookData['itemTarget'] = $isGroupShare ? $groupItemTarget : $itemTarget;
     $preHookData['shareWith'] = $isGroupShare ? $shareWith['group'] : $shareWith;
     \OC_Hook::emit('OCP\\Share', 'pre_shared', $preHookData);
     if ($run === false) {
         throw new \Exception($error);
     }
     foreach ($users as $user) {
         $sourceId = $itemType === 'file' || $itemType === 'folder' ? $fileSource : $itemSource;
         $sourceExists = self::getItemSharedWithBySource($itemType, $sourceId, self::FORMAT_NONE, null, true, $user);
         $userShareType = $isGroupShare ? self::$shareTypeGroupUserUnique : $shareType;
         if ($sourceExists && $sourceExists['item_source'] === $itemSource) {
             $fileTarget = $sourceExists['file_target'];
             $itemTarget = $sourceExists['item_target'];
             // for group shares we don't need a additional entry if the target is the same
             if ($isGroupShare && $groupItemTarget === $itemTarget) {
                 continue;
             }
         } elseif (!$sourceExists && !$isGroupShare) {
             $itemTarget = Helper::generateTarget($itemType, $itemSource, $userShareType, $user, $uidOwner, $suggestedItemTarget, $parent);
             if (isset($fileSource)) {
                 if ($parentFolder) {
                     if ($parentFolder === true) {
                         $fileTarget = Helper::generateTarget('file', $filePath, $userShareType, $user, $uidOwner, $suggestedFileTarget, $parent);
                         if ($fileTarget != $groupFileTarget) {
                             $parentFolders[$user]['folder'] = $fileTarget;
                         }
                     } else {
                         if (isset($parentFolder[$user])) {
                             $fileTarget = $parentFolder[$user]['folder'] . $itemSource;
                             $parent = $parentFolder[$user]['id'];
                         }
                     }
                 } else {
                     $fileTarget = Helper::generateTarget('file', $filePath, $userShareType, $user, $uidOwner, $suggestedFileTarget, $parent);
                 }
             } else {
                 $fileTarget = null;
             }
         } else {
             // group share which doesn't exists until now, check if we need a unique target for this user
             $itemTarget = Helper::generateTarget($itemType, $itemSource, self::SHARE_TYPE_USER, $user, $uidOwner, $suggestedItemTarget, $parent);
             // do we also need a file target
             if (isset($fileSource)) {
                 $fileTarget = Helper::generateTarget('file', $filePath, self::SHARE_TYPE_USER, $user, $uidOwner, $suggestedFileTarget, $parent);
             } else {
                 $fileTarget = null;
             }
             if ($itemTarget === $groupItemTarget && (!isset($fileSource) || $fileTarget === $groupFileTarget)) {
                 continue;
             }
         }
         $queriesToExecute[] = array('itemType' => $itemType, 'itemSource' => $itemSource, 'itemTarget' => $itemTarget, 'shareType' => $userShareType, 'shareWith' => $user, 'uidOwner' => $uidOwner, 'permissions' => $permissions, 'shareTime' => time(), 'fileSource' => $fileSource, 'fileTarget' => $fileTarget, 'token' => $token, 'parent' => $parent, 'expiration' => $expirationDate);
     }
     $id = false;
     if ($isGroupShare) {
         $id = self::insertShare($queriesToExecute['groupShare']);
         // Save this id, any extra rows for this group share will need to reference it
         $parent = \OC_DB::insertid('*PREFIX*share');
         unset($queriesToExecute['groupShare']);
     }
     foreach ($queriesToExecute as $shareQuery) {
         $shareQuery['parent'] = $parent;
         $id = self::insertShare($shareQuery);
     }
     $postHookData = array('itemType' => $itemType, 'itemSource' => $itemSource, 'parent' => $parent, 'shareType' => $shareType, 'uidOwner' => $uidOwner, 'permissions' => $permissions, 'fileSource' => $fileSource, 'id' => $parent, 'token' => $token, 'expirationDate' => $expirationDate);
     $postHookData['shareWith'] = $isGroupShare ? $shareWith['group'] : $shareWith;
     $postHookData['itemTarget'] = $isGroupShare ? $groupItemTarget : $itemTarget;
     $postHookData['fileTarget'] = $isGroupShare ? $groupFileTarget : $fileTarget;
     \OC_Hook::emit('OCP\\Share', 'post_shared', $postHookData);
     return $id ? $id : false;
 }
开发者ID:evanjt,项目名称:core,代码行数:101,代码来源:share.php

示例9: testLastInsertId

	public function testLastInsertId() {
		$query = OC_DB::prepare('INSERT INTO `*PREFIX*'.$this->table2.'` (`fullname`,`uri`) VALUES (?,?)');
		$result1 = OC_DB::executeAudited($query, array('insertid 1','uri_1'));
		$id1 = OC_DB::insertid('*PREFIX*'.$this->table2);
		
		// we don't know the id we should expect, so insert another row
		$result2 = OC_DB::executeAudited($query, array('insertid 2','uri_2'));
		$id2 = OC_DB::insertid('*PREFIX*'.$this->table2);
		// now we can check if the two ids are in correct order
		$this->assertGreaterThan($id1, $id2);
	}
开发者ID:ninjasilicon,项目名称:core,代码行数:11,代码来源:db.php

示例10: put

 /**
  * store meta data for a file or folder
  *
  * @param string $file
  * @param array $data
  *
  * @return int file id
  */
 public function put($file, array $data)
 {
     if (($id = $this->getId($file)) > -1) {
         $this->update($id, $data);
         return $id;
     } else {
         // normalize file
         $file = $this->normalize($file);
         if (isset($this->partial[$file])) {
             //add any saved partial data
             $data = array_merge($this->partial[$file], $data);
             unset($this->partial[$file]);
         }
         $requiredFields = array('size', 'mtime', 'mimetype');
         foreach ($requiredFields as $field) {
             if (!isset($data[$field])) {
                 //data not complete save as partial and return
                 $this->partial[$file] = $data;
                 return -1;
             }
         }
         $data['path'] = $file;
         $data['parent'] = $this->getParentId($file);
         $data['name'] = \OC_Util::basename($file);
         list($queryParts, $params) = $this->buildParts($data);
         $queryParts[] = '`storage`';
         $params[] = $this->getNumericStorageId();
         $valuesPlaceholder = array_fill(0, count($queryParts), '?');
         $sql = 'INSERT INTO `*PREFIX*filecache` (' . implode(', ', $queryParts) . ')' . ' VALUES (' . implode(', ', $valuesPlaceholder) . ')';
         \OC_DB::executeAudited($sql, $params);
         return (int) \OC_DB::insertid('*PREFIX*filecache');
     }
 }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:41,代码来源:cache.php

示例11: addSong

 /**
  * Add an song to the database
  * @param string name
  * @param string path
  * @param integer artist
  * @param integer album
  * @return integer the song_id of the added artist
  */
 public static function addSong($name, $path, $artist, $album, $length, $track, $size)
 {
     $name = trim($name);
     $path = trim($path);
     if ($name == '' or $path == '') {
         return 0;
     }
     $uid = OC_User::getUser();
     //check if the song is already in the database
     $songId = self::getSongId($name, $artist, $album);
     if ($songId != 0) {
         $songInfo = self::getSong($songId);
         self::moveSong($songInfo['song_path'], $path);
         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`)\n\t\t\t\tVALUES (?, ?, ?, ?,?,?,?,?,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();
         // 			self::setLastUpdated();
         return self::getSongId($name, $artist, $album);
     }
 }
开发者ID:Teino1978-Corp,项目名称:Teino1978-Corp-owncloud_.htaccess-,代码行数:35,代码来源:owncloud_apps_media_lib_collection.php

示例12: insertid

 /**
  * Gets last value of autoincrement
  * @param $table string The optional table name (will replace *PREFIX*) and add sequence suffix
  * @return int
  *
  * 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);
 }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:14,代码来源:db.php

示例13: array

*/
//no apps or filesystem
$RUNTIME_NOSETUPFS = true;
require_once '../../../lib/base.php';
// Check if we are a user
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('bookmarks');
$CONFIG_DBTYPE = OC_Config::getValue("dbtype", "sqlite");
if ($CONFIG_DBTYPE == 'sqlite' or $CONFIG_DBTYPE == 'sqlite3') {
    $_ut = "strftime('%s','now')";
} else {
    $_ut = "UNIX_TIMESTAMP()";
}
//FIXME: Detect when user adds a known URL
$query = OC_DB::prepare("\n\tINSERT INTO *PREFIX*bookmarks\n\t(url, title, user_id, public, added, lastmodified)\n\tVALUES (?, ?, ?, 0, {$_ut}, {$_ut})\n\t");
$params = array(htmlspecialchars_decode($_GET["url"]), htmlspecialchars_decode($_GET["title"]), OC_User::getUser());
$query->execute($params);
$b_id = OC_DB::insertid();
if ($b_id !== false) {
    $query = OC_DB::prepare("\n\t\tINSERT INTO *PREFIX*bookmarks_tags\n\t\t(bookmark_id, tag)\n\t\tVALUES (?, ?)\n\t\t");
    $tags = explode(' ', urldecode($_GET["tags"]));
    foreach ($tags as $tag) {
        if (empty($tag)) {
            //avoid saving blankspaces
            continue;
        }
        $params = array($b_id, trim($tag));
        $query->execute($params);
    }
    OC_JSON::success(array('data' => $b_id));
}
开发者ID:Teino1978-Corp,项目名称:Teino1978-Corp-owncloud_.htaccess-,代码行数:31,代码来源:owncloud_apps_bookmarks_ajax_addBookmark.php

示例14: put


//.........这里部分代码省略.........
         $groupItemTarget = Helper::generateTarget($itemType, $itemSource, $shareType, $shareWith['group'], $uidOwner, $suggestedItemTarget);
         $run = true;
         $error = '';
         \OC_Hook::emit('OCP\\Share', 'pre_shared', array('itemType' => $itemType, 'itemSource' => $itemSource, 'itemTarget' => $groupItemTarget, 'shareType' => $shareType, 'shareWith' => $shareWith['group'], 'uidOwner' => $uidOwner, 'permissions' => $permissions, 'fileSource' => $fileSource, 'expiration' => $expirationDate, 'token' => $token, 'run' => &$run, 'error' => &$error));
         if ($run === false) {
             throw new \Exception($error);
         }
         if (isset($fileSource)) {
             if ($parentFolder) {
                 if ($parentFolder === true) {
                     $groupFileTarget = Helper::generateTarget('file', $filePath, $shareType, $shareWith['group'], $uidOwner, $suggestedFileTarget);
                     // Set group default file target for future use
                     $parentFolders[0]['folder'] = $groupFileTarget;
                 } else {
                     // Get group default file target
                     $groupFileTarget = $parentFolder[0]['folder'] . $itemSource;
                     $parent = $parentFolder[0]['id'];
                 }
             } else {
                 $groupFileTarget = Helper::generateTarget('file', $filePath, $shareType, $shareWith['group'], $uidOwner, $suggestedFileTarget);
             }
         } else {
             $groupFileTarget = null;
         }
         $queriesToExecute = array();
         $queriesToExecute['groupShare'] = array('itemType' => $itemType, 'itemSource' => $itemSource, 'itemTarget' => $groupItemTarget, 'shareType' => $shareType, 'shareWith' => $shareWith['group'], 'uidOwner' => $uidOwner, 'permissions' => $permissions, 'shareTime' => time(), 'fileSource' => $fileSource, 'fileTarget' => $groupFileTarget, 'token' => $token, 'parent' => $parent, 'expiration' => $expirationDate);
         // Loop through all users of this group in case we need to add an extra row
         foreach ($shareWith['users'] as $uid) {
             $itemTarget = Helper::generateTarget($itemType, $itemSource, self::SHARE_TYPE_USER, $uid, $uidOwner, $suggestedItemTarget, $parent);
             if (isset($fileSource)) {
                 if ($parentFolder) {
                     if ($parentFolder === true) {
                         $fileTarget = Helper::generateTarget('file', $filePath, self::SHARE_TYPE_USER, $uid, $uidOwner, $suggestedFileTarget, $parent);
                         if ($fileTarget != $groupFileTarget) {
                             $parentFolders[$uid]['folder'] = $fileTarget;
                         }
                     } else {
                         if (isset($parentFolder[$uid])) {
                             $fileTarget = $parentFolder[$uid]['folder'] . $itemSource;
                             $parent = $parentFolder[$uid]['id'];
                         }
                     }
                 } else {
                     $fileTarget = Helper::generateTarget('file', $filePath, self::SHARE_TYPE_USER, $uid, $uidOwner, $suggestedFileTarget, $parent);
                 }
             } else {
                 $fileTarget = null;
             }
             // Insert an extra row for the group share if the item or file target is unique for this user
             if ($itemTarget != $groupItemTarget || isset($fileSource) && $fileTarget != $groupFileTarget) {
                 $queriesToExecute[] = array('itemType' => $itemType, 'itemSource' => $itemSource, 'itemTarget' => $itemTarget, 'shareType' => self::$shareTypeGroupUserUnique, 'shareWith' => $uid, 'uidOwner' => $uidOwner, 'permissions' => $permissions, 'shareTime' => time(), 'fileSource' => $fileSource, 'fileTarget' => $fileTarget, 'token' => $token, 'expiration' => $expirationDate);
             }
         }
         self::insertShare($queriesToExecute['groupShare']);
         // Save this id, any extra rows for this group share will need to reference it
         $parent = \OC_DB::insertid('*PREFIX*share');
         unset($queriesToExecute['groupShare']);
         foreach ($queriesToExecute as $shareQuery) {
             $shareQuery['parent'] = $parent;
             self::insertShare($shareQuery);
         }
         \OC_Hook::emit('OCP\\Share', 'post_shared', array('itemType' => $itemType, 'itemSource' => $itemSource, 'itemTarget' => $groupItemTarget, 'parent' => $parent, 'shareType' => $shareType, 'shareWith' => $shareWith['group'], 'uidOwner' => $uidOwner, 'permissions' => $permissions, 'fileSource' => $fileSource, 'fileTarget' => $groupFileTarget, 'id' => $parent, 'token' => $token, 'expirationDate' => $expirationDate));
         if ($parentFolder === true) {
             // Return parent folders to preserve file target paths for potential children
             return $parentFolders;
         }
     } else {
         $itemTarget = Helper::generateTarget($itemType, $itemSource, $shareType, $shareWith, $uidOwner, $suggestedItemTarget);
         $run = true;
         $error = '';
         \OC_Hook::emit('OCP\\Share', 'pre_shared', array('itemType' => $itemType, 'itemSource' => $itemSource, 'itemTarget' => $itemTarget, 'shareType' => $shareType, 'shareWith' => $shareWith, 'uidOwner' => $uidOwner, 'permissions' => $permissions, 'fileSource' => $fileSource, 'token' => $token, 'expirationDate' => $expirationDate, 'run' => &$run, 'error' => &$error));
         if ($run === false) {
             throw new \Exception($error);
         }
         if (isset($fileSource)) {
             if ($parentFolder) {
                 if ($parentFolder === true) {
                     $fileTarget = Helper::generateTarget('file', $filePath, $shareType, $shareWith, $uidOwner, $suggestedFileTarget);
                     $parentFolders['folder'] = $fileTarget;
                 } else {
                     $fileTarget = $parentFolder['folder'] . $itemSource;
                     $parent = $parentFolder['id'];
                 }
             } else {
                 $fileTarget = Helper::generateTarget('file', $filePath, $shareType, $shareWith, $uidOwner, $suggestedFileTarget);
             }
         } else {
             $fileTarget = null;
         }
         self::insertShare(array('itemType' => $itemType, 'itemSource' => $itemSource, 'itemTarget' => $itemTarget, 'shareType' => $shareType, 'shareWith' => $shareWith, 'uidOwner' => $uidOwner, 'permissions' => $permissions, 'shareTime' => time(), 'fileSource' => $fileSource, 'fileTarget' => $fileTarget, 'token' => $token, 'parent' => $parent, 'expiration' => $expirationDate));
         $id = \OC_DB::insertid('*PREFIX*share');
         \OC_Hook::emit('OCP\\Share', 'post_shared', array('itemType' => $itemType, 'itemSource' => $itemSource, 'itemTarget' => $itemTarget, 'parent' => $parent, 'shareType' => $shareType, 'shareWith' => $shareWith, 'uidOwner' => $uidOwner, 'permissions' => $permissions, 'fileSource' => $fileSource, 'fileTarget' => $fileTarget, 'id' => $id, 'token' => $token, 'expirationDate' => $expirationDate));
         if ($parentFolder === true) {
             $parentFolders['id'] = $id;
             // Return parent folder to preserve file target paths for potential children
             return $parentFolders;
         }
     }
     return true;
 }
开发者ID:olucao,项目名称:owncloud-core,代码行数:101,代码来源:share.php

示例15: addFromDAVData

 /**
  * @brief Creates a new address book from the data sabredav provides
  * @param string $principaluri
  * @param string $uri
  * @param string $name
  * @param string $description
  * @return insertid
  */
 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(?,?,?,?,?)');
     $result = $stmt->execute(array($userid, $name, $uri, $description, 1));
     return OC_DB::insertid();
 }
开发者ID:Teino1978-Corp,项目名称:Teino1978-Corp-owncloud_.htaccess-,代码行数:15,代码来源:owncloud_apps_contacts_lib_addressbook.php


注:本文中的OC_DB::insertid方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。