예제 #1
0
 *  \author 		@ide-info <*****@*****.**>
 *  \copyright  	@ide-info since 2012
 *  \license		Read the multi-language license file (license.pdf)
 *
 *  \file 			includes/ajax.php
 *  \brief			Ajax file for ai_multi-dimensions module
 *
 *  \package		aimultidimensions
 *  \version		1.62
 */
//	Prestashop config
require_once '../../../config/config.inc.php';
require_once '../../../init.php';
//	Include module main class
require_once _PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . 'modules' . DIRECTORY_SEPARATOR . 'aimultidimensions' . DIRECTORY_SEPARATOR . 'aimultidimensions.php';
$module = new AiMultiDimensions();
$return = '';
//	Parameters
$allowed = explode(',', Configuration::get('AIMD_FILE_FORMAT'));
$size = (int) Configuration::get('AIMD_FILE_SIZE') * 1024 * 1024;
//die(print_r($_FILES));
//die('size : ' . $size . ' -> ' . (int) $_FILES['upl']['size']);
$target = md5(time() . $_FILES['upl']['name']) . '_' . clean_string($_FILES['upl']['name']);
if (isset($_FILES['upl']) && $_FILES['upl']['error'] == 0) {
    $extension = pathinfo($_FILES['upl']['name'], PATHINFO_EXTENSION);
    if (!in_array(strtolower($extension), $allowed)) {
        $return = '{"status":"error : ' . $module->l('File extension not allowed') . '"}';
    } else {
        if ((int) $_FILES['upl']['size'] > $size) {
            $return = '{"status":"error : ' . $module->l('File is too large') . '"}';
        } else {
예제 #2
0
 *  \author 		@ide-info <*****@*****.**>
 *  \copyright  	@ide-info since 2012
 *  \license		Read the multi-language license file (license.pdf)
 *
 *  \file 			includes/ajax.php
 *  \brief			Ajax file for ai_multi-dimensions module
 * 
 *  \package		aimultidimensions
 *  \version		1.9
 */
//	Prestashop config
require_once '../../../config/config.inc.php';
require_once '../../../init.php';
//	Include module main class
require_once _PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . 'modules' . DIRECTORY_SEPARATOR . 'aimultidimensions' . DIRECTORY_SEPARATOR . 'aimultidimensions.php';
$module = new AiMultiDimensions();
//	Minimum parameters needed
$error = 0;
if (!isset($_REQUEST['token']) && (Tools::getIsset('action') && (Tools::getValue('action') != 'downloadFile' && Tools::getValue('action') != 'deleteFile'))) {
    $error = 1;
}
//	Explode the token and get parameters
if (isset($_REQUEST['token'])) {
    $token = base64_decode(Tools::getValue('token'));
    $tokenArray = explode('&', $token);
    $params = array();
    foreach ($tokenArray as $tokenValue) {
        $tokenValueArray = explode('=', $tokenValue);
        $params[$tokenValueArray[0]] = $tokenValueArray[1];
    }
    //	Add for Prestashop 1.5 version and above
예제 #3
0
 *  \author 		@ide-info <*****@*****.**>
 *  \copyright  	@ide-info since 2013
 *  \license		Read the multi-language license file (license.pdf)
 *
 *  \file 			includes/config.php
 *  \brief			Configuration file for ai_multidimensions module
 * 
 *  \package		aimultidimensions
 *  \version		1.9
 */
//	Dev mod
$aimd_config_suffix = '';
$aimd_config_suffix = '-min';
$GLOBALS['aimd_config_suffix'] = $aimd_config_suffix;
//  Object for translations
$module = new AiMultiDimensions();
//	Entended parameters
$config_entended = array(1 => array(0 => $module->l('None', 'config'), 1 => $module->l('Top', 'config'), 2 => $module->l('Bottom', 'config'), 3 => $module->l('Top & Bottom', 'config'), 4 => $module->l('Left', 'config'), 5 => $module->l('Right', 'config'), 6 => $module->l('Left & right', 'config'), 7 => $module->l('Perimeter', 'config')));
$GLOBALS['config_entended'] = $config_entended;
//  Formats
//  Rectangle must remains the first one
//  x = first dimension, y = second dimension, z = third dimension
//  format explanation :
//  array(
//      'format' => $module->l('rectangle', 'config')           : format is the name displayed in the list on link a product tab, it uses the translation mode
//      'surface_formula' => 'x * y'                            : formula that is linked to this shape to calculate surface, x, y & z are the three dimensions and will be replaced by values input by the customer
//      'perimeter_formula' => 'x * y'                          : formula that is linked to this shape to calculate perimeter, x, y & z are the three dimensions and will be replaced by values input by the customer
//      'labels' => array('x' => '', 'y' => '', 'z' => '')      : labels for this shape, if not empty, will replace the default labels
//      'proportionnal display' => true)                        : if product calculation is set to proportionnal, display or not the other dimensions (0 -> false, 1 -> true)
//  Don't use mathematical functions or variables until they are common to PHP and JS
$config_format = array(array('format' => $module->l('rectangle', 'config'), 'surface_formula' => 'x * y', 'perimeter_formula' => 'x * 2 + y * 2', 'labels' => array('x' => '', 'y' => '', 'z' => ''), 'proportionnal display' => 1), array('format' => $module->l('elipse', 'config'), 'surface_formula' => '(x / 2) * (y / 2) * 3.141592', 'perimeter_formula' => '(x / 2 + y / 2) * 3.141592', 'labels' => array('x' => $module->l('x diameter', 'config'), 'y' => $module->l('y diameter', 'config'), 'z' => ''), 'proportionnal display' => 0), array('format' => $module->l('cube', 'config'), 'surface_formula' => 'x * y * z', 'perimeter_formula' => '', 'labels' => array('x' => '', 'y' => '', 'z' => ''), 'proportionnal display' => 1));