Ejemplo n.º 1
0
/**
 * @brief Returns path to parent folder in cloud/.
 * This function cannot be used with mod/dav as it always returns a path valid under mod/cloud
 *
 * @param int $channel_id
 *  The id of the channel
 * @param string $channel_name
 *  The name of the channel
 * @param string $attachHash
 * @return string with the full folder path
 */
function get_parent_cloudpath($channel_id, $channel_name, $attachHash)
{
    $parentFullPath = '';
    // build directory tree
    $parentHash = $attachHash;
    do {
        $parentHash = find_folder_hash_by_attach_hash($channel_id, $parentHash);
        if ($parentHash) {
            $parentName = find_filename_by_hash($channel_id, $parentHash);
            $parentFullPath = $parentName . '/' . $parentFullPath;
        }
    } while ($parentHash);
    $parentFullPath = z_root() . '/cloud/' . $channel_name . '/' . $parentFullPath;
    return $parentFullPath;
}
Ejemplo n.º 2
0
function get_filename_by_cloudname($cloudname, $channel, $storepath)
{
    $items = array_diff(scandir($storepath), array('.', '..'));
    // hashed names
    foreach ($items as $item) {
        $filename = find_filename_by_hash($channel['channel_id'], $item);
        if ($filename === $cloudname) {
            return $item;
        }
    }
    return null;
}