prototype for new slingit, updated system reference

This commit is contained in:
Ulf Gebhardt 2015-10-02 08:29:20 +02:00
parent 2edb135f1b
commit 2f1c438406
10 changed files with 37 additions and 50 deletions

View File

@ -1,13 +1,9 @@
<?php <?php
require_once 'lib/system/autoload.inc'; //SYSTEM Classes require_once 'lib/autoload.inc'; //SYSTEM Classes
require_once 'slingit/autoload.inc'; //Project Classes require_once 'slingit/autoload.inc'; //Project Classes
require_once '/home/web/web/config/get_config.php'; require_once '/home/web/web/config/get_config.php';
\SYSTEM\system::start(\WEBCRAFT\get_config(dirname(__FILE__))); \SYSTEM\system::start(\WEBCRAFT\get_config(dirname(__FILE__)));
\SYSTEM\system::include_ExceptionShortcut();
\SYSTEM\system::include_ResultShortcut();
\SYSTEM\system::register_errorhandler_dbwriter();
\SYSTEM\system::register_errorhandler_jsonoutput();
echo \SYSTEM\API\api::run('\SYSTEM\API\verify','api_slingit',array_merge($_POST,$_GET)); echo \SYSTEM\API\api::run('\SYSTEM\API\verify','api_slingit',array_merge($_POST,$_GET));
new \SYSTEM\LOG\COUNTER("API was called sucessfully."); new \SYSTEM\LOG\COUNTER("API was called sucessfully.");

View File

@ -1,13 +1,9 @@
<?php <?php
require_once 'lib/system/autoload.inc'; //SYSTEM Classes require_once 'lib/autoload.inc'; //SYSTEM Classes
require_once 'slingit/autoload.inc'; //Project Classes require_once 'slingit/autoload.inc'; //Project Classes
require_once '/home/web/web/config/get_config.php'; require_once '/home/web/web/config/get_config.php';
\SYSTEM\system::start(\WEBCRAFT\get_config(dirname(__FILE__))); \SYSTEM\system::start(\WEBCRAFT\get_config(dirname(__FILE__)));
\SYSTEM\system::include_ExceptionShortcut();
\SYSTEM\system::include_ResultShortcut();
\SYSTEM\system::register_errorhandler_dbwriter();
\SYSTEM\system::register_errorhandler_jsonoutput();
echo \SYSTEM\API\api::run('\SYSTEM\API\verify', 'page_slingit', array_merge($_POST,$_GET), 1, true, true); echo \SYSTEM\API\api::run('\SYSTEM\API\verify', 'page_slingit', array_merge($_POST,$_GET), 1, true, true);
new \SYSTEM\LOG\COUNTER("Page was called sucessfully."); new \SYSTEM\LOG\COUNTER("Page was called sucessfully.");

3
lib/autoload.inc Normal file
View File

@ -0,0 +1,3 @@
<?php
require_once dirname(__FILE__).'/system/autoload.inc';
//require_once dirname(__FILE__).'/webtorrent/autoload.inc';

@ -1 +1 @@
Subproject commit 583883cfda06a2fc724a96d76ba3ade9eada06f7 Subproject commit 248e216e46b2e06fd92bc98df1b674a603c00ddd

View File

@ -1,13 +1,8 @@
<?php <?php
require_once 'lib/system/autoload.inc'; //SYSTEM Classes require_once 'lib/autoload.inc'; //SYSTEM Classes
require_once 'slingit/autoload.inc'; //Project Classes require_once 'slingit/autoload.inc'; //Project Classes
require_once '/home/web/web/config/get_config.php'; require_once '/home/web/web/config/get_config.php';
\SYSTEM\system::start(\WEBCRAFT\get_config(dirname(__FILE__))); \SYSTEM\system::start(\WEBCRAFT\get_config(dirname(__FILE__)));
SYSTEM\system::include_ExceptionShortcut(); //allow ERROR() instead of \SYSTEM\LOG\ERROR()
SYSTEM\system::include_ResultShortcut(); //allow JsonResult() instead of \SYSTEM\LOG\JsonResult()
SYSTEM\system::register_errorhandler_dbwriter(); //write errors to database (must be first errorhandler to register)
SYSTEM\system::register_errorhandler_jsonoutput(); //print errors as json to caller
$sai = new SYSTEM\SAI\saigui(); echo (new SYSTEM\SAI\saigui())->html();
echo $sai->html();

8
setup.php Normal file
View File

@ -0,0 +1,8 @@
<?php
require_once 'lib/autoload.inc'; //SYSTEM Classes
require_once 'slingit/autoload.inc'; //Project Classes
require_once '/home/web/web/config/get_config.php';
\SYSTEM\system::start(\WEBCRAFT\get_config(dirname(__FILE__)));
echo \SYSTEM\SQL\setup::install();

View File

@ -1,17 +1,16 @@
<?php <?php
class default_page extends \SYSTEM\PAGE\Page { class default_page extends \SYSTEM\PAGE\Page {
private static function js(){ private static function js(){
return '<script type="text/javascript" language="JavaScript" src="'.SYSTEM\WEBPATH(new PLIB(),'jquery/jquery-1.9.1.min.js').'"></script>'. return \SYSTEM\HTML\html::script(\LIB\lib_jquery::js()).
'<script type="text/javascript" language="JavaScript" src="'.SYSTEM\WEBPATH(new PLIB(),'bootstrap/js/bootstrap.min.js').'"></script>'. \SYSTEM\HTML\html::script(\LIB\lib_bootstrap::js()).
'<script type="text/javascript" language="JavaScript" src="'.SYSTEM\WEBPATH(new PLIB(),'webtorrent/webtorrent.min.js').'"></script>'. \SYSTEM\HTML\html::script(\SYSTEM\WEBPATH(new \PLIB(),'webtorrent/webtorrent.min.js')).
'<script type="text/javascript" language="JavaScript" src="./api.php?call=files&amp;cat=sys&amp;id=system.js"></script>'. \SYSTEM\HTML\html::script(\LIB\lib_system::js()).
'<script type="text/javascript" language="JavaScript" src="'.SYSTEM\WEBPATH(new PPAGE(),'default_page/js/default_page.js').'"></script>'; \SYSTEM\HTML\html::script(\SYSTEM\WEBPATH(new \PPAGE(),'default_page/js/default_page.js'));
} }
private static function css(){ private static function css(){
return '<link href="'.SYSTEM\WEBPATH(new PPAGE(),'default_page/css/default_page.css').'" rel="stylesheet" type="text/css">'. return \SYSTEM\HTML\html::link(\LIB\lib_bootstrap::css()).
'<link href="'.SYSTEM\WEBPATH(new PLIB(),'bootstrap/css/bootstrap.min.css').'" rel="stylesheet" type="text/css">'. \SYSTEM\HTML\html::link(\SYSTEM\WEBPATH(new \PPAGE(),'default_page/css/default_page.css'));
'<link href="'.SYSTEM\WEBPATH(new PLIB(),'bootstrap/css/bootstrap-theme.min.css').'" rel="stylesheet" type="text/css">';
} }
public function html($_escaped_fragment_ = null){ public function html($_escaped_fragment_ = null){
@ -21,6 +20,6 @@ class default_page extends \SYSTEM\PAGE\Page {
$vars['js'] = self::js();} $vars['js'] = self::js();}
$vars['css'] = self::css(); $vars['css'] = self::css();
$vars['langswitcher'] = \SYSTEM\SAI\saimod_sys_langswitcher::lang_menu(); $vars['langswitcher'] = \SYSTEM\SAI\saimod_sys_langswitcher::lang_menu();
return SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'default_page/tpl/default_page.tpl'), $vars); return \SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new \PPAGE(),'default_page/tpl/default_page.tpl'), $vars);
} }
} }

View File

@ -76,13 +76,13 @@ LogContext.prototype.log_file_done = function(torrent,url,file){
'<td>' + '<td>' +
'<a href="' + url + '"' + '<a href="' + url + '"' +
' download="' + file.name + '">' + ' download="' + file.name + '">' +
'Download ' + file.name + 'Save ' + file.name +
'</a>' + '</a>' +
'</td>' + '</td>' +
'<td>' + '<td>' +
'<a href="http://www.slingit.org/#!start;hash.' + torrent.infoHash + '"' + '<a href="http://www.slingit.org/#!start;hash.' + torrent.infoHash + '"' +
' target="_blank">' + ' target="_blank">' +
'direct link: ' + 'Share: ' +
'</a>' + '</a>' +
'</td>' + '</td>' +
'<td>' + '<td>' +

View File

@ -19,20 +19,10 @@ function init_start(){
var files = e.dataTransfer.files; // Array of all files var files = e.dataTransfer.files; // Array of all files
slingit_upload(client,files); slingit_upload(client,files);
}); });
//download
$('#btn_load_infohash').click(function(e){
if ($('#input_load_infohash').val()){
e.preventDefault();
slingit_download(client,$('#input_load_infohash').val());
} else {
$('#input_load_infohash').focus();
}});
//start download if hash provided //start download if hash provided
if($('#input_load_infohash').val() !== ''){ if($('#dropZone').attr('hash') !== ''){
slingit_download(client,$('#input_load_infohash').val());} slingit_download(client,$('#dropZone').attr('hash'));}
} }
function handleFileSelect(evt) { function handleFileSelect(evt) {
var files = evt.target.files; // FileList object var files = evt.target.files; // FileList object
@ -61,7 +51,7 @@ function log_file_start(torrent){
'<td>' + '<td>' +
'<a href="http://www.slingit.org/#!start;hash.' + torrent.infoHash + '"' + '<a href="http://www.slingit.org/#!start;hash.' + torrent.infoHash + '"' +
' target="_blank">' + ' target="_blank">' +
'direct link: ' + 'Share: ' +
'</a>' + '</a>' +
'<input type="text" value="http://www.slingit.org/#!start;hash.' + torrent.infoHash + '" onClick="this.setSelectionRange(0, this.value.length)"/>' + '<input type="text" value="http://www.slingit.org/#!start;hash.' + torrent.infoHash + '" onClick="this.setSelectionRange(0, this.value.length)"/>' +
'&nbsp;&nbsp;&nbsp;' + '&nbsp;&nbsp;&nbsp;' +
@ -84,7 +74,7 @@ function log_file_add(torrent){
'<td>' + '<td>' +
'<a href="http://www.slingit.org/#!start;hash.' + torrent.infoHash + '"' + '<a href="http://www.slingit.org/#!start;hash.' + torrent.infoHash + '"' +
' target="_blank">' + ' target="_blank">' +
'direct link: ' + 'Share: ' +
'</a>' + '</a>' +
'<input type="text" value="http://www.slingit.org/#!start;hash.' + torrent.infoHash + '" onClick="this.setSelectionRange(0, this.value.length)"/>' + '<input type="text" value="http://www.slingit.org/#!start;hash.' + torrent.infoHash + '" onClick="this.setSelectionRange(0, this.value.length)"/>' +
'&nbsp;&nbsp;&nbsp;' + '&nbsp;&nbsp;&nbsp;' +
@ -108,7 +98,7 @@ function log_file_upd(torrent){
'<td>' + '<td>' +
'<a href="http://www.slingit.org/#!start;hash.' + torrent.infoHash + '"' + '<a href="http://www.slingit.org/#!start;hash.' + torrent.infoHash + '"' +
' target="_blank">' + ' target="_blank">' +
'direct link: ' + 'Share: ' +
'</a>' + '</a>' +
'<input type="text" value="http://www.slingit.org/#!start;hash.' + torrent.infoHash + '" onClick="this.setSelectionRange(0, this.value.length)"/>' + '<input type="text" value="http://www.slingit.org/#!start;hash.' + torrent.infoHash + '" onClick="this.setSelectionRange(0, this.value.length)"/>' +
'</td>'); '</td>');
@ -140,13 +130,13 @@ function log_file_done(torrent,url,file){
'<td>' + '<td>' +
'<a href="' + url + '"' + '<a href="' + url + '"' +
' download="' + file.name + '">' + ' download="' + file.name + '">' +
'Download ' + file.name + 'Save: ' + file.name +
'</a>' + '</a>' +
'</td>' + '</td>' +
'<td>' + '<td>' +
'<a href="http://www.slingit.org/#!start;hash.' + torrent.infoHash + '"' + '<a href="http://www.slingit.org/#!start;hash.' + torrent.infoHash + '"' +
' target="_blank">' + ' target="_blank">' +
'direct link: ' + 'Share: ' +
'</a>' + '</a>' +
'<input type="text" value="http://www.slingit.org/#!start;hash.' + torrent.infoHash + '" onClick="this.setSelectionRange(0, this.value.length)"/>' + '<input type="text" value="http://www.slingit.org/#!start;hash.' + torrent.infoHash + '" onClick="this.setSelectionRange(0, this.value.length)"/>' +
'&nbsp;&nbsp;&nbsp;' + '&nbsp;&nbsp;&nbsp;' +

View File

@ -1,10 +1,10 @@
<div id="start_main"> <div id="start_main" >
<div id="dropZone"> <div id="dropZone" hash="${hash}">
<p> <p>
${center_text} ${center_text}
<a class="btn btn-primary btn-sm" href="#!start;hash.${hash}" id="btn_load_infohash"><span class="glyphicon glyphicon-download-alt"></span>&nbsp;&nbsp;${getfile}</a> <!--<a class="btn btn-primary btn-sm" href="#!start;hash.${hash}" id="btn_load_infohash"><span class="glyphicon glyphicon-download-alt"></span>&nbsp;&nbsp;${getfile}</a>
${via} ${via}
<input type="text" placeholder="#hash" id="input_load_infohash" value="${hash}"> <input type="text" placeholder="#hash" id="input_load_infohash" value="${hash}">-->
</p> </p>
</div> </div>
<table id="link_container"> <table id="link_container">