Example #1
0
 function modals($function = null, $selected = 1)
 {
     $this->root = dirname(ROOT) . DS . 'uploaded';
     $dgClass = new dg();
     $this->url = $dgClass->url();
     $this->url .= 'tshirtecommerce/';
     $data = array();
     $data['title'] = 'Media';
     $data['sub_title'] = 'Manage';
     $data['root'] = 'uploaded';
     $data['imgURL'] = $this->url;
     include_once ROOT . DS . 'includes' . DS . 'file.php';
     $file = new File();
     $data['folders'] = $file->folders($this->root);
     $data['files'] = $file->files($this->root);
     $data['selected'] = $selected;
     $data['function'] = $function;
     $this->modal('modals', $data);
 }
Example #2
0
 * 
 * @copyright  Copyright (C) 2015 tshirtecommerce.com. All rights reserved.
 * @license    GNU General Public License version 2 or later; see LICENSE
 *
 */
error_reporting(0);
date_default_timezone_set('America/Los_Angeles');
define('ROOT', dirname(__FILE__));
define('DS', DIRECTORY_SEPARATOR);
if (isset($_GET['type'])) {
    $type = $_GET['type'];
} else {
    $type = '';
}
require_once ROOT . DS . 'includes' . DS . 'functions.php';
$dg = new dg();
$lang = $dg->lang();
switch ($type) {
    case 'upload':
        require_once ROOT . DS . 'includes' . DS . 'upload.php';
        $data = array();
        $data['status'] = 0;
        if (!empty($_FILES['myfile'])) {
            $root = $dg->folder();
            $uploader = new Uploader();
            $uploader->setDir(ROOT . DS . $root);
            $uploader->setExtensions(array('jpg', 'jpeg', 'png', 'gif'));
            $uploader->setMaxSize(10);
            $uploader->sameName(false);
            if ($uploader->uploadFile('myfile')) {
                $data['status'] = 1;
 public function modal($view, $data)
 {
     // call language
     $segments = $this->params;
     // call language
     $dg = new dg();
     $lang = $dg->lang();
     $site_url = $dg->url();
     $GLOBALS['lang'] = $lang;
     $GLOBALS['site_url'] = $site_url . '/tshirtecommerce/admin/';
     // call add-ons
     include ROOT . DS . 'includes' . DS . 'addons.php';
     $addons = new addons();
     if (file_exists(ROOT . DS . 'theme' . DS . $view . '.php')) {
         require_once ROOT . DS . 'theme' . DS . $view . '.php';
     } elseif (file_exists(ROOT . DS . 'views' . DS . $view . '.php')) {
         require_once ROOT . DS . 'views' . DS . $view . '.php';
     } else {
         echo 'View not found';
     }
 }
									<a href="javascript:void(0);" class="btn btn-xs btn-link panel-collapse collapses"></a>						
								</div>
							</div>
							<div class="panel-body">
								<label id="product_categories-lable"><?php 
echo lang('product_add_categories');
?>
</label>
								<button type="button" autocomplete="off" onclick="dgUI.product.removeCate(this);" id="loading-example-btn" data-loading-text="Loading..." class="btn btn-sm pull-right btn-primary">
								  <?php 
echo lang('remove');
?>
								</button>								
								<div class="form-group" id="product_categories">
									<?php 
$dgClass = new dg();
$categories = $dgClass->getCategories();
$categories = $dgClass->categoriesToTree($categories);
echo $dgClass->dispayTree($categories, 0, array('type' => 'checkbox', 'name' => 'category[]'), $data['cate_checked']);
?>
								</div>
								<div class="form-group">
									<a href="javascript:void(0)" onclick="dgUI.product.addCategoryJs(this)"><?php 
echo lang('product_add_category');
?>
</a>
								</div>
								
								<div class="form-group">
									<div class="add-new-category" style="display:none;">
										
Example #5
0
 public function deleteCategory($id)
 {
     $file = dirname(ROOT) . DS . 'data' . DS . 'categories_art.json';
     $str = file_get_contents($file);
     $categories = json_decode($str);
     $array = array();
     foreach ($categories as $category) {
         if ($category->id != $id) {
             $array[] = $category;
         }
     }
     $categories = $array;
     $dgClass = new dg();
     $check = $dgClass->WriteFile($file, json_encode($categories));
     echo $check;
     exit;
 }
Example #6
0
 public function logout()
 {
     $dgClass = new dg();
     setcookie("temail", "", time() - 36000, '/');
     setcookie("tpassword", "", time() - 36000, '/');
     $this->unset_session('login');
     $dgClass->redirect('index.php');
 }
 * @date: 2015-01-10
 * 
 * API
 * 
 * @copyright  Copyright (C) 2015 tshirtecommerce.com. All rights reserved.
 * @license    GNU General Public License version 2 or later; see LICENSE
 *
 */
error_reporting(0);
define('ROOT', dirname(__FILE__));
define('DS', DIRECTORY_SEPARATOR);
if (isset($_GET['key'])) {
    include_once ROOT . DS . 'includes' . DS . 'functions.php';
    $key = $_GET['key'];
    $position = $_GET['view'];
    $dg = new dg();
    $cache = $dg->cache('design');
    $params = explode(':', $key);
    $user_id = $cache->get($params[0]);
    if ($user_id == false or count($user_id) == 0) {
        return false;
    }
    $data = $user_id[$params[1]];
    if (count($data) > 0) {
        $product_id = $params[2];
        // get product
        $products = $dg->getProducts();
        for ($i = 0; $i < count($products); $i++) {
            if ($products[$i]->id == $product_id) {
                $product = $products[$i];
                break;
Example #8
0
        curl_close($ch);
    }
    return $data;
}
if (isset($_GET['name']) && isset($_GET['type'])) {
    $font_name = $_GET['name'];
    $font_type = $_GET['type'];
    if ($font_type == 'google') {
        $file = 'google-' . $font_name;
    } else {
        $file = 'add-' . $font_name;
    }
    $file = str_replace(' ', '_', $file);
    $file = str_replace('+', '_', $file);
    include_once ROOT . DS . 'includes' . DS . 'functions.php';
    $dg = new dg();
    $cache = $dg->cache('fonts');
    $content = $cache->get($file);
    if ($content == false) {
        if ($font_type == 'google') {
            $font_name = str_replace(' ', '+', $font_name);
            $url = 'http://fonts.googleapis.com/css?family=' . $font_name;
            $data = openURL($url);
            if ($data === false) {
                echo 0;
                exit;
            }
            preg_match_all("/url\\((.*)\\.ttf\\)/s", $data, $links);
            if (isset($links[1]) && isset($links[1][0])) {
                $content = openURL($links[1][0] . '.ttf');
                if ($content == false) {
Example #9
0
<?php

/**
 * @author tshirtecommerce - www.tshirtecommerce.com
 * @date: 2015-01-10
 * 
 * @copyright  Copyright (C) 2015 tshirtecommerce.com. All rights reserved.
 * @license    GNU General Public License version 2 or later; see LICENSE
 *
 */
define('ROOT', dirname(__FILE__));
define('DS', DIRECTORY_SEPARATOR);
include_once ROOT . DS . 'includes' . DS . 'functions.php';
// call language
$dg = new dg();
$lang = $dg->lang();
$segments = $dg->segments();
$site_url = $dg->siteUrl();
$meta_title = lang('breadcrumb_add_font', true);
//$base_url = $dg->url();
include_once 'components/header.php';
?>
	<?php 
include 'components/top.php';
?>
		<!-- start: MAIN CONTAINER -->
		<div class="main-container">
			<?php 
include 'components/left.php';
?>
			<!-- start: PAGE -->
Example #10
0
 * @author tshirtecommerce - www.tshirtecommerce.com
 * @date: 2015-01-10
 * 
 * API
 * 
 * @copyright  Copyright (C) 2015 tshirtecommerce.com. All rights reserved.
 * @license    GNU General Public License version 2 or later; see LICENSE
 *
 */
error_reporting(0);
session_start();
define('ROOT', dirname(__FILE__));
define('DS', DIRECTORY_SEPARATOR);
include_once ROOT . DS . 'includes' . DS . 'functions.php';
// call language
$dg = new dg();
$lang = $dg->lang();
$site_url = $dg->url();
// call products
$products = $dg->getProducts();
// Paginition.
$url = $_SERVER['REQUEST_URI'];
$params = explode('admin-blank.php/', $url);
if (count($params) > 1) {
    $segment = (int) $params[1];
} else {
    $segment = '';
}
$perpage = 12;
$segment_product = 0;
$segment_design = 0;
Example #11
0
 public function removeLanguage()
 {
     include_once ROOT . DS . 'includes' . DS . 'functions.php';
     $dg = new dg();
     $file = dirname(ROOT) . DS . 'data' . DS . 'languages.json';
     $languages = $dg->readFile($file);
     $languages = json_decode($languages, true);
     if (isset($_POST['checkb'])) {
         foreach ($_POST['checkb'] as $id) {
             if (isset($languages[$id])) {
                 if (isset($languages[$id]['code']) && file_exists(dirname(ROOT) . DS . 'data' . DS . $languages[$id]['file'])) {
                     unlink(dirname(ROOT) . DS . 'data' . DS . $languages[$id]['file']);
                     if (is_dir(dirname(ROOT) . DS . 'addons' . DS . 'language' . DS . $languages[$id]['code'])) {
                         unlink(dirname(ROOT) . DS . 'addons' . DS . 'language' . DS . $languages[$id]['code']);
                     }
                 }
                 unset($languages[$id]);
             }
         }
         $data_languages = $languages;
         $languages = array();
         foreach ($data_languages as $val) {
             $languages[] = $val;
         }
         $res = json_encode($languages);
         $dg->WriteFile($file, $res);
     }
     $this->languages('load');
     return;
 }
Example #12
0
 * @author tshirtecommerce - www.tshirtecommerce.com
 * @date: 2015-01-10
 * 
 * API
 * 
 * @copyright  Copyright (C) 2015 tshirtecommerce.com. All rights reserved.
 * @license    GNU General Public License version 2 or later; see LICENSE
 *
 */
error_reporting(0);
session_start();
define('ROOT', dirname(__FILE__));
define('DS', DIRECTORY_SEPARATOR);
include_once ROOT . DS . 'includes' . DS . 'functions.php';
// call language
$dg = new dg();
$lang = $dg->lang();
// call products
$products = $dg->getProducts();
// get design
$cache = $dg->cache();
$path = ROOT . DS . 'cache' . DS . 'design';
$files = $dg->getFiles($path);
$designs = array();
if ($files !== false) {
    $i = 0;
    foreach ($files as $file) {
        $key = str_replace('.txt', '', $file);
        $designs[$key] = $cache->get($key);
    }
}
 * 
 * API
 * 
 * @copyright  Copyright (C) 2015 tshirtecommerce.com. All rights reserved.
 * @license    GNU General Public License version 2 or later; see LICENSE
 *
 */
error_reporting(0);
define('ROOT', dirname(__FILE__));
define('DS', DIRECTORY_SEPARATOR);
if (isset($_GET['key'])) {
    include_once ROOT . DS . 'includes' . DS . 'functions.php';
    $key = $_GET['key'];
    $position = $_GET['view'];
    $is_admin = $_GET['is_admin'];
    $dg = new dg();
    if ($is_admin == 0) {
        $cache = $dg->cache('design');
    } else {
        $cache = $dg->cache('admin');
    }
    $params = explode(':', $key);
    $user_id = $cache->get($params[0]);
    if ($user_id == false or count($user_id) == 0) {
        return false;
    }
    $data = $user_id[$params[1]];
    if (count($data) > 0) {
        $product_id = $params[2];
        // get product
        $products = $dg->getProducts();
Example #14
0
 public function editFont($id = '')
 {
     $file = dirname(ROOT) . DS . 'data' . DS . 'fonts.json';
     include_once ROOT . DS . 'includes' . DS . 'functions.php';
     include_once ROOT . DS . 'includes' . DS . 'upload.php';
     $dg = new dg();
     $fonts = $dg->readFile($file);
     $fonts = json_decode($fonts, true);
     $font = $fonts['fonts']['fonts'];
     $data = array();
     $data['error'] = '';
     $data['id'] = $id;
     // get categories.
     $cate_font = ROOT . DS . 'data' . DS . 'font_categories.json';
     $cate = $dg->readFile($cate_font);
     $cates = json_decode($cate, true);
     $data['categories'] = $cates;
     // post data.
     if (isset($_POST['title']) && $_POST['title'] != '') {
         $title = $_POST['title'];
         //upload.
         $path = dirname(ROOT) . DS . 'data' . DS . 'fonts';
         if (!file_exists($path)) {
             mkdir($path, 0755);
         }
         $up = new upload();
         $up->permission = 755;
         $up->path = $path;
         $up->file_size = 2097152;
         // 2mb.
         $count = 0;
         $result = array();
         if (count($_FILES) == 3) {
             foreach ($_FILES as $key => $value) {
                 if (isset($_FILES[$key]['name']) && $_FILES[$key]['name'] != '') {
                     $checkname = array('~', '`', '!', '@', '#', '$', '%', '^', '&', '(', ')', '+', '=', '[', ']', '{', '}', ':', ' ', ',', '\'', ';');
                     $up->file_name = str_replace($checkname, '', $_FILES[$key]['name']);
                     if ($count == 0) {
                         $up->file_type[0] = 'woff';
                         $val = $up->file($_FILES[$key]);
                         if ($val['error'] == 1) {
                             $data['error'] = $val['msg'];
                             break;
                         }
                         $result[$count] = $val;
                     } elseif ($count == 1) {
                         $up->file_type[0] = 'ttf';
                         $up->file_type[1] = 'TTF';
                         $val = $up->file($_FILES[$key]);
                         if ($val['error'] == 1) {
                             $data['error'] = $val['msg'];
                             if (file_exists($result[0]['full_path'])) {
                                 unlink($result[0]['full_path']);
                             }
                             break;
                         }
                         $result[$count] = $val;
                     } else {
                         $up->file_type[0] = 'jpg';
                         $up->file_type[1] = 'png';
                         $up->file_type[2] = 'gif';
                         $up->file_type[3] = 'jpeg';
                         $val = $up->file($_FILES[$key]);
                         if ($val['error'] == 1) {
                             $data['error'] = $val['msg'];
                             if (file_exists($result[0]['full_path'])) {
                                 unlink($result[0]['full_path']);
                             }
                             if (file_exists($result[1]['full_path'])) {
                                 unlink($result[1]['full_path']);
                             }
                             break;
                         }
                         $result[$count] = $val;
                     }
                 }
                 $count++;
             }
         }
         //process.
         $subtitle = '';
         $cate_id = '';
         $catename = '';
         if (isset($_POST['subtitle'])) {
             $subtitle = $_POST['subtitle'];
         }
         if (isset($_POST['cate_id'])) {
             $cate_id = $_POST['cate_id'];
         }
         if ($catename == '' && isset($cates[$cate_id])) {
             $catename = $cates[$cate_id];
         }
         if ($id != '') {
             if (count($font) && $data['error'] == '') {
                 $font_out = array();
                 foreach ($font as $key => $val) {
                     if ($val['id'] == $id && $val['type'] == '') {
                         $filename = $val['filename'];
                         $path = $val['path'];
                         $thumb = $val['thumb'];
                         if ($data['error'] == '' && count($result) == 3) {
                             $filename = array('woff' => $result[0]['file_name'], 'ttf' => $result[1]['file_name']);
                             $filename = json_encode($filename);
                             $path = $path;
                             $thumb = $result[2]['file_name'];
                         }
                         $font_out[$key] = array('id' => $val['id'], 'title' => $_POST['title'], 'subtitle' => $subtitle, 'filename' => $filename, 'path' => 'data/fonts', 'thumb' => $thumb, 'shop_id' => '', 'cate_id' => $cate_id, 'published' => '1', 'catename' => $catename, 'type' => '');
                     } else {
                         $font_out[$key] = $val;
                     }
                 }
                 // out data.
                 $out['status'] = '1';
                 $out['fonts']['google_fonts'] = $fonts['fonts']['google_fonts'];
                 $out['fonts']['fonts'] = $font_out;
                 // get cates.
                 foreach ($cates as $k => $v) {
                     $out['fonts']['cateFonts'][$k]['fonts'] = $this->updateFonts($out['fonts']['fonts'], $k, $v, 'catefont');
                     $out['fonts']['categories'][$k] = $this->updateCate($k, $v);
                 }
                 $res = json_encode($out);
             }
         } else {
             if ($data['error'] == '' && count($result) == 3) {
                 // get last id.
                 if (count($font)) {
                     $font_end = end($fonts['fonts']['fonts']);
                     $font_id = $font_end['id'] + 1;
                 } else {
                     $font_id = 0;
                 }
                 //add a font.
                 $filename = array('woff' => $result[0]['file_name'], 'ttf' => $result[1]['file_name']);
                 $font[] = array('id' => (string) $font_id, 'title' => $_POST['title'], 'subtitle' => $subtitle, 'filename' => json_encode($filename), 'path' => 'data/fonts', 'thumb' => $result[2]['file_name'], 'shop_id' => '', 'cate_id' => $cate_id, 'published' => '1', 'catename' => $catename, 'type' => '');
                 // out data.
                 $out['status'] = '1';
                 $out['fonts']['google_fonts'] = $fonts['fonts']['google_fonts'];
                 $out['fonts']['fonts'] = $font;
                 // get cates.
                 foreach ($cates as $key => $val) {
                     $out['fonts']['cateFonts'][$key]['fonts'] = $this->updateFonts($out['fonts']['fonts'], $key, $val, 'catefont');
                     $out['fonts']['categories'][$key] = $this->updateCate($key, $val);
                 }
                 $res = json_encode($out);
             } elseif ($data['error'] == '') {
                 $data['error'] = lang('fonts_add_font_file_error_msg', true);
             }
         }
         if (isset($res) && $res != '') {
             $dg->WriteFile($file, $res);
             if ($id == '') {
                 $data['msg'] = lang('fonts_add_font_file_success_msg', true);
             } else {
                 $data['msg'] = lang('fonts_edit_font_file_success_msg', true);
             }
         }
     }
     if (empty($subtitle)) {
         $subtitle = '';
     }
     if (empty($title)) {
         $title = '';
     }
     $data['font'] = array('title' => $title, 'subtitle' => $subtitle, 'filename' => '', 'path' => '', 'cate_id' => '', 'thumb' => '');
     if ($id == '') {
         $data['title'] = lang('breadcrumb_add_font', true);
     } else {
         $fonts = $dg->readFile($file);
         $fonts = json_decode($fonts, true);
         $font = $fonts['fonts']['fonts'];
         foreach ($font as $key => $val) {
             if ($val['id'] == $id && $val['type'] == '') {
                 $data['font'] = array('title' => $val['title'], 'subtitle' => $val['subtitle'], 'filename' => $val['filename'], 'path' => $val['path'], 'cate_id' => $val['cate_id'], 'thumb' => $val['thumb']);
             }
         }
         $data['title'] = lang('breadcrumb_edit_font', true);
     }
     $data['sub_title'] = lang('breadcrumb_manager', true);
     $this->view('edit_font', $data);
 }
Example #15
0
/**
 * @author tshirtecommerce - www.tshirtecommerce.com
 * @date: 2015-01-10
 * 
 * @copyright  Copyright (C) 2015 tshirtecommerce.com. All rights reserved.
 * @license	   GNU General Public License version 2 or later; see LICENSE
 *
 */
error_reporting(0);
date_default_timezone_set('America/Los_Angeles');
define('ROOT', dirname(__FILE__));
define('DS', DIRECTORY_SEPARATOR);
include_once ROOT . DS . 'includes' . DS . 'functions.php';
include_once ROOT . DS . 'includes' . DS . 'addons.php';
// call language
$dg = new dg();
$lang = $dg->lang();
// call products
$products = $dg->getProducts();
$product = $products[0];
if (isset($_GET['product'])) {
    $product_id = $_GET['product'];
    for ($i = 0; $i < count($products); $i++) {
        if ($product_id == $products[$i]->id) {
            $product = $products[$i];
        }
    }
}
// get attribute
if (isset($product->attributes->name)) {
    $product->attribute = $dg->getAttributes($product->attributes);
Example #16
0
 public function category()
 {
     if (isset($_POST['title'])) {
         $title = $_POST['title'];
     }
     if (isset($_POST['cateid'])) {
         $parent_id = $_POST['cateid'];
     }
     if (isset($_POST['ids'])) {
         $ids = $_POST['ids'];
     } else {
         $ids = array();
     }
     $dgClass = new dg();
     if (!empty($title)) {
         $categories = $dgClass->getCategories();
         $cate_data = array();
         $cate_id = 0;
         if ($parent_id == '') {
             $parent_id = 0;
         }
         foreach ($categories as $cate) {
             $cate_data[] = array('id' => $cate->id, 'parent_id' => $cate->parent_id, 'title' => $cate->title);
             if ($cate->id > $cate_id) {
                 $cate_id = $cate->id;
             }
         }
         $cate_data[] = array('id' => $cate_id + 1, 'parent_id' => $parent_id, 'title' => $title);
         $path = dirname(ROOT) . DS . 'data' . DS . 'categories.json';
         $check = $dgClass->WriteFile($path, json_encode($cate_data));
     } elseif (count($ids)) {
         $categories = $dgClass->getCategories();
         $cate_data = array();
         foreach ($categories as $val) {
             if (!in_array($val->id, $ids)) {
                 $cate_data[] = $val;
             }
         }
         $path = dirname(ROOT) . DS . 'data' . DS . 'categories.json';
         $check = $dgClass->WriteFile($path, json_encode($cate_data));
     }
     $categories = $dgClass->getCategories();
     $categories = $dgClass->categoriesToTree($categories);
     $data['content'] = $dgClass->dispayTree($categories, 0, array('type' => 'checkbox', 'name' => 'category[]'));
     $data['list'] = '<option value="0">' . lang('product_parent_category', true) . '</option>' . $dgClass->dispayTree($categories, 0, array('type' => 'select', 'name' => ''));
     echo json_encode($data);
     return;
 }
Example #17
0
 * @author tshirtecommerce - www.tshirtecommerce.com
 * @date: 2015-01-10
 * 
 * API
 * 
 * @copyright  Copyright (C) 2015 tshirtecommerce.com. All rights reserved.
 * @license    GNU General Public License version 2 or later; see LICENSE
 *
 */
error_reporting(0);
session_start();
define('ROOT', dirname(__FILE__));
define('DS', DIRECTORY_SEPARATOR);
include_once ROOT . DS . 'includes' . DS . 'functions.php';
// call language
$dg = new dg();
$lang = $dg->lang();
$site_url = $dg->url();
// get design
$cache = $dg->cache('admin');
$path = ROOT . DS . 'cache' . DS . 'admin';
$files = $dg->getFiles($path);
$designs = array();
if ($files !== false) {
    $i = 0;
    foreach ($files as $file) {
        $key = str_replace('.txt', '', $file);
        $designs[$key] = $cache->get($key);
    }
}
// Paginition.
Example #18
0
<?php

/**
 * @author tshirtecommerce - www.tshirtecommerce.com
 * @date: 2015-09-03
 * 
 * @copyright  Copyright (C) 2015 tshirtecommerce.com. All rights reserved.
 * @license	   GNU General Public License version 2 or later; see LICENSE
 *
 */
error_reporting(0);
define('ROOT', dirname(__FILE__));
define('DS', DIRECTORY_SEPARATOR);
include_once ROOT . DS . 'includes' . DS . 'functions.php';
$dg = new dg();
$lang = $dg->lang();
$settings = $dg->getSetting();
$base_url = $dg->url();
$params = explode('sharing.php/', $_SERVER['REQUEST_URI']);
if (count($params) > 1) {
    $design_id = $params[1];
    $url = $base_url . 'tshirtecommerce/sharing.php/' . $design_id;
} else {
    $design_id = '';
    $url = $base_url;
}
if ($design_id != '') {
    $cache = $dg->cache('design');
    $params = explode(':', $design_id);
    $user_id = $cache->get($params[0]);
    if ($user_id != false && count($user_id[$params[1]]) > 0) {
Example #19
0
<?php

define('ROOT', dirname(__FILE__));
define('DS', DIRECTORY_SEPARATOR);
include_once ROOT . DS . 'includes' . DS . 'functions.php';
// call language
$dg = new dg();
$lang = $dg->lang();
$site_url = $dg->siteUrl();
?>

<div class="modal-dialog">
	<div class="modal-content">
		<div class="modal-header">
			<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
			<h4 class="modal-title"><?php 
lang('color_edit');
?>
</h4>
		</div>

		<!--add-->
		<form class="form-horizontal" name="form_edit" id="form-edit" method="POST" action="">
		<div class="modal-body">
			<div id="row">
				<div class="form-group">
					<label for="inputlang" class="col-sm-4 control-label"><?php 
lang('color_name');
?>
 *</label>
					<div class="col-md-5">
Example #20
0
			<center><h4>Download File Design</h4></center>
		</div>
		
		<div class="row">
			<?php 
if (empty($_GET['key']) || empty($_GET['view'])) {
    ?>
				<div class="col-md-12 alert alert-danger" role="alert">
					<strong>Design Not Found!</strong>
				</div>
			<?php 
} else {
    $key = $_GET['key'];
    $position = $_GET['view'];
    include_once ROOT . DS . 'includes' . DS . 'functions.php';
    $dg = new dg();
    $data = array();
    if (empty($_GET['idea'])) {
        $file = 'download.php';
        $cache = $dg->cache('cart');
        $data = $cache->get($key);
        //print_r($data);
    } else {
        $file = 'download_idea.php';
        $cache = $dg->cache('design');
        $params = explode(':', $key);
        $user_id = $cache->get($params[0]);
        if ($user_id != false && count($user_id[$params[1]]) > 0) {
            $data = $user_id[$params[1]];
        } else {
            $cache = $dg->cache('admin');
Example #21
0
 public function update($product_id = '')
 {
     include_once ROOT . DS . 'includes' . DS . 'functions.php';
     $dg = new dg();
     $path_info = dirname(ROOT) . DS . 'addons' . DS . 'install' . DS . $product_id . '.json';
     if ($product_id != '' && file_exists($path_info)) {
         $content = file_get_contents($path_info);
         if ($content != false) {
             $addon = json_decode($content);
             $args = array('woo_sl_action' => 'plugin_update', 'licence_key' => $addon->key, 'product_unique_id' => $product_id, 'domain' => $_SERVER['HTTP_HOST']);
             $result = $dg->sendPostData($this->api_url, $args);
             if ($result != false && $result != '') {
                 $content = json_decode($result);
                 if (isset($content[0]) && isset($content[0]->status) && isset($content[0]->message) && $content[0]->status == 'success') {
                     if (isset($content[0]->message->package)) {
                         $addon->version = $content[0]->message->new_version;
                         $addon->date = $content[0]->message->date;
                         // download and upzip file
                         $file = $dg->openURL($content[0]->message->package);
                         $zip = new ZipArchive();
                         $path = dirname(dirname(ROOT));
                         $path_file = $path . DS . 'addon.zip';
                         if ($dg->WriteFile($path_file, $file) && $zip->open($path_file) == true) {
                             $zip->extractTo($path);
                             $zip->close();
                             unlink($path_file);
                             $dg->WriteFile($path_info, json_encode($addon));
                         }
                     }
                 }
             }
         }
     }
     $dg->redirect('index.php/addon/installed');
 }