コード例 #1
0
ファイル: megaboxsAjax.php プロジェクト: zangles/lennyba
<?php

require_once dirname(__FILE__) . '../../../config/config.inc.php';
require_once dirname(__FILE__) . '../../../init.php';
require_once dirname(__FILE__) . '/megaboxs.php';
$module = new MegaBoxs();
$megaboxAjax = new MegaBoxsAjax();
if (!Tools::isSubmit('secure_key') || Tools::getValue('secure_key') != $module->secure_key) {
    $response->status = 0;
    $response->msg = $module->l("Error: not prosess.");
}
if (!Tools::isSubmit('action') || !Tools::getValue('action')) {
    $response->status = 0;
    $response->msg = $module->l("Error: not action.");
}
$action = Tools::getValue('action');
if (method_exists($megaboxAjax, $action)) {
    $megaboxAjax->{$action}();
} else {
    $response->status = 0;
    $response->msg = $module->l("Error: not method.");
}
class MegaBoxsAjax
{
    public $errors = array();
    public $context = null;
    public function __construct()
    {
        $this->context = Context::getContext();
    }
    protected function getOrder()
コード例 #2
0
ファイル: uploader.php プロジェクト: zangles/lennyba
<?php

require_once dirname(__FILE__) . '../../../config/config.inc.php';
require_once dirname(__FILE__) . '../../../init.php';
require_once dirname(__FILE__) . '/megaboxs.php';
$module = new MegaBoxs();
$response = new stdClass();
if (!Tools::isSubmit('secure_key') || Tools::getValue('secure_key') != $module->secure_key) {
    $response->status = 0;
    $response->fileName = "";
    $response->msg = $module->l("you need to login with the admin account.");
} else {
    $fileType = strtolower(pathinfo($_FILES["uploader"]["name"], PATHINFO_EXTENSION));
    $fileName = Tools::encrypt(time()) . '_' . $_FILES["uploader"]["name"];
    $fileTemp = $module->pathImage . 'temps/' . $fileName;
    if (isset($_POST['width']) && intval($_POST['width']) > 0) {
        $width = intval($_POST['width']);
    } else {
        $width = null;
    }
    if (isset($_POST['height']) && intval($_POST['height']) > 0) {
        $height = intval($_POST['height']);
    } else {
        $height = null;
    }
    if (isset($_POST['maxFileSize']) && $_POST['maxFileSize']) {
        $maxFileSize = $_POST['maxFileSize'];
    }
    $maxFileSize = 1;
    // MB
    if (isset($_POST['uploadType']) && $_POST['uploadType']) {