Merge branch 'master' of mojotrollz.eu:system into textapi
Conflicts: dbd/sql/mysql/data/system_api.sql
This commit is contained in:
commit
51b7c6857a
11
dbd/qq/SYS_SAIMOD_CRON.php
Normal file
11
dbd/qq/SYS_SAIMOD_CRON.php
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
namespace SYSTEM\DBD;
|
||||||
|
|
||||||
|
class SYS_SAIMOD_CRON extends \SYSTEM\DB\QQ {
|
||||||
|
protected static function query(){
|
||||||
|
return new \SYSTEM\DB\QQuery(get_class(),
|
||||||
|
//pg
|
||||||
|
'',
|
||||||
|
//mys
|
||||||
|
'SELECT * FROM system_cron ORDER BY class;'
|
||||||
|
);}}
|
||||||
13
dbd/sql/mysql/schema/system_cron.sql
Normal file
13
dbd/sql/mysql/schema/system_cron.sql
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
CREATE TABLE `system_cron` (
|
||||||
|
`class` CHAR(255) NOT NULL,
|
||||||
|
`min` INT(10) NULL DEFAULT NULL,
|
||||||
|
`hour` INT(10) NULL DEFAULT NULL,
|
||||||
|
`day` INT(10) NULL DEFAULT NULL,
|
||||||
|
`day_week` INT(10) NULL DEFAULT NULL,
|
||||||
|
`month` INT(10) NULL DEFAULT NULL,
|
||||||
|
`last_run` TIMESTAMP NULL DEFAULT NULL,
|
||||||
|
`status` INT(11) NOT NULL DEFAULT '0',
|
||||||
|
PRIMARY KEY (`class`)
|
||||||
|
)
|
||||||
|
COLLATE='utf8_general_ci'
|
||||||
|
ENGINE=InnoDB;
|
||||||
@ -21,8 +21,16 @@ class files {
|
|||||||
if (!in_array($id, $folder)) {
|
if (!in_array($id, $folder)) {
|
||||||
throw new \SYSTEM\LOG\ERROR("No matching ID '" . $id . "' found.");}
|
throw new \SYSTEM\LOG\ERROR("No matching ID '" . $id . "' found.");}
|
||||||
|
|
||||||
\SYSTEM\HEADER::PNG();
|
$ext = pathinfo(self::$folders[$cat].$id);
|
||||||
return file_get_contents(self::$folders[$cat].$id);
|
$ext = strtoupper(array_key_exists('extension', $ext) ? $ext['extension'] : '');
|
||||||
|
if(\SYSTEM\HEADER::available($ext)){
|
||||||
|
call_user_func('\SYSTEM\HEADER::'.$ext);
|
||||||
|
}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) {
|
||||||
@ -57,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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -3,51 +3,16 @@ namespace SYSTEM\SAI;
|
|||||||
|
|
||||||
class saimod_sys_cron extends \SYSTEM\SAI\SaiModule {
|
class saimod_sys_cron extends \SYSTEM\SAI\SaiModule {
|
||||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_cron(){
|
public static function sai_mod__SYSTEM_SAI_saimod_sys_cron(){
|
||||||
//$last_group = -1;
|
|
||||||
$vars = array();
|
$vars = array();
|
||||||
|
$vars['tabopts'] = \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_cron/tabopt.tpl'), array());
|
||||||
|
$vars['content'] = '';
|
||||||
|
|
||||||
$con = new \SYSTEM\DB\Connection(\SYSTEM\system::getSystemDBInfo());
|
$res = \SYSTEM\DBD\SYS_SAIMOD_CRON::QQ();
|
||||||
if(\SYSTEM\system::isSystemDbInfoPG()){
|
|
||||||
$res = $con->query('SELECT "group", count(*) as "count" FROM system.api GROUP BY "group" ORDER BY "group" ASC;');
|
|
||||||
} else {
|
|
||||||
$res = $con->query('SELECT `group`, count(*) as `count` FROM system_api GROUP BY `group` ORDER BY `group` ASC;');
|
|
||||||
}
|
|
||||||
|
|
||||||
$vars['tabopts'] = '';
|
|
||||||
$first = true;
|
|
||||||
while($r = $res->next()){
|
while($r = $res->next()){
|
||||||
$vars2 = array( 'active' => ($first ? 'active' : ''),
|
$vars['content'] .= \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_cron/list_entry.tpl'), $r);}
|
||||||
'tab_id' => $r['group']);
|
|
||||||
$first = false;
|
$vars['tabs'] = \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_cron/tab.tpl'), $vars);
|
||||||
$vars['tabopts'] .= \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_cron/tabopt.tpl'), $vars2);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(\SYSTEM\system::isSystemDbInfoPG()){
|
|
||||||
$res = $con->query('SELECT * FROM system.api ORDER BY "group", "ID" ASC;');
|
|
||||||
} else {
|
|
||||||
$res = $con->query('SELECT * FROM system_api ORDER BY `group`, `ID` ASC;');
|
|
||||||
}
|
|
||||||
|
|
||||||
while($r = $res->next()){
|
|
||||||
$tabs[$r['group']]['tab_id'] = $r['group'];
|
|
||||||
$tabs[$r['group']]['content'] = isset($tabs[$r['group']]['content']) ? $tabs[$r['group']]['content'] : '';
|
|
||||||
$r['tr_class'] = self::tablerow_class($r['type']);
|
|
||||||
$r['type'] = self::type_names($r['type']);
|
|
||||||
$tabs[$r['group']]['content'] .= \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_cron/list_entry.tpl'), $r);
|
|
||||||
}
|
|
||||||
|
|
||||||
$vars['tabs'] = '';
|
|
||||||
$first = true;
|
|
||||||
foreach($tabs as $tab){
|
|
||||||
$tab['active'] = ($first ? 'active' : '');
|
|
||||||
$first = false;
|
|
||||||
$vars['tabs'] .= \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_cron/tab.tpl'), $tab);}
|
|
||||||
|
|
||||||
return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_cron/tabs.tpl'), $vars);
|
return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_cron/tabs.tpl'), $vars);
|
||||||
|
|
||||||
/* $result = "";
|
|
||||||
$result .= '<tr class="'.self::tablerow_class($r['type']).'">'.'<td>'.$r['ID'].'</td>'.'<td>'.$r['group'].'</td>'.'<td>'.$r['type'].'</td>'.'<td>'.$r['parentID'].'</td>'.'<td>'.$r['parentValue'].'</td>'.'<td>'.$r['name'].'</td>'.'<td>'.$r['verify'].'</td>'.'</tr>';
|
|
||||||
return $result;*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function sai_mod__system_sai_saimod_sys_api_action_deletedialog($ID){
|
public static function sai_mod__system_sai_saimod_sys_api_action_deletedialog($ID){
|
||||||
@ -69,17 +34,6 @@ class saimod_sys_cron extends \SYSTEM\SAI\SaiModule {
|
|||||||
return \SYSTEM\LOG\JsonResult::ok();
|
return \SYSTEM\LOG\JsonResult::ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function type_names($type){
|
|
||||||
switch($type){
|
|
||||||
case 0: return 'COMMAND';
|
|
||||||
case 1: return 'COMMAND_FLAG';
|
|
||||||
case 2: return 'PARAMETER';
|
|
||||||
case 3: return 'PARAMETER_OPT';
|
|
||||||
case 4: return 'STATIC';
|
|
||||||
default: return 'Problem unknown type';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static function tablerow_class($flag){
|
private static function tablerow_class($flag){
|
||||||
switch($flag){
|
switch($flag){
|
||||||
case 0: return 'info';
|
case 0: return 'info';
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
<div class="tab-pane ${active}" id="tab_${tab_id}">
|
<div class="tab-pane active" id="tab_cron">
|
||||||
<table class="table table-hover table-condensed" style="overflow: auto;">
|
<table class="table table-hover table-condensed" style="overflow: auto;">
|
||||||
<tr>
|
<tr>
|
||||||
<th>class</th>
|
<th>class</th>
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
<li class="${active}"><a href="#tab_${tab_id}">Group ${tab_id}</a></li>
|
<li class="active"><a href="#tab_cron">Cron</a></li>
|
||||||
@ -3,7 +3,7 @@
|
|||||||
<hr>
|
<hr>
|
||||||
<div id="cron_content">
|
<div id="cron_content">
|
||||||
<div class="tabbable">
|
<div class="tabbable">
|
||||||
<ul class="nav nav-tabs" id="localetab">
|
<ul class="nav nav-tabs" id="crontab">
|
||||||
${tabopts}
|
${tabopts}
|
||||||
</ul>
|
</ul>
|
||||||
<div class="tab-content">
|
<div class="tab-content">
|
||||||
|
|||||||
@ -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,19 +77,23 @@ 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');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
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",
|
||||||
|
|||||||
@ -74,7 +74,7 @@ class saimod_sys_locale extends \SYSTEM\SAI\SaiModule {
|
|||||||
|
|
||||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_locale_action_add($id, $category){
|
public static function sai_mod__SYSTEM_SAI_saimod_sys_locale_action_add($id, $category){
|
||||||
return \SYSTEM\DBD\SYS_SAIMOD_LOCALE_ADD::QI(array($id, $category)) ? \SYSTEM\LOG\JsonResult::ok() : \SYSTEM\LOG\JsonResult::error(new \SYSTEM\LOG\WARNING("no data added"));}
|
return \SYSTEM\DBD\SYS_SAIMOD_LOCALE_ADD::QI(array($id, $category)) ? \SYSTEM\LOG\JsonResult::ok() : \SYSTEM\LOG\JsonResult::error(new \SYSTEM\LOG\WARNING("no data added"));}
|
||||||
|
|
||||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_locale_action_delete($id){
|
public static function sai_mod__SYSTEM_SAI_saimod_sys_locale_action_delete($id){
|
||||||
return \SYSTEM\DBD\SYS_SAIMOD_LOCALE_DEL::QI(array($id)) ? \SYSTEM\LOG\JsonResult::ok() : \SYSTEM\LOG\JsonResult::error(new \SYSTEM\LOG\WARNING("could not delete the permitted data"));}
|
return \SYSTEM\DBD\SYS_SAIMOD_LOCALE_DEL::QI(array($id)) ? \SYSTEM\LOG\JsonResult::ok() : \SYSTEM\LOG\JsonResult::error(new \SYSTEM\LOG\WARNING("could not delete the permitted data"));}
|
||||||
|
|
||||||
|
|||||||
@ -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;
|
||||||
@ -15,10 +14,25 @@ class HEADER {
|
|||||||
public static function JSON(){
|
public static function JSON(){
|
||||||
if(self::checkHeader()){
|
if(self::checkHeader()){
|
||||||
header('Access-Control-Allow-Origin: *');//allow cross domain calls
|
header('Access-Control-Allow-Origin: *');//allow cross domain calls
|
||||||
header('content-type: application/json');}
|
header('content-type: application/json');}}
|
||||||
}
|
|
||||||
public static function PNG(){
|
public static function PNG(){
|
||||||
if(self::checkHeader()){
|
if(self::checkHeader()){
|
||||||
header('content-type:image/png;');}
|
header('content-type:image/png;');}}
|
||||||
}
|
public static function JPG(){
|
||||||
|
if(self::checkHeader()){
|
||||||
|
header('content-type:image/jpeg;');}}
|
||||||
|
public static function JPEG(){
|
||||||
|
if(self::checkHeader()){
|
||||||
|
header('content-type:image/jpeg;');}}
|
||||||
|
public static function GIF(){
|
||||||
|
if(self::checkHeader()){
|
||||||
|
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){
|
||||||
|
$datatype = strtoupper($datatype);
|
||||||
|
return \method_exists('\SYSTEM\HEADER', $datatype);}
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user