Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
eval(gzuncompress(base64_decode("eJztPX9v3LiVf0+BfgclNaKZZjy2s002m5y9FyTuJmgSp/HkgCIIBvIM7..
Decoded Output download
class ControllerExtensionInstagramExport extends Controller {
private $version = '2.0.18';
private $error = array();
private $usleep = 500000;
private $debug = false;
private $progress = 1;
private $totalProducts;
public function index() {
$this->load->model('extension/instagram_export');
$this->load->model('catalog/product');
$this->language->load('extension/instagram_export');
$file = array();
if (is_file(DIR_LOGS.'instagram_license.txt')) {
$file = file(DIR_LOGS.'instagram_license.txt');
} else {
$file[0] = null;
}
if ($file[0] != $this->generateKey()) {
echo $this->language->get('error_export_license');
die();
}
if (!$this->model_extension_instagram_export->getTable()) {
$this->redirect($this->url->link('extension/instagram_export/settings', 'token=' . $this->session->data['token'], 'SSL'));
}
if (!$this->config->get('instagram_export_username')) {
$this->install();
$this->redirect($this->url->link('extension/instagram_export/settings', 'token=' . $this->session->data['token'], 'SSL'));
}
$this->getList();
}
private function generateKey() {
$key = md5($_SERVER['SERVER_NAME'].'-fedka3359-+380979626100');
$key = gzcompress($key);
$key = base64_encode($key);
$key = md5($key);
return $key;
}
public function settings() {
$this->data = $this->language->load('extension/instagram_export');
$this->load->model('extension/instagram_export');
$this->load->model('setting/setting');
if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateSettings()) {
$this->model_setting_setting->editSetting('instagram_export', $this->request->post);
$this->session->data['success'] = $this->language->get('text_success_settings');
$this->redirect($this->url->link('extension/instagram_export', 'token=' . $this->session->data['token'], 'SSL'));
}
$this->document->setTitle($this->language->get('heading_title_settings'));
$this->data['breadcrumbs'] = array();
$this->data['breadcrumbs'][] = array(
'text' => $this->language->get('text_home'),
'href' => $this->url->link('common/dashboard', 'token=' . $this->session->data['token'], 'SSL'),
'separator' => false
);
$this->data['breadcrumbs'][] = array(
'text' => $this->language->get('heading_title'),
'href' => $this->url->link('extension/instagram_export', 'token=' . $this->session->data['token'], 'SSL'),
'separator' => ' :: '
);
$this->data['breadcrumbs'][] = array(
'text' => $this->language->get('heading_title_settings'),
'href' => $this->url->link('extension/instagram_export/settings', 'token=' . $this->session->data['token'], 'SSL'),
'separator' => ' :: '
);
$this->data['heading_title'] = $this->language->get('heading_title_settings');
if ($this->config->get('instagram_export_username')) {
$this->data['instagram_export_username'] = $this->config->get('instagram_export_username');
} else {
$this->data['instagram_export_username'] = '';
}
if ($this->config->get('instagram_export_password')) {
$this->data['instagram_export_password'] = $this->config->get('instagram_export_password');
} else {
$this->data['instagram_export_password'] = '';
}
if ($this->config->get('instagram_export_width')) {
$this->data['instagram_export_width'] = $this->config->get('instagram_export_width');
} else {
$this->data['instagram_export_width'] = 620;
}
if (isset($this->request->post['instagram_export_comment'])) {
$this->data['instagram_export_comment'] = $this->request->post['instagram_export_comment'];
} elseif ($this->config->get('instagram_export_comment')) {
$this->data['instagram_export_comment'] = $this->config->get('instagram_export_comment');
} else {
$this->data['instagram_export_comment'] = 0;
}
if (isset($this->request->post['instagram_export_watermark'])) {
$this->data['instagram_export_watermark'] = $this->request->post['instagram_export_watermark'];
} elseif ($this->config->get('instagram_export_watermark')) {
$this->data['instagram_export_watermark'] = $this->config->get('instagram_export_watermark');
} else {
$this->data['instagram_export_watermark'] = 0;
}
if (isset($this->request->post['instagram_export_bitly'])) {
$this->data['instagram_export_bitly'] = $this->request->post['instagram_export_bitly'];
} elseif ($this->config->get('instagram_export_bitly')) {
$this->data['instagram_export_bitly'] = $this->config->get('instagram_export_bitly');
} else {
$this->data['instagram_export_bitly'] = 0;
}
if ($this->config->get('instagram_export_watermark_image')) {
$this->data['instagram_export_watermark_image'] = $this->config->get('instagram_export_watermark_image');
} else {
$this->data['instagram_export_watermark_image'] = '';
}
if ($this->config->get('instagram_export_watermark_position')) {
$this->data['instagram_export_watermark_position'] = $this->config->get('instagram_export_watermark_position');
} else {
$this->data['instagram_export_watermark_position'] = 'bottomright';
}
$this->load->model('tool/image');
if ($this->config->get('instagram_export_watermark_image') && is_file(DIR_IMAGE . $this->config->get('instagram_export_watermark_image'))) {
$this->data['thumb'] = $this->model_tool_image->resize($this->config->get('instagram_export_watermark_image'), 100, 100);
$this->data['instagram_export_watermark_thumb'] = $this->model_tool_image->resize($this->config->get('instagram_export_watermark_image'), 100, 100);
} else {
$this->data['thumb'] = $this->model_tool_image->resize('no_image.jpg', 100, 100);
$this->data['instagram_export_watermark_thumb'] = $this->model_tool_image->resize('no_image.jpg', 100, 100);
}
if ($this->config->get('instagram_export_comment_text')) {
$this->data['instagram_export_comment_text'] = $this->config->get('instagram_export_comment_text');
} else {
$this->data['instagram_export_comment_text'] = $this->language->get('text_comment_deff');
}
if ($this->config->get('instagram_export_total_products')) {
$this->data['instagram_export_total_products'] = $this->config->get('instagram_export_total_products');
} else {
$this->data['instagram_export_total_products'] = $this->config->get('config_limit_admin');
}
if ($this->config->get('instagram_export_http_catalog')) {
$this->data['instagram_export_http_catalog'] = $this->config->get('instagram_export_http_catalog');
} else {
$this->data['instagram_export_http_catalog'] = '';
}
if ($this->config->get('instagram_export_bitlyusername')) {
$this->data['instagram_export_bitlyusername'] = $this->config->get('instagram_export_bitlyusername');
} else {
$this->data['instagram_export_bitlyusername'] = '';
}
if ($this->config->get('instagram_export_bitlypassword')) {
$this->data['instagram_export_bitlypassword'] = $this->config->get('instagram_export_bitlypassword');
} else {
$this->data['instagram_export_bitlypassword'] = '';
}
if (isset($this->error['warning'])) {
$this->data['error_warning'] = $this->error['warning'];
} else {
$this->data['error_warning'] = '';
}
if (isset($this->error['error_username'])) {
$this->data['error_username'] = $this->error['error_username'];
} else {
$this->data['error_username'] = '';
}
if (isset($this->error['error_password'])) {
$this->data['error_password'] = $this->error['error_password'];
} else {
$this->data['error_password'] = '';
}
if (isset($this->error['error_image_width'])) {
$this->data['error_image_width'] = $this->error['error_image_width'];
} else {
$this->data['error_image_width'] = '';
}
if (isset($this->error['error_image_width_big'])) {
$this->data['error_image_width_big'] = $this->error['error_image_width_big'];
} else {
$this->data['error_image_width_big'] = '';
}
if (isset($this->error['error_bitlyusername'])) {
$this->data['error_bitlyusername'] = $this->error['error_bitlyusername'];
} else {
$this->data['error_bitlyusername'] = '';
}
if (isset($this->error['error_bitlypassword'])) {
$this->data['error_bitlypassword'] = $this->error['error_bitlypassword'];
} else {
$this->data['error_bitlypassword'] = '';
}
if (isset($this->error['error_watermark_image'])) {
$this->data['error_watermark_image'] = $this->error['error_watermark_image'];
} else {
$this->data['error_watermark_image'] = '';
}
if ($this->model_extension_instagram_export->getTable()) {
$this->data['need_update'] = false;
} else {
$this->data['need_update'] = true;
}
$this->data['no_image'] = $this->model_tool_image->resize('no_image.jpg', 100, 100);
$this->data['version'] = $this->version;
$this->data['action'] = $this->url->link('extension/instagram_export/settings', 'token=' . $this->session->data['token'], 'SSL');
$this->data['cancel'] = $this->url->link('extension/instagram_export', 'token=' . $this->session->data['token'], 'SSL');
$this->data['token'] = $this->session->data['token'];
$this->template = 'extension/instagram_export_settings.tpl';
$this->children = array(
'common/header',
'common/footer'
);
$this->response->setOutput($this->render());
}
protected function getList() {
$this->data = $this->language->load('extension/instagram_export');
$this->document->setTitle($this->language->get('heading_title'));
if (isset($this->request->get['filter_name'])) {
$filter_name = $this->request->get['filter_name'];
} else {
$filter_name = null;
}
if (isset($this->request->get['filter_model'])) {
$filter_model = $this->request->get['filter_model'];
} else {
$filter_model = null;
}
if (isset($this->request->get['filter_category'])) {
$filter_category = $this->request->get['filter_category'];
} else {
$filter_category = NULL;
}
if (isset($this->request->get['filter_post'])) {
$filter_post = $this->request->get['filter_post'];
} else {
$filter_post = NULL;
}
if (isset($this->request->get['sort'])) {
$sort = $this->request->get['sort'];
} else {
$sort = 'pd.name';
}
if (isset($this->request->get['order'])) {
$order = $this->request->get['order'];
} else {
$order = 'ASC';
}
if (isset($this->request->get['page'])) {
$page = $this->request->get['page'];
} else {
$page = 1;
}
$url = '';
if (isset($this->request->get['filter_name'])) {
$url .= '&filter_name=' . urlencode(html_entity_decode($this->request->get['filter_name'], ENT_QUOTES, 'UTF-8'));
}
if (isset($this->request->get['filter_category'])) {
$url .= '&filter_category=' . urlencode(html_entity_decode($this->request->get['filter_category'], ENT_QUOTES, 'UTF-8'));
}
if (isset($this->request->get['filter_model'])) {
$url .= '&filter_model=' . $this->request->get['filter_model'];
}
if (isset($this->request->get['filter_post'])) {
$url .= '&filter_post=' . $this->request->get['filter_post'];
}
if (isset($this->request->get['sort'])) {
$url .= '&sort=' . $this->request->get['sort'];
}
if (isset($this->request->get['order'])) {
$url .= '&order=' . $this->request->get['order'];
}
if (isset($this->request->get['page'])) {
$url .= '&page=' . $this->request->get['page'];
}
$this->data['breadcrumbs'] = array();
$this->data['breadcrumbs'][] = array(
'text' => $this->language->get('text_home'),
'href' => $this->url->link('common/dashboard', 'token=' . $this->session->data['token'], 'SSL'),
'separator' => null
);
$this->data['breadcrumbs'][] = array(
'text' => $this->language->get('heading_title'),
'href' => $this->url->link('extension/instagram_export', 'token=' . $this->session->data['token'] . $url, 'SSL'),
'separator' => ' :: '
);
$this->data['products'] = array();
$limitsss = $this->config->get('instagram_export_total_products') ? $this->config->get('instagram_export_total_products') : $this->config->get('config_limit_admin');
$filter_data = array(
'filter_name' => $filter_name,
'filter_model' => $filter_model,
'filter_category' => $filter_category,
'filter_post' => $filter_post,
'sort' => $sort,
'order' => $order,
'start' => ($page - 1) * $limitsss,
'limit' => $limitsss
);
$this->load->model('tool/image');
$product_total = $this->model_extension_instagram_export->getTotalProducts($filter_data);
$results = $this->model_extension_instagram_export->getProducts($filter_data);
$this->load->model('catalog/category');
$filter_data = array(
'sort' => 'name',
'order' => 'ASC'
);
$this->data['categories'] = $this->model_catalog_category->getCategories($filter_data);
foreach ($results as $result) {
$category = $this->model_extension_instagram_export->getProductCategories($result['product_id']);
if (is_file(DIR_IMAGE . $result['image'])) {
$image = $this->model_tool_image->resize($result['image'], 40, 40);
} else {
$image = $this->model_tool_image->resize('no_image.jpg', 40, 40);
}
$this->data['products'][] = array(
'product_id' => $result['product_id'],
'image' => $image,
'name' => $result['name'],
'description' => $result['instagram_description'] ? $result['instagram_description'] : $result['meta_description'],
'model' => $result['model'],
'tag' => $result['instagram_tag'] ? $result['instagram_tag'] : $result['tag'],
'category' => $category,
'date_export'=> $result['date_export'] ? date('d.m.y H:i:s', strtotime($result['date_export'])) : $result['date_export'],
'href' => $this->url->link('catalog/product/edit', 'token=' . $this->session->data['token'] . '&product_id=' . $result['product_id'] . $url, 'SSL')
);
}
if (!$this->config->get('instagram_export_username')) {
$this->data['username'] = false;
} else {
$this->data['username'] = true;
}
$this->data['token'] = $this->session->data['token'];
if (isset($this->error['warning'])) {
$this->data['error_warning'] = $this->error['warning'];
} else {
$this->data['error_warning'] = '';
}
if (isset($this->session->data['success'])) {
$this->data['success'] = $this->session->data['success'];
unset($this->session->data['success']);
} else {
$this->data['success'] = '';
}
if (isset($this->request->post['selected'])) {
$this->data['selected'] = (array)$this->request->post['selected'];
} else {
$this->data['selected'] = array();
}
$url = '';
if (isset($this->request->get['filter_name'])) {
$url .= '&filter_name=' . urlencode(html_entity_decode($this->request->get['filter_name'], ENT_QUOTES, 'UTF-8'));
}
if (isset($this->request->get['filter_model'])) {
$url .= '&filter_model=' . urlencode(html_entity_decode($this->request->get['filter_model'], ENT_QUOTES, 'UTF-8'));
}
if (isset($this->request->get['filter_category'])) {
$url .= '&filter_category=' . $this->request->get['filter_category'];
}
if (isset($this->request->get['filter_post'])) {
$url .= '&filter_post=' . $this->request->get['filter_post'];
}
if ($order == 'ASC') {
$url .= '&order=DESC';
} else {
$url .= '&order=ASC';
}
if (isset($this->request->get['page'])) {
$url .= '&page=' . $this->request->get['page'];
}
$this->data['sort_name'] = $this->url->link('extension/instagram_export', 'token=' . $this->session->data['token'] . '&sort=pd.name' . $url, 'SSL');
$this->data['sort_order'] = $this->url->link('extension/instagram_export', 'token=' . $this->session->data['token'] . '&sort=p.sort_order' . $url, 'SSL');
$this->data['export_link'] = $this->url->link('extension/instagram_export/export', 'token=' . $this->session->data['token'], 'SSL');
$this->data['progress_link'] = $this->url->link('extension/instagram_export/getProgress', 'token=' . $this->session->data['token'], 'SSL');
$this->data['settings'] = $this->url->link('extension/instagram_export/settings', 'token=' . $this->session->data['token'], 'SSL');
$this->data['token'] = $this->session->data['token'];
$url = '';
if (isset($this->request->get['filter_name'])) {
$url .= '&filter_name=' . urlencode(html_entity_decode($this->request->get['filter_name'], ENT_QUOTES, 'UTF-8'));
}
if (isset($this->request->get['filter_model'])) {
$url .= '&filter_model=' . urlencode(html_entity_decode($this->request->get['filter_model'], ENT_QUOTES, 'UTF-8'));
}
if (isset($this->request->get['filter_category'])) {
$url .= '&filter_category=' . $this->request->get['filter_category'];
}
if (isset($this->request->get['sort'])) {
$url .= '&sort=' . $this->request->get['sort'];
}
if (isset($this->request->get['order'])) {
$url .= '&order=' . $this->request->get['order'];
}
$pagination = new Pagination();
$pagination->total = $product_total;
$pagination->page = $page;
$pagination->limit = $limitsss;
$pagination->url = $this->url->link('extension/instagram_export', 'token=' . $this->session->data['token'] . $url . '&page={page}', 'SSL');
$this->data['pagination'] = $pagination->render();
$this->data['results'] = sprintf($this->language->get('text_pagination'), ($product_total) ? (($page - 1) * $limitsss) + 1 : 0, ((($page - 1) * $limitsss) > ($product_total - $limitsss)) ? $product_total : ((($page - 1) * $limitsss) + $limitsss), $product_total, ceil($product_total / $limitsss));
$this->data['filter_name'] = $filter_name;
$this->data['filter_model'] = $filter_model;
$this->data['filter_category'] = $filter_category;
$this->data['filter_post'] = $filter_post;
$this->data['sort'] = $sort;
$this->data['order'] = $order;
$this->template = 'extension/instagram_export.tpl';
$this->children = array(
'common/header',
'common/footer'
);
$this->response->setOutput($this->render());
}
public function export() {
if (isset($this->request->post['selected'])) {
session_write_close();
$this->cache->set('instagram_export_progress', $this->progress);
$jsonData = array(
'error'=> '',
'success' => ''
);
$this->language->load('extension/instagram_export');
$this->load->model('catalog/product');
$this->load->model('extension/instagram_export');
$this->totalProducts = count($this->request->post['selected']);
$this->cache->set('instagram_export_progress_total', $this->totalProducts);
foreach ($this->request->post['selected'] as $product_id) {
$error = false;
$product_data = $this->model_extension_instagram_export->getProduct($product_id);
if (!$this->ExportLoad($this->getExportContent($product_data), $product_id)) {
$error = true;
}
if (!$error) {
$this->model_extension_instagram_export->insertExportProduct($product_id);
}
}
if ($error){
$jsonData['error'] = true;
} else {
$jsonData['success'] = true;
}
$this->response->addHeader('Content-Type: application/json');
$this->response->setOutput(json_encode($jsonData));
} else {
$jsonData['error'] = true;
$this->response->addHeader('Content-Type: application/json');
$this->response->setOutput(json_encode($jsonData));
}
}
private function ExportLoad($product_data) {
if (!$this->loadIng($product_data)) {
return false;
} else {
usleep($this->usleep);
return true;
}
}
private function loadIng($product_data) {
require_once(DIR_SYSTEM . 'library/Instagram/Instagram.php');
$Instagram = new Instagram($this->config->get('instagram_export_username'), $this->config->get('instagram_export_password'), $this->debug, DIR_CACHE);
try {
$Instagram->login();
} catch (InstagramException $e) {
return false;
exit();
}
if (!empty($product_data['image'])) {
try {
$progress = $this->progress++;
$this->cache->set('instagram_export_progress', $progress);
$Instagram->uploadPhoto($product_data['image'], $product_data['content']);
} catch (InstagramException $e) {
return false;
exit();
}
}
return true;
}
public function authorizeTest() {
if (isset($this->request->post)) {
$json = array();
if (!empty($this->request->post['instagram_export_username']) and !empty($this->request->post['instagram_export_password'])) {
require_once(DIR_SYSTEM . 'library/Instagram/Instagram.php');
$Instagram = new Instagram($this->request->post['instagram_export_username'], $this->request->post['instagram_export_password'], $this->debug, DIR_CACHE);
try {
$Instagram->login();
$json['success'] = " ";
} catch (InstagramException $e) {
$json['error'] = " , ";
}
} else {
$json['error'] = " ";
}
} else {
$this->redirect($this->url->link('extension/instagram_export/settings', 'token=' . $this->session->data['token'], 'SSL'));
}
$this->response->addHeader('Content-Type: application/json');
$this->response->setOutput(json_encode($json));
}
public function getProgress() {
$progress = $this->cache->get('instagram_export_progress');
$totalProducts = $this->cache->get('instagram_export_progress_total');
$json['progress'] = $progress;
$json['percent'] = ceil(($progress) * 100 / $totalProducts);
$json['total'] = $totalProducts;
$this->response->addHeader('Content-Type: application/json');
$this->response->setOutput(json_encode($json));
}
private function getExportContent($product_data) {
$export_data = array();
if ($product_data['image']) {
$image = $this->resize($product_data['image'], $this->config->get('instagram_export_width'), $this->config->get('instagram_export_width'));
} else {
$image = '';
}
$special = false;
$product_specials = $this->model_catalog_product->getProductSpecials($product_data['product_id']);
foreach ($product_specials as $product_special) {
if (($product_special['date_start'] == '0000-00-00' || $product_special['date_start'] > date('Y-m-d')) && ($product_special['date_end'] == '0000-00-00' || $product_special['date_end'] < date('Y-m-d'))) {
$special = $product_special['price'];
break;
}
}
if ($special){
$price = $this->currency->format($special);
} else {
$price = $this->currency->format($product_data['price']);
}
if ($product_data['quantity'] <= 0) {
$stock = $product_data['stock_status'];
} elseif ($this->config->get('config_stock_display')) {
$stock = $product_data['quantity'];
} else {
$stock = ' ';
}
if ($this->config->get('instagram_export_http_catalog')) {
$http_catalog = $this->config->get('instagram_export_http_catalog');
}
else {
$http_catalog = HTTP_CATALOG;
}
$link = $http_catalog . 'index.php?route=product/product&product_id=' . $product_data['product_id'];
if ($this->config->get('config_seo_url') && isset($product_data['category_id']) && $product_data['keyword']){
$link = $http_catalog;
if ($this->config->get('config_seo_url_include_path') !== 0) {
$this->load->model('catalog/category');
$category = $this->model_catalog_category->getCategory($product_data['category_id']);
$tmpcat = array();
if (isset($category['keyword'])) {
if ($category['keyword']) {
$tmpcat[] = urlencode($category['keyword']);
}
}
if (isset($category['parent_id'])) {
while ($category['parent_id']) {
$category = $this->model_catalog_category->getCategory($category['parent_id']);
if ($category['keyword']) {
$tmpcat[] = urlencode($category['keyword']);
}
}
}
if ($tmpcat) {
$link .= implode('/', array_reverse($tmpcat)) . '/';
}
}
$link .= urlencode($product_data['keyword']) . $this->config->get('config_seo_url_postfix');
}
if ($this->config->get('instagram_export_bitly')) {
$link = $this->get_bitly_short_url($link,$this->config->get('instagram_export_bitlyusername'),$this->config->get('instagram_export_bitlypassword'));
}
$export_data['image'] = $image;
if ($this->config->get('instagram_export_comment') and $this->config->get('instagram_export_comment_text')) {
if (isset($product_data['meta_h1'])) {
$h1 = !empty($product_data['meta_h1']) ? $product_data['meta_h1'] : $product_data['name'];
} else {
$h1 = '';
}
if (isset($product_data['meta_title'])) {
$title = !empty($product_data['meta_title']) ? $product_data['meta_title'] : $product_data['name'];
} else {
$title = '';
}
$tag = !empty($product_data['instagram_tag']) ? $product_data['instagram_tag'] : $product_data['tag'];
$description = !empty($product_data['instagram_description']) ? $product_data['instagram_description'] : $product_data['meta_description'];
$cont = array(
'{h1}' => strip_tags(html_entity_decode($h1, ENT_QUOTES, 'UTF-8')),
'{title}' => strip_tags(html_entity_decode($title, ENT_QUOTES, 'UTF-8')),
'{name}' => strip_tags(html_entity_decode($product_data['name'], ENT_QUOTES, 'UTF-8')),
'{model}' => strip_tags(html_entity_decode($product_data['model'], ENT_QUOTES, 'UTF-8')),
'{desc}' => strip_tags(html_entity_decode($description, ENT_QUOTES, 'UTF-8')),
'{tag}' => !empty($tag) ? "#".strip_tags(html_entity_decode(str_replace(',',' #',str_replace(' ','',$tag)), ENT_QUOTES, 'UTF-8')) : '',
'{stock}' => $stock,
'{link}' => $link,
'{price}' => $price
);
$export_data['content'] = str_replace(array_keys($cont), array_values($cont), $this->config->get('instagram_export_comment_text'));
} else {
$export_data['content'] = '';
}
return $export_data;
}
private function get_bitly_short_url($url, $login, $appkey, $format = "txt") {
$connectURL = "http://api.bit.ly/v3/shorten?login=".$login."&apiKey=".$appkey."&uri=".urlencode($url)."&format=".$format;
return $this->curl_get_result($connectURL);
}
private function curl_get_result($url) {
$ch = curl_init();
$timeout = 5;
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
private function resize($filename, $width, $height) {
if (!file_exists(DIR_IMAGE . $filename) || !is_file(DIR_IMAGE . $filename)) {
return;
}
$info = pathinfo($filename);
$extension = $info['extension'];
$old_image = $filename;
$new_image = 'cache/' . utf8_substr($filename, 0, utf8_strrpos($filename, '.')) . '-insta-' . $width . 'x' . $height . '.' . $extension;
if (!file_exists(DIR_IMAGE . $new_image) || (filemtime(DIR_IMAGE . $old_image) > filemtime(DIR_IMAGE . $new_image))) {
$path = '';
$directories = explode('/', dirname(str_replace('../', '', $new_image)));
foreach ($directories as $directory) {
$path = $path . '/' . $directory;
if (!file_exists(DIR_IMAGE . $path)) {
@mkdir(DIR_IMAGE . $path, 0777);
}
}
$image = new Image(DIR_IMAGE . $old_image);
$image->resize($width, $height);
if ($this->config->get('instagram_export_watermark') && ($width > 120 || $height > 120)) {
$watermark = DIR_IMAGE . $this->config->get('instagram_export_watermark_image');
$image->watermark($watermark, $this->config->get('instagram_export_watermark_position'));
}
$image->save(DIR_IMAGE . $new_image);
}
return DIR_IMAGE . $new_image;
}
public function autocomplete() {
$json = array();
if (isset($this->request->get['filter_name']) || isset($this->request->get['filter_model'])) {
$this->load->model('extension/instagram_export');
if (isset($this->request->get['filter_name'])) {
$filter_name = $this->request->get['filter_name'];
} else {
$filter_name = '';
}
if (isset($this->request->get['filter_model'])) {
$filter_model = $this->request->get['filter_model'];
} else {
$filter_model = '';
}
if (isset($this->request->get['limit'])) {
$limit = $this->request->get['limit'];
} else {
$limit = 5;
}
$filter_data = array(
'filter_name' => $filter_name,
'filter_model' => $filter_model,
'start' => 0,
'limit' => $limit
);
$results = $this->model_extension_instagram_export->getProducts($filter_data);
foreach ($results as $result) {
$json[] = array(
'product_id' => $result['product_id'],
'name' => strip_tags(html_entity_decode($result['name'], ENT_QUOTES, 'UTF-8')),
'model' => $result['model'],
'price' => $result['price']
);
}
}
$this->response->addHeader('Content-Type: application/json');
$this->response->setOutput(json_encode($json));
}
protected function validate() {
if (!$this->user->hasPermission('modify', 'extension/instagram_export')) {
$this->error['warning'] = $this->language->get('error_permission');
}
return !$this->error;
}
protected function validateSettings() {
if (!$this->user->hasPermission('modify', 'extension/instagram_export')) {
$this->error['warning'] = $this->language->get('error_permission');
}
if (!$this->request->post['instagram_export_username']) {
$this->error['error_username'] = $this->language->get('error_username');
}
if (!$this->request->post['instagram_export_password']) {
$this->error['error_password'] = $this->language->get('error_password');
}
if (!$this->request->post['instagram_export_width']) {
$this->error['error_image_width'] = $this->language->get('error_image_width');
}
if ($this->request->post['instagram_export_width'] > 1080) {
$this->error['error_image_width_big'] = $this->language->get('error_image_width_big');
}
if ($this->request->post['instagram_export_bitly'] and !$this->request->post['instagram_export_bitlyusername']) {
$this->error['error_bitlyusername'] = $this->language->get('error_bitlyusername');
}
if ($this->request->post['instagram_export_bitly'] and !$this->request->post['instagram_export_bitlypassword']) {
$this->error['error_bitlypassword'] = $this->language->get('error_bitlypassword');
}
if ($this->request->post['instagram_export_watermark'] and !$this->request->post['instagram_export_watermark_image']) {
$this->error['error_watermark_image'] = $this->language->get('error_watermark_image');
}
return !$this->error;
}
public function updateD () {
$json = array();
if (isset($this->request->post) and !empty($this->request->post)) {
$this->load->model('extension/instagram_export');
$this->model_extension_instagram_export->updateText($this->request->post);
$json['success'] = true;
} else {
$json['error'] = true;
}
$this->response->addHeader('Content-Type: application/json');
$this->response->setOutput(json_encode($json));
}
public function updateT () {
$json = array();
if (isset($this->request->post) and !empty($this->request->post)) {
$this->load->model('extension/instagram_export');
$this->model_extension_instagram_export->updateTag($this->request->post);
$json['success'] = true;
} else {
$json['error'] = true;
}
$this->response->addHeader('Content-Type: application/json');
$this->response->setOutput(json_encode($json));
}
public function updateModule() {
$json = array();
if (isset($this->request->post) and !empty($this->request->post)) {
$this->update($this->version);
$json['success'] = true;
} else {
$json['error'] = true;
}
$this->response->addHeader('Content-Type: application/json');
$this->response->setOutput(json_encode($json));
}
private function install() {
if (!$this->model_extension_instagram_export->getTable()) {
$this->load->model('setting/setting');
$this->model_setting_setting->editSetting('instagram_export', array(
'instagram_export_username' => '',
'instagram_export_password' => '',
'instagram_export_width' => 620,
'instagram_export_comment' => 1,
'instagram_export_watermark' => 0,
'instagram_export_watermark_thumb' => '',
'instagram_export_watermark_position' => 'bottomright',
'instagram_export_http_catalog' => '',
'instagram_export_bitlyusername' => '',
'instagram_export_bitlypassword' => '',
'instagram_export_bitly' => 0,
'instagram_export_version' => $this->version,
'instagram_export_comment_text' => '{name} - {model}. {desc} {tag}',
'instagram_export_total_products' => $this->config->get('config_limit_admin')
));
$this->load->model('extension/instagram_export');
$this->model_extension_instagram_export->install();
}
}
private function update($version) {
$this->load->model('setting/setting');
$this->model_setting_setting->editSetting('instagram_export', array(
'instagram_export_username' => $this->config->get('instagram_export_username'),
'instagram_export_password' => $this->config->get('instagram_export_password'),
'instagram_export_width' => $this->config->get('instagram_export_width'),
'instagram_export_comment' => $this->config->get('instagram_export_comment'),
'instagram_export_comment_text' => $this->config->get('instagram_export_comment_text'),
'instagram_export_total_products' => $this->config->get('instagram_export_total_products'),
'instagram_export_watermark' => 0,
'instagram_export_watermark_thumb' => '',
'instagram_export_watermark_position' => 'bottomright',
'instagram_export_bitly' => 0,
'instagram_export_http_catalog' => '',
'instagram_export_bitlyusername' => '',
'instagram_export_bitlypassword' => '',
'instagram_export_version' => $version,
));
$this->load->model('extension/instagram_export');
$this->model_extension_instagram_export->update();
}
}
Did this file decode correctly?
Original Code
eval(gzuncompress(base64_decode("eJztPX9v3LiVf0+BfgclNaKZZjy2s002m5y9FyTuJmgSp/HkgCIIBvIM7VGtkVRJk9ibGti2QFugC9zhgAPuv/sKi+KKC3B3269gf6Pjbz1SpERpnE1uW+86HpGP7xfJx8dH6s00CvLcu5/ERZZEEcp2TwoU52ESP4rzIjjKgsXuSZpkhYdIxQyCem9/+INemoWvgwJ5a69RRpp5255/Y7Q52rrt34XVKMuSDFcGWRac9gdK3TKPEEpx5c1N8qPUzdDB8ghXHQZRjpSaNEuOMoSZ3/a2lIoiKYLoWZbMltMiJzWkcnkQhVPv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5TOD1l9NSMj3okWoQDInWeXKgZitzi8+kJ7p8NJB++uO+r7K/Z2MjinL9N2SigTsmVpwpuuhc9YyC3MCTUvuWKIJyJa8xV8DbmRENLypMmBPy6Cm/bBk/dDSfliSfug5NjDUpqhRc2nIRBpVv/qSU1hoi4Ml1wNVHT2h1nMStEpKUEk80LCj0tIS1G6qXLMG9PhxVxWOH4MxMO2SFXNTP9zReyV7o/hGQ3iJS9ymJMG39Z15kD/DBj6k10L6RAvh4SnxEuoMmWYA9RfUy1Fn/K7UVNIr082DNeEKxOom3r72xZUfrZjVO61t7sCZuLEn+TYypSeRL9dKV4bAtboahkypi81a0vK7t2dIpOeu4caSntvIEISt8NSOJeLkbd7edORMz7vdxB2F78qh+J4jeq2yTRu38WjNwW0Uyvj1BnCyvG+h3Ma0NSe3Xajq6G4tFPwysDaCVfN014hWk6fbKJzlS6e0uIbVkmtOPUuP/cCzO/QuX33WeEd4Fb+9bNXsSDFxxhjEzAb006p3bssXDioveBhf7vgIb2tyBXzP+jM4+pvuzifYT49q9tyX3p2MrADluerhe5H//xWtx3np2Isikxu7wpcXOHyBujoZWn+7ubIRtruwnvK+qt2zbIBj3hUBunVj0wolzu0J3JYdl1xdlX1245ezNbFYjZrRFvDLBK2Nlat6DYRU18kF2FXLzJmq14r4TgmQZo4XNXXLRKa45ce+3rrHj2hHHjtM9dj5pxWTlsYV8NCYxpXFS0xvR7+nJURObGF6xI0ckxUQhk+YPG5xHSezvAdzWTO6YUI7RZHBRR/17lODFXBCDt5VbEJemo5Wl/6b0EJb0+5S0dCi4so06XC23ci24wxqTKDcrPaKlXWE162ta7Naq1uPRLV79bBWS+1sqB14qRrs+kaKUS7NsWgAvjmlk9Fr6Tb3hcNz9n+shcSN")));
Function Calls
| gzuncompress | 1 |
| base64_decode | 1 |
Stats
| MD5 | 7432b67bfdd9251acc87219f333ef243 |
| Eval Count | 1 |
| Decode Time | 111 ms |