mirror of
https://github.com/xevidos/codiad.git
synced 2024-11-10 21:26:35 +01:00
Split unfinished tasks module into new branch for continued development
This commit is contained in:
parent
ece26c9c1e
commit
36b6574639
@ -1,107 +0,0 @@
|
||||
<?php
|
||||
|
||||
require_once('../../common.php');
|
||||
|
||||
class Tasks {
|
||||
|
||||
function __construct() {}
|
||||
|
||||
static function build_command( $command, $arguments = array() ) {
|
||||
|
||||
$query = "";
|
||||
$query .= "& echo $!";
|
||||
return $query;
|
||||
}
|
||||
|
||||
public static function create_task( $command, $arguments = array() ) {
|
||||
|
||||
$return = array(
|
||||
"status" => "none",
|
||||
"message" => "",
|
||||
);
|
||||
$command = self::build_command( $command, $arguments );
|
||||
|
||||
if( function_exists( "exec" ) ) {
|
||||
|
||||
|
||||
} elseif( function_exists( "shell_exec" ) ) {
|
||||
|
||||
|
||||
} elseif( function_exists( "system" ) ) {
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
$return["status"] = "error";
|
||||
$return["message"] = "Could not find an enabled shell execution function.";
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
public static function get_task( $id ) {
|
||||
|
||||
$return = array(
|
||||
"status" => "none",
|
||||
"message" => "",
|
||||
);
|
||||
|
||||
if( is_numeric( $id ) ) {
|
||||
|
||||
if( function_exists( "exec" ) ) {
|
||||
|
||||
|
||||
} elseif( function_exists( "shell_exec" ) ) {
|
||||
|
||||
|
||||
} elseif( function_exists( "system" ) ) {
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
$return["status"] = "error";
|
||||
$return["message"] = "Could not find an enabled shell execution function.";
|
||||
}
|
||||
} else {
|
||||
|
||||
$return["status"] = "error";
|
||||
$return["message"] = "Invalid PID";
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
public static function kill_task( $id ) {
|
||||
|
||||
$return = array(
|
||||
"status" => "none",
|
||||
"message" => "",
|
||||
);
|
||||
|
||||
if( is_numeric( $id ) ) {
|
||||
|
||||
$command = "kill -9 {$id}";
|
||||
|
||||
if( function_exists( "exec" ) ) {
|
||||
|
||||
|
||||
} elseif( function_exists( "shell_exec" ) ) {
|
||||
|
||||
|
||||
} elseif( function_exists( "system" ) ) {
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
$return["status"] = "error";
|
||||
$return["message"] = "Could not find an enabled shell execution function.";
|
||||
}
|
||||
} else {
|
||||
|
||||
$return["status"] = "error";
|
||||
$return["message"] = "Invalid PID";
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -1,29 +0,0 @@
|
||||
<?php
|
||||
|
||||
require_once('./class.tasks.php');
|
||||
|
||||
if( isset( $_POST["action"] ) ) {
|
||||
|
||||
$action = $_POST["action"];
|
||||
} elseif( isset( $_GET["action"] ) ) {
|
||||
|
||||
$action = $_GET["action"];
|
||||
} else {
|
||||
|
||||
exit( formatJSEND( "error", "No action was specified" ) );
|
||||
}
|
||||
|
||||
switch( $action ) {
|
||||
|
||||
case( "get_task" ):
|
||||
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
exit( formatJSEND( "error", "An invalid action was specified" ) );
|
||||
break;
|
||||
}
|
||||
|
||||
?>
|
@ -1,55 +0,0 @@
|
||||
( function( global, $ ) {
|
||||
|
||||
var codiad = global.codiad;
|
||||
|
||||
$( function() {
|
||||
|
||||
codiad.project.init();
|
||||
});
|
||||
|
||||
codiad.tasks = {
|
||||
|
||||
controller: 'components/tasks/controller.php',
|
||||
|
||||
init: function() {},
|
||||
|
||||
get_task: function( id ) {
|
||||
|
||||
let _this = this;
|
||||
|
||||
$.ajax({
|
||||
url: _this.controller,
|
||||
type: "POST",
|
||||
dataType: 'JSON',
|
||||
data: {
|
||||
"action": 'mypit_email_save_email',
|
||||
"data": JSON.stringify( data ),
|
||||
},
|
||||
success: function( result ) {
|
||||
|
||||
if( ! isNaN( result ) ) {
|
||||
|
||||
_this.current_id = result;
|
||||
}
|
||||
console.log( result );
|
||||
},
|
||||
error: function(jqXHR, textStatus, errorThrown) {
|
||||
|
||||
document.getElementById( 'mypit_message' ).style.color = "#a94442";
|
||||
document.getElementById( 'mypit_message' ).style.backgroundColor = "#f2dede";
|
||||
document.getElementById( 'mypit_message' ).style.borderColor = "#ebccd1";
|
||||
document.getElementById( 'mypit_message' ).innerHTML = "<p style='text-align: center;'>Error saving email. Please contact the system administrator.</p>";
|
||||
document.getElementById( 'mypit_message' ).style.display = "block";
|
||||
jQuery('html, body').animate( {scrollTop: 0}, 300 );
|
||||
console.log('jqXHR:');
|
||||
console.log(jqXHR);
|
||||
console.log('textStatus:');
|
||||
console.log(textStatus);
|
||||
console.log('errorThrown:');
|
||||
console.log(errorThrown);
|
||||
throw "Error sending emails!";
|
||||
}
|
||||
});
|
||||
},
|
||||
}
|
||||
});
|
Loading…
Reference in New Issue
Block a user