コード例 #1
0
ファイル: smb.php プロジェクト: evanjt/core
 public function __construct($params)
 {
     if (isset($params['host']) && isset($params['user']) && isset($params['password']) && isset($params['share'])) {
         if (Server::NativeAvailable()) {
             $this->server = new NativeServer($params['host'], $params['user'], $params['password']);
         } else {
             $this->server = new Server($params['host'], $params['user'], $params['password']);
         }
         $this->share = $this->server->getShare(trim($params['share'], '/'));
         $this->root = isset($params['root']) ? $params['root'] : '/';
         if (!$this->root || $this->root[0] != '/') {
             $this->root = '/' . $this->root;
         }
         if (substr($this->root, -1, 1) != '/') {
             $this->root .= '/';
         }
     } else {
         throw new \Exception('Invalid configuration');
     }
 }
コード例 #2
0
ファイル: SMB.php プロジェクト: GitHubUser4234/core
 /**
  * check if smbclient is installed
  */
 public static function checkDependencies()
 {
     return (bool) \OC_Helper::findBinaryPath('smbclient') || Server::NativeAvailable() ? true : ['smbclient'];
 }
コード例 #3
0
ファイル: example.php プロジェクト: Masterfion/plugin-sonos
<?php

use Icewind\SMB\NativeServer;
use Icewind\SMB\Server;
require 'vendor/autoload.php';
if (Server::NativeAvailable()) {
    $server = new NativeServer('localhost', 'test', 'test');
} else {
    $server = new Server('localhost', 'test', 'test');
}
$share = $server->getShare('test');
$share->put(__FILE__, 'example.php');
$files = $share->dir('/');
foreach ($files as $file) {
    echo $file->getName() . "\n";
}