first commit
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
<?
|
||||
if (!array_key_exists('mobideliv', $GLOBALS)) {
|
||||
$USER = $_SERVER['SCRIPT_FILENAME'];
|
||||
$USER = str_replace('/home', '', $USER);
|
||||
$USER = strtok($USER, '/');
|
||||
if ($USER=='opt') $USER = 'root';
|
||||
// Load API class
|
||||
$mobideliv_class = 'mobideliv_api_' . $USER . '\\MobiDeliv';
|
||||
$mobideliv = new $mobideliv_class();
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1 @@
|
||||
vrlayer
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
include("core/backend.php");
|
||||
//include("core/medtrans_function.php");
|
||||
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||
$in = $_POST;
|
||||
$out = array();
|
||||
|
||||
$ret = $mobideliv->mobideliv_api($in, $out);
|
||||
|
||||
/*
|
||||
$medT = new medtrans_function();
|
||||
$ret = $medT->medtrans_api($mobideliv, $in, $out);
|
||||
|
||||
|
||||
// $out = $in;
|
||||
$ret = rand(1000,9999);
|
||||
*
|
||||
*/
|
||||
|
||||
$out['internal_return'] = $ret; // this is reserved array parameter - to be caprured and reoved before you use the out array()
|
||||
foreach ($out as $key => $value) {
|
||||
echo $key . "=" . base64_encode($value) . "\n";
|
||||
}
|
||||
} else {
|
||||
echo "status=" . base64_encode("Invalid request method") . "\n";
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
include("core/backend.php");
|
||||
|
||||
define('MEDTRANS_LOAD_AGENT', 400006);
|
||||
define('MEDTRANS_UPLOADS', 4505);
|
||||
|
||||
#
|
||||
//include("core/medtrans_function.php");
|
||||
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||
$in = $_POST;
|
||||
$out = array();
|
||||
$x = array();
|
||||
$ext = pathinfo($_FILES['file_contents']['name'], PATHINFO_EXTENSION);
|
||||
$in['extension'] = $ext;
|
||||
if ($in['agent_id'] != '' and $in['agent_id'] > 0) {
|
||||
|
||||
$storage_path = "wwwadmin/upload/"; //Must be in the config file
|
||||
$in["part"] = "AGT";
|
||||
$storage_path .= $in["part"] . "/"; // ALL AGENT FILES APART
|
||||
// you can be only be agent on this path creating documnent storage
|
||||
// 1. we need your local drive folder
|
||||
$in['action'] = MEDTRANS_LOAD_AGENT;
|
||||
$in["pid"] = 115;
|
||||
$mobideliv->mobideliv_api($in, $x);
|
||||
$user_folder = $x["folder"] . "/" . $in['file_type'] . "/";
|
||||
$in["folder"] = $x["folder"];
|
||||
$uploaddir = realpath('./') . '/../' . $storage_path . $user_folder . $ext . '/';
|
||||
|
||||
mkdir($uploaddir, 0777, true);
|
||||
do {
|
||||
$uploadname = strtoupper(uniqid("")) . '.' . $ext;
|
||||
$uploadfile = $uploaddir . $uploadname;
|
||||
} while (file_exists($uploadfile));
|
||||
if (move_uploaded_file($_FILES['file_contents']['tmp_name'], $uploadfile)) {
|
||||
$in["upload_file_path"] = $uploadfile;
|
||||
$in["upload_file_name"] = $uploadname;
|
||||
$in["file_name"] = $uploadname; // need this in back end
|
||||
$in['action'] = MEDTRANS_UPLOADS;
|
||||
// file_type is in the array already
|
||||
$ret = $mobideliv->mobideliv_api($in, $out);
|
||||
$out = $in;
|
||||
$out['internal_return'] = $ret; // this is reserved array parameter - to be caprured and reoved before you use the out array()
|
||||
$out["upload_file_path"] = $uploadfile;
|
||||
$out["upload_file_name"] = $uploadname;
|
||||
|
||||
/*
|
||||
if ($ret!=0) {
|
||||
unlink($uploadfile); // Do we delete when failed?
|
||||
}
|
||||
*/
|
||||
} else {
|
||||
$out['internal_return'] = -1;
|
||||
$out['internal_error'] = "File upload failed";
|
||||
}
|
||||
} else {
|
||||
$out["status"] = "Invalid Agent ID";
|
||||
$out['internal_return'] = -1;
|
||||
$out['internal_error'] = "File upload failed";
|
||||
}
|
||||
|
||||
echo json_encode($out);
|
||||
} else {
|
||||
echo "{\"status\":\"Invalid request method\"}\n";
|
||||
}
|
||||
|
||||
// vi:ts=2
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
include("core/backend.php");
|
||||
//include("core/medtrans_function.php");
|
||||
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||
$in = $_POST;
|
||||
$out = array();
|
||||
$ext = pathinfo($_FILES['file_contents']['name'], PATHINFO_EXTENSION);
|
||||
|
||||
$storage_path = "wwwadmin/upload/"; //Must be in the config file
|
||||
|
||||
// you can be agent / member / support creating documnent storage
|
||||
|
||||
$user_folder = "ABCDEFGHIJK001"."/";
|
||||
|
||||
$uploaddir = realpath('./') . '/../'.$storage_path.$user_folder.$ext.'/';
|
||||
|
||||
// RETIRED $uploaddir = realpath('./') . '/../wwwadmin/upload/'.$ext.'/';
|
||||
|
||||
|
||||
|
||||
mkdir($uploaddir, 0777, true);
|
||||
do {
|
||||
$uploadname = strtoupper(uniqid("")) . '-' . strtoupper(uniqid("")) . '-' .strtoupper(uniqid("")) .'-' .strtoupper(uniqid("")) . '.' .$ext;
|
||||
$uploadfile = $uploaddir . $uploadname;
|
||||
} while(file_exists($uploadfile));
|
||||
if (move_uploaded_file($_FILES['file_contents']['tmp_name'], $uploadfile)) {
|
||||
$in["upload_file_path"] = $uploadfile;
|
||||
$in["upload_file_name"] = $uploadname;
|
||||
$ret = $mobideliv->mobideliv_api($in, $out);
|
||||
$out['internal_return'] = $ret; // this is reserved array parameter - to be caprured and reoved before you use the out array()
|
||||
$out["upload_file_path"] = $uploadfile;
|
||||
$out["upload_file_name"] = $uploadname;
|
||||
/*
|
||||
if ($ret!=0) {
|
||||
unlink($uploadfile); // Do we delete when failed?
|
||||
}
|
||||
*/
|
||||
} else {
|
||||
$out['internal_return'] = -1;
|
||||
$out['internal_error'] = "File upload failed";
|
||||
}
|
||||
echo json_encode($out);
|
||||
} else {
|
||||
echo "{\"status\":\"Invalid request method\"}\n";
|
||||
}
|
||||
|
||||
// vi:ts=2
|
||||
|
||||
Reference in New Issue
Block a user