Merge branch 'master' of mojotrollz.eu:hosting

Conflicts:
	slingit/slingit/page/page_slingit.php
This commit is contained in:
Naeltard 2015-04-08 16:07:01 +02:00
commit 57ddfd103c
12 changed files with 59 additions and 93 deletions

View File

@ -8,10 +8,9 @@ $slingit_config=array(array(\SYSTEM\CONFIG\config_ids::SYS_CONFIG_ERRORREPORTING
array(\SYSTEM\CONFIG\config_ids::SYS_CONFIG_DB_USER, 'mojotrolls_mysql'),
array(\SYSTEM\CONFIG\config_ids::SYS_CONFIG_DB_PASSWORD, 'dajsabeaisvd345'),
array(\SYSTEM\CONFIG\config_ids::SYS_CONFIG_DB_DBNAME, 'host_slingit'),
array(\SYSTEM\CONFIG\config_ids::SYS_SAI_CONFIG_NAVIMG, '/web/system/sai/page/img/logo.png'),//not working, cuz paths are not set yet! \SYSTEM\WEBPATH(new \SYSTEM\PSAI(),'page/default_page/img/logo.png')),
array(\SYSTEM\CONFIG\config_ids::SYS_SAI_CONFIG_BASEURL, 'http://www.slingit.org/sai.php?'),
array(\SYSTEM\CONFIG\config_ids::SYS_SAI_CONFIG_TITLE, 'Slingit - Admin Bereich'),
array(\SYSTEM\CONFIG\config_ids::SYS_SAI_CONFIG_COPYRIGHT, '<a href="http://www.slingit.org/" target="_blank"></a> &copy; WebCraft Media 2013'),
array(\SYSTEM\CONFIG\config_ids::SYS_SAI_CONFIG_COPYRIGHT, '<a href="http://www.slingit.org/" target="_blank"></a> &copy; WebCraft Media 2015'),
array(\SYSTEM\CONFIG\config_ids::SYS_SAI_CONFIG_PROJECT, 'slingit'),
array(\SYSTEM\CONFIG\config_ids::SYS_CONFIG_PATH_SYSTEMPATHREL, 'lib/system/'),
array(\SYSTEM\CONFIG\config_ids::SYS_CONFIG_LANGS, array('deDE','enUS', 'frFR', 'esES', 'trTR', 'jaJA')),
array(\SYSTEM\CONFIG\config_ids::SYS_CONFIG_DEFAULT_LANG, 'deDE'),

View File

@ -9,5 +9,5 @@ require_once 'config.php';
\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)->html();
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.");

Binary file not shown.

After

Width:  |  Height:  |  Size: 673 B

View File

@ -14,10 +14,12 @@ body{}
#content {}
#footer {
#footer {
position: absolute;
height: 20px;
bottom: 0;
bottom: 0px;
left: 0;
right: 0;
text-align: center;
width: 100%;
background: whitesmoke;

View File

@ -1,29 +1,26 @@
<?php
class default_page extends \SYSTEM\PAGE\Page {
private 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>'.
'<script type="text/javascript" language="JavaScript" src="'.SYSTEM\WEBPATH(new PLIB(),'bootstrap/js/bootstrap.min.js').'"></script>'.
'<script src="'.SYSTEM\WEBPATH(new PLIB(),'webtorrent/webtorrent.min.js').'"></script>'.
//'<script type="text/javascript" language="JavaScript" src="'.SYSTEM\WEBPATH(new PLIB(),'jqbootstrapvalidation/jqBootstrapValidation.js').'"></script>'.
//'<script type="text/javascript" language="JavaScript" src="'.SYSTEM\WEBPATH(new PLIB(),'hashmask/jquery.md5.js').'"></script>'.
//'<script type="text/javascript" language="JavaScript" src="'.SYSTEM\WEBPATH(new PLIB(),'hashmask/jquery.sha1.js').'"></script>'.
'<script type="text/javascript" language="JavaScript" src="'.SYSTEM\WEBPATH(new PLIB(),'webtorrent/webtorrent.min.js').'"></script>'.
'<script type="text/javascript" language="JavaScript" src="./api.php?call=files&cat=sys&id=system.js"></script>'.
'<script src="'.SYSTEM\WEBPATH(new PPAGE(),'default_page/js/default_page.js').'"></script>'.
'<script src="'.SYSTEM\WEBPATH(new PPAGE(),'default_page/js/lang_switcher.js').'"></script>';
'<script type="text/javascript" language="JavaScript" src="'.SYSTEM\WEBPATH(new PPAGE(),'default_page/js/default_page.js').'"></script>';
}
private function css(){
private static function css(){
return '<link href="'.SYSTEM\WEBPATH(new PPAGE(),'default_page/css/default_page.css').'" rel="stylesheet">'.
'<link href="'.SYSTEM\WEBPATH(new PLIB(),'bootstrap/css/bootstrap.min.css').'" rel="stylesheet">'.
'<link href="'.SYSTEM\WEBPATH(new PLIB(),'bootstrap/css/bootstrap-theme.min.css').'" rel="stylesheet">'.
'<link href="'.SYSTEM\WEBPATH(new PLIB(),'bootstrap/css/bootstrap-responsive.min.css').'" rel="stylesheet">';
}
public function html(){
$vars = array();
$vars['js'] = $this->js();
$vars['css'] = $this->css();
public function html($_escaped_fragment_ = null){
$vars = array();
$vars['js'] = '';
if(!$_escaped_fragment_){
$vars['js'] = self::js();}
$vars['css'] = self::css();
$vars['PATH_LOCAL_IMG'] = \SYSTEM\WEBPATH(new \SYSTEM\PSAI(),'page/img/');
return SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'default_page/tpl/default_page.tpl'), $vars);

View File

@ -1,3 +1,7 @@
$(document).ready(function() {
new SYSTEM('./api.php',1,'start');
$('#about').click(function(){
$('#modal_text').modal('show');});
$('#impressum').click(function(){
$('#modal_text').modal('show');});
});

View File

@ -1,30 +0,0 @@
function switchLocale(locale){
reloadWithQueryStringVars({"_lang": locale});
}
function reloadWithQueryStringVars (queryStringVars) {
var existingQueryVars = location.search ? location.search.substring(1).split("&") : [],
//currentUrl = location.search ? location.href.replace(location.search,"") : location.href,
newQueryVars = {},
newUrl = "http://www.slingit.org/?_lang="+queryStringVars._lang+"#";
if(existingQueryVars.length > 0) {
for (var i = 0; i < existingQueryVars.length; i++) {
var pair = existingQueryVars[i].split("=");
newQueryVars[pair[0]] = pair[1];
}
}
if(queryStringVars) {
for (var queryStringVar in queryStringVars) {
newQueryVars[queryStringVar] = queryStringVars[queryStringVar];
}
}
if(newQueryVars) {
for (var newQueryVar in newQueryVars) {
newUrl += newQueryVar + "=" + newQueryVars[newQueryVar] + "&";
}
newUrl = newUrl.substring(0, newUrl.length-1);
window.location.href = newUrl;
} else {
window.location.href = location.href;
}
}

View File

@ -2,8 +2,10 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<meta name="description" content="Peer to Peer Filesharing without additional Software">
<meta name="keywords" content="p2p,torrent,friend2friend,webtorrent,feross,filesharing">
<meta name="author" content="Webcraft-Media.de">
<title>SlingiT</title>
${css}
${js}
</head>
@ -24,8 +26,8 @@
<div id="footer">
<a href="#!about" id="about">About</a>&nbsp;
<a href="#!impressum" id="impressum">Impressum</a>&nbsp;
<a href="javascript:switchLocale('deDE');"><img src="${PATH_LOCAL_IMG}flag_germany.png" alt="Deutsch"></a>&nbsp;
<a href="javascript:switchLocale('enUS');"><img src="${PATH_LOCAL_IMG}flag_usa.png" alt="English"></a>&nbsp;
<a href="javascript:system.language('deDE');"><img src="${PATH_LOCAL_IMG}flag_germany.png" alt="Deutsch" width="16" height="11"></a>&nbsp;
<a href="javascript:system.language('enUS');"><img src="${PATH_LOCAL_IMG}flag_usa.png" alt="English" width="16" height="11"></a>&nbsp;
</div>
</body>
</html>

View File

@ -14,7 +14,7 @@
list-style-type: none;
}
#dropZone p, #pullZone p{
#dropZone p{
position:relative;
top:45%;
left:0;
@ -22,14 +22,6 @@
text-align: center;
}
#pullZone{
width: 400px;
height: 400px;
float: left;
outline: 3px solid #eee;
margin-left: 15px;
}
#link_container {
padding-top: 40px;
font-size: 8pt;

