Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //class for interacting with files
- //
- error_reporting(E_ALL);
- ini_set('display_errors', -1);
- class Files {
- function __construct() {
- include('mysql.php');
- include('Net/SSH2.php');
- include('general.php');
- $this->database =Database::getInstance();
- $this->db = $this->database->getConnection();
- $this->host =getSetting('remote_host', $db);
- $this->ssh = new Net_SSH2($this->host);
- }
- public function listFiles($type, $location) {
- // gets a list of files remotely or locally and returns an array of them
- $remove =array('.', '..', '.present', ' '); //Files and directories to ignore in the array
- switch($type) {
- case "1":
- //get movies
- if($location =='1')
- {
- //local
- $movie_dir =getSetting('local_movie_dir');
- $movies = array_diff(scandir($movie_dir), $remove);
- return $movies;
- }
- elseif($location =='2')
- {
- //remote
- $movie_dir =getSetting('remote_movie_dir');
- }
- else
- {
- //Invalid param
- return "Invalid paramater for location";
- }
- break;
- case "2":
- //tv Shows
- if($location =='1')
- {
- //local
- $tv_dir =getSetting('local_tv_dir');
- $tv =array_diff(scandir($tv_dir), $remove);
- return $tv;
- }
- elseif($location =='2')
- {
- //remote
- $tv_dir =getSetting('remote_tv_dir');
- }
- else
- {
- //Invalid param
- return "Invalid paramater for location";
- }
- break;
- }
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement