Merge branch 'master' of mojotrollz.eu:system
This commit is contained in:
commit
cc50108991
@ -24,8 +24,13 @@ class files {
|
|||||||
$ext = pathinfo(self::$folders[$cat].$id);
|
$ext = pathinfo(self::$folders[$cat].$id);
|
||||||
$ext = strtoupper(array_key_exists('extension', $ext) ? $ext['extension'] : '');
|
$ext = strtoupper(array_key_exists('extension', $ext) ? $ext['extension'] : '');
|
||||||
if(\SYSTEM\HEADER::available($ext)){
|
if(\SYSTEM\HEADER::available($ext)){
|
||||||
call_user_func('\SYSTEM\HEADER::'.$ext);}
|
call_user_func('\SYSTEM\HEADER::'.$ext);
|
||||||
return file_get_contents(self::$folders[$cat].$id);
|
}else{
|
||||||
|
\SYSTEM\HEADER::FILE($id);}
|
||||||
|
|
||||||
|
if(!self::file_get_contents_chunked(self::$folders[$cat].$id,4096,function($chunk,&$handle,$iteration){echo $chunk;})){
|
||||||
|
throw new \SYSTEM\LOG\ERROR("Could not transfere File.");}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function put($cat, $id, $contents) {
|
public static function put($cat, $id, $contents) {
|
||||||
@ -60,4 +65,17 @@ class files {
|
|||||||
|
|
||||||
public static function getURL($cat, $id = null) {
|
public static function getURL($cat, $id = null) {
|
||||||
return \SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_CONFIG_PATH_BASEURL) . 'api.php?call=files&cat=' . $cat . '&id=' . $id;}
|
return \SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_CONFIG_PATH_BASEURL) . 'api.php?call=files&cat=' . $cat . '&id=' . $id;}
|
||||||
|
|
||||||
|
private static function file_get_contents_chunked($file,$chunk_size,$callback)
|
||||||
|
{
|
||||||
|
$handle = fopen($file, "r");
|
||||||
|
$i = 0;
|
||||||
|
while (!feof($handle))
|
||||||
|
{
|
||||||
|
call_user_func_array($callback,array(fread($handle,$chunk_size),&$handle,$i));
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
fclose($handle);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -25,6 +25,8 @@ function init__SYSTEM_SAI_saimod_sys_locale() {
|
|||||||
$('#newtext').click(function(){
|
$('#newtext').click(function(){
|
||||||
$('#addtext').show();
|
$('#addtext').show();
|
||||||
saimod_sys_locale_savenewcontent();
|
saimod_sys_locale_savenewcontent();
|
||||||
|
$('#new_text_id_input').val('');
|
||||||
|
$('#new_category_id_input').val('');
|
||||||
cData.editmode = false;});
|
cData.editmode = false;});
|
||||||
|
|
||||||
$('.groups').click(function(){
|
$('.groups').click(function(){
|
||||||
@ -75,12 +77,13 @@ function saimod_sys_locale_newtext(){
|
|||||||
type: 'GET',
|
type: 'GET',
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
$('#contenttextarea').text('');
|
$('#contenttextarea').text('');
|
||||||
$('#new_text_id').attr('placeholder', 'new title here...').blur();
|
$('#new_category_id input').attr('value', cData.group);
|
||||||
|
$('#new_category_id').show();
|
||||||
$('#new_text_id').show();
|
$('#new_text_id').show();
|
||||||
$('#newtext').show();
|
$('#newtext').show();
|
||||||
$('#changetext').hide();
|
$('#changetext').hide();
|
||||||
$('#newcontenttextarea').hide();
|
$('#newcontenttextarea').hide();
|
||||||
$('#modal').modal('show');
|
$('#modal_main').modal('show');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -88,6 +91,9 @@ function saimod_sys_locale_newtext(){
|
|||||||
function saimod_sys_locale_savecontent(id, lang){
|
function saimod_sys_locale_savecontent(id, lang){
|
||||||
tinyMCE.triggerSave();
|
tinyMCE.triggerSave();
|
||||||
newtext = $('#contenttextarea').val();
|
newtext = $('#contenttextarea').val();
|
||||||
|
newgroup = $('#new_category_id_input').val();
|
||||||
|
console.log($('#new_category_id_input'));
|
||||||
|
console.log(newgroup);
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: SAI_ENDPOINT,
|
url: SAI_ENDPOINT,
|
||||||
data: { sai_mod: '.SYSTEM.SAI.saimod_sys_locale',
|
data: { sai_mod: '.SYSTEM.SAI.saimod_sys_locale',
|
||||||
@ -112,10 +118,10 @@ function saimod_sys_locale_savecontent(id, lang){
|
|||||||
|
|
||||||
function saimod_sys_locale_savenewcontent(){
|
function saimod_sys_locale_savenewcontent(){
|
||||||
tinyMCE.triggerSave();
|
tinyMCE.triggerSave();
|
||||||
newtext = $('#contenttextarea').val();
|
id = $('#new_text_id_input').val();
|
||||||
id = $('#new_text_id').val();
|
cData.group = $('#new_category_id_input').val();
|
||||||
console.log("id "+id);
|
console.log("id: "+id);
|
||||||
category = cData.group;
|
console.log("category: "+cData.group);
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: SAI_ENDPOINT,
|
url: SAI_ENDPOINT,
|
||||||
data: { sai_mod: '.SYSTEM.SAI.saimod_sys_locale',
|
data: { sai_mod: '.SYSTEM.SAI.saimod_sys_locale',
|
||||||
@ -132,6 +138,7 @@ function saimod_sys_locale_savenewcontent(){
|
|||||||
|
|
||||||
function saimod_sys_locale_loadsinglecontent(id, lang){
|
function saimod_sys_locale_loadsinglecontent(id, lang){
|
||||||
$('#new_text_id').hide();
|
$('#new_text_id').hide();
|
||||||
|
$('#new_category_id').hide();
|
||||||
$('#newtext').hide();
|
$('#newtext').hide();
|
||||||
$('#modaltextarea').show();
|
$('#modaltextarea').show();
|
||||||
$('#changetext').show();
|
$('#changetext').show();
|
||||||
@ -152,7 +159,7 @@ function saimod_sys_locale_loadsinglecontent(id, lang){
|
|||||||
$('#modaltitle').html(id);
|
$('#modaltitle').html(id);
|
||||||
$('#modaltitle').show();
|
$('#modaltitle').show();
|
||||||
cData.id = id;
|
cData.id = id;
|
||||||
$('#modal').modal('show');
|
$('#modal_main').modal('show');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -173,15 +180,16 @@ function saimod_sys_locale_delete(buttonID){
|
|||||||
saimod_sys_locale_loadcontent(cData.lang,cData.group);}});
|
saimod_sys_locale_loadcontent(cData.lang,cData.group);}});
|
||||||
|
|
||||||
saimod_sys_locale_loadcontent(cData.lang,cData.group);
|
saimod_sys_locale_loadcontent(cData.lang,cData.group);
|
||||||
$('#modal').modal('hide');
|
$('#modal_main').modal('hide');
|
||||||
}
|
}
|
||||||
|
|
||||||
function init_tinymce(){
|
function init_tinymce(){
|
||||||
tinymce.init({ // General options
|
tinymce.init({ // General options
|
||||||
mode : "textareas",
|
mode : "textareas",
|
||||||
theme : "modern",
|
theme : "modern",
|
||||||
plugins : "anchor,bbcode,charmap,code,contextmenu,directionality,link,textcolor,table,hr,fullscreen,autolink,lists,spellchecker,pagebreak,layer,table,save,emoticons,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,template",
|
|
||||||
|
|
||||||
|
formats : {
|
||||||
|
italic : {inline : 'span', 'classes' : 'italic'}},
|
||||||
// Theme options
|
// Theme options
|
||||||
theme_modern_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect",
|
theme_modern_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect",
|
||||||
theme_modern_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
|
theme_modern_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
|
||||||
|
|||||||
@ -10,12 +10,19 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="editfield">
|
<div id="editfield">
|
||||||
<div class="modal fade" id="modal" style="width: 700px;" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
<div class="modal fade" id="modal_main" style="width: 700px;" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
||||||
<div class="modal-dialog">
|
<div class="modal-dialog">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<h4 class="modal-title" id="modaltitle">${id}</h4>
|
<h4 class="modal-title" id="modaltitle">${id}</h4>
|
||||||
<input type="text" id="new_text_id" placeholder="new title here..." style="display: none;" />
|
<div id="new_category_id" style="display: none;">
|
||||||
|
<h5>Category ID</h5>
|
||||||
|
<input id="new_category_id_input" type="text" placeholder="New category ID here..."/>
|
||||||
|
</div>
|
||||||
|
<div id="new_text_id" style="display: none;">
|
||||||
|
<h5>Text ID</h5>
|
||||||
|
<input id="new_text_id_input" type="text" placeholder="New text ID here..."/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="addtext" style="display: none;">
|
<div id="addtext" style="display: none;">
|
||||||
<div class="tabbable">
|
<div class="tabbable">
|
||||||
|
|||||||
@ -2,7 +2,6 @@
|
|||||||
namespace SYSTEM;
|
namespace SYSTEM;
|
||||||
|
|
||||||
class HEADER {
|
class HEADER {
|
||||||
|
|
||||||
private static function checkHeader(){
|
private static function checkHeader(){
|
||||||
$file = null;
|
$file = null;
|
||||||
$line = null;
|
$line = null;
|
||||||
@ -29,6 +28,10 @@ class HEADER {
|
|||||||
if(self::checkHeader()){
|
if(self::checkHeader()){
|
||||||
header('content-type:image/gif;');}}
|
header('content-type:image/gif;');}}
|
||||||
|
|
||||||
|
public static function FILE($filename){
|
||||||
|
header("Content-type: application/octet-stream");
|
||||||
|
header("Content-Disposition: attachment; filename=\"".$filename."\"");}
|
||||||
|
|
||||||
public static function available($datatype){
|
public static function available($datatype){
|
||||||
$datatype = strtoupper($datatype);
|
$datatype = strtoupper($datatype);
|
||||||
return \method_exists('\SYSTEM\HEADER', $datatype);}
|
return \method_exists('\SYSTEM\HEADER', $datatype);}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user