View File

@ -12,7 +12,7 @@ class default_start extends SYSTEM\PAGE\Page {
return array( \SYSTEM\WEBPATH(new PPAGE(),'default_start/css/default_start.css'));}
public function html(){
$vars = array();
$vars['hash'] = $this->hash == '${hash}' ? '' : $this->hash;
$vars['hash'] = $this->hash ? $this->hash : '';
$vars = array_merge($vars, \SYSTEM\locale::getStrings(DBD\locale_string::VALUE_CATEGORY_MAINPAGE),
\SYSTEM\locale::getStrings(DBD\locale_string::VALUE_CATEGORY_TEXT));
return SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'default_start/tpl/default_start.tpl'), $vars);

View File

@ -1,8 +1,6 @@
var client = new WebTorrent({
rtcConfig: { iceServers:
[{url: "stun:23.21.150.121"},
{url: "stun:stun.1.google.com:19302"}]
}
rtcConfig: { iceServers: [ {url: "stun:23.21.150.121"},
{url: "stun:stun.1.google.com:19302"}]}
});
function init_start(){
@ -28,7 +26,7 @@ function init_start(){
slingit_download(client,$('#input_load_infohash').val());});
//start download if hash provided
if($('#input_load_infohash').val() != ''){
if($('#input_load_infohash').val() !== ''){
slingit_download(client,$('#input_load_infohash').val());}
}
function handleFileSelect(evt) {
@ -46,6 +44,7 @@ function handleFileSelect(evt) {
}
function log_file_start(torrent){
$('#init_loader').hide();
$('#link_container tr:last').after(
'<tr>' +
'<td>' +
@ -67,7 +66,8 @@ function log_file_start(torrent){
}
function log_file_add(torrent){
var progress = (100 * torrent.downloaded / torrent.parsedTorrent.length).toFixed(1)
$('#init_loader').hide();
var progress = (100 * torrent.downloaded / torrent.parsedTorrent.length).toFixed(1);
$('#link_container tr:last').after(
'<tr id="' + torrent.infoHash + '">' +
'<td>' +
@ -90,8 +90,9 @@ $.getScript("http://platform.twitter.com/widgets.js");
}
function log_file_upd(torrent){
$('#init_loader').hide();
if($('#'+torrent.infoHash).length){
var progress = (100 * torrent.downloaded / torrent.parsedTorrent.length).toFixed(1)
var progress = (100 * torrent.downloaded / torrent.parsedTorrent.length).toFixed(1);
$('#'+torrent.infoHash).html(
'<td>' +
progress + '%' +
@ -105,9 +106,7 @@ function log_file_upd(torrent){
'direct link: ' +
'</a>' +
'<input type="text" value="http://www.slingit.org/#!start;hash.' + torrent.infoHash + '" onClick="this.setSelectionRange(0, this.value.length)"/>' +
'&nbsp;&nbsp;&nbsp;' +
'<a class="twitter-share-button" href="https://twitter.com/share" data-via="slingtweet" data-url="http://www.slingit.org/#!start;hash.' + torrent.infoHash + '">Tweet</a>' +
'</td>')
'</td>');
} else {
log_file_add(torrent);
}
@ -116,6 +115,7 @@ function log_initialize() {
$('#link_container tr:last').after(
'<tr>' +
'<td>' +
'<img id="init_loader" src="./api.php?call=files&cat=img&id=loader.gif" alt="..."/>&nbsp;'+
'initializing' +
'</td>' +
'<td>' + '</td>' +
@ -125,6 +125,7 @@ function log_initialize() {
}
function log_file_done(torrent,url,file){
$('#init_loader').hide();
log_file_upd(torrent);
$('#link_container tr:last').after(
'<tr>' +
@ -147,20 +148,20 @@ function log_file_done(torrent,url,file){
'<a class="twitter-share-button" href="https://twitter.com/share" data-via="slingtweet" data-url="http://www.slingit.org/#!start;hash.' + torrent.infoHash + '">Tweet</a>' +
'</td>' +
'</tr>');
$.getScript("http://platform.twitter.com/widgets.js");
}
function slingit_upload(client,files){
log_initialize();
var fileStore = new Array();
console.log(files)
console.log(files);
for (var i=0, file; file=files[i]; i++) {
var reader = new FileReader();
reader.onload = function(e2) { // finished reading file data.
}
reader.onload = function(e2) {}; // finished reading file data.
reader.readAsDataURL(file); // start reading the file data.
fileStore.push(file);
console.log(file);
var fname = file.name
var fname = file.name;
client.seed(file,onTorrent);
}
}
@ -171,11 +172,11 @@ function onTorrent (torrent) {
torrent.swarm.on('download', function () {
log_file_upd(torrent);
})
});
torrent.swarm.on('upload', function () {
log_file_upd(torrent);
})
});
torrent.files.forEach(function (file) {
/*var extname = path.extname(file.name)
@ -191,11 +192,11 @@ function onTorrent (torrent) {
file.createReadStream().pipe(audio)
} else {*/
file.getBlobURL(function (err, url) {
if (err) throw err
if (err) throw err;
log_file_done(torrent,url,file);
})
});
//}
})
});
}
function slingit_download(client,hash){

View File

@ -1,20 +1,19 @@
<?php
class page_slingit extends \SYSTEM\API\api_default {
public static function get_class(){
return self::class;}
public static function get_apigroup(){
return 1;}
public static function get_class($params = null){
return self::class;}
public static function default_page(){
return new default_page();}
public static function default_page($_escaped_fragment_ = null){
return (new default_page())->html($_escaped_fragment_);}
public static function page_start($hash){
return new default_start($hash);}
public static function page_start($hash = null){
return (new default_start($hash))->html();}
public static function page_about(){
return new default_about('');}
return (new default_about(''))->html();}
public static function page_impressum(){
return new default_impressum('');}
public static function page_status(){
return new default_status('');}
return (new default_impressum(''))->html();}
}