<?php 
##
#	Project: PHPDISK File Storage Solution
#	This is NOT a freeware, use is subject to license terms.
#
#	Site: http://www.phpdisk.com
#
#	$Id: install.inc.php 121 2014-03-04 12:38:05Z along $
#
#	Copyright (C) 2008-2016 PHPDisk Team. All Rights Reserved.
#
##
if(!defined('IN_PHPDISK')) {
	exit('[PHPDisk] Access Denied');
}
function install_plugin(){
	global $db,$tpf,$db_charset;
	$sql = "CREATE TABLE IF NOT EXISTS `{$tpf}ftp` (
  `userid` int(10) unsigned NOT NULL DEFAULT '0',
  `ftp_locked` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `ftp_user` varchar(50) NOT NULL,
  `ftp_pwd` varchar(50) NOT NULL,
  `ftp_host` varchar(50) NOT NULL,
  `ftp_port` varchar(10) NOT NULL,
  `ftp_path` varchar(255) NOT NULL,
  `file_host` varchar(255) NOT NULL,
  `last_time` int(10) unsigned NOT NULL DEFAULT '0',
  `server_oid` SMALLINT( 5 ) UNSIGNED NOT NULL DEFAULT '0',
  PRIMARY KEY (`userid`)
) ENGINE=MyISAM DEFAULT CHARSET=$db_charset;";
	$db->query($sql);

	$sql = "CREATE TABLE IF NOT EXISTS `{$tpf}ftp_log` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `userid` int(10) unsigned NOT NULL DEFAULT '0',
  `file_name` varchar(255) NOT NULL,
  `file_size` int(10) unsigned NOT NULL DEFAULT '0',
  `start_time` int(10) unsigned NOT NULL DEFAULT '0',
  `done_time` int(10) unsigned NOT NULL DEFAULT '0',
  `ftp_path` varchar(255) NOT NULL,
  `ip` varchar(15) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `userid` (`userid`),
  KEY `done_time` (`done_time`),
  KEY `start_time` (`start_time`)
) ENGINE=MyISAM  DEFAULT CHARSET=$db_charset;";
	$db->query($sql);
	
	return true;
}
function uninstall_plugin(){
	global $db,$tpf;
	$db->query("DROP TABLE IF EXISTS `{$tpf}ftp`;");
	$db->query("DROP TABLE IF EXISTS `{$tpf}ftp_log`;");
	return true;
}
?>