Beispiel #1
0
 public function frameResponse(\FrameResponseObject $frameResponseObject)
 {
     $html = "";
     if (isset($this->params[0]) && $this->params[0] != "") {
         $extension = \ExtensionMaster::getInstance()->getExtensionById($this->params[0]);
         $html = $extension->getInfoHtml();
     } else {
         $content = \Admin::getInstance()->loadTemplate("ExtensionIndex.template.html");
         $extensions = \ExtensionMaster::getInstance()->getAllExtensions();
         foreach ($extensions as $extension) {
             $content->setCurrentBlock("BLOCK_EXTERNSION");
             $content->setVariable("EXTERNSION_ID", $extension->getId());
             $content->setVariable("EXTERNSION_NAME", $extension->getName());
             $content->setVariable("EXTERNSION_ICON", "");
             $content->setVariable("EXTERNSION_VERSION", $extension->getVersion());
             $content->parse("BLOCK_EXTERNSION");
         }
         $html = $content->get();
     }
     $rawHtml = new \Widgets\RawHtml();
     $rawHtml->setHtml($html);
     $frameResponseObject->setTitle("Extension Information");
     $frameResponseObject->addWidget($rawHtml);
     return $frameResponseObject;
 }
Beispiel #2
0
 public static function writePackageSubscribeLog($user_id, $package_id, $set_state)
 {
     $data = array('user_id' => $user_id, 'set_state' => $set_state, 'package_id' => $package_id);
     if (!empty(Stb::getInstance()->id) && (empty($_SERVER['TARGET']) || $_SERVER['TARGET'] !== 'API' && $_SERVER['TARGET'] !== 'ADM')) {
         $data['initiator_id'] = Stb::getInstance()->id;
         $data['initiator'] = 'user';
     } else {
         $data['initiator_id'] = Admin::getInstance()->getId();
         if (!empty($data['initiator_id'])) {
             $data['initiator'] = 'admin';
         }
     }
     Mysql::getInstance()->insert('package_subscribe_log', $data);
 }
Beispiel #3
0
<?php

/**
 * CubeCart v6
 * ========================================
 * CubeCart is a registered trade mark of CubeCart Limited
 * Copyright CubeCart Limited 2015. All rights reserved.
 * UK Private Limited Company No. 5323904
 * ========================================
 * Web:   http://www.cubecart.com
 * Email:  sales@cubecart.com
 * License:  GPL-3.0 https://www.gnu.org/licenses/quick-guide-gplv3.html
 */
if (!defined('CC_INI_SET')) {
    die('Access Denied');
}
Admin::getInstance()->permissions('settings', CC_PERM_EDIT, true);
$GLOBALS['main']->addTabControl('PHP Info', 'php_info');
$GLOBALS['gui']->addBreadcrumb('PHP Info', '?_g=phpinfo', true);
ob_start();
phpinfo();
preg_match('%<style type="text/css">(.*?)</style>.*?<body>(.*?)</body>%s', ob_get_clean(), $matches);
$page_content = "<div class='phpinfodisplay tab_content' id='php_info'><style type='text/css'>\n";
$page_content .= join("\n", array_map(create_function('$i', 'return ".phpinfodisplay " . preg_replace( "/,/", ",.phpinfodisplay ", $i );'), preg_split('/\\n/', trim(preg_replace("/\nbody/", "\n", $matches[1])))));
$page_content .= "</style>\n" . $matches[2] . "\n</div>\n";
             if (is_array($email_types[$data['content_type']]['macros'])) {
                 foreach ($email_types[$data['content_type']]['macros'] as $macro => $desc) {
                     $macro_data['name'] = htmlspecialchars($macro);
                     $macro_data['description'] = $desc;
                     $smarty_data['macros'][] = $macro_data;
                 }
                 $GLOBALS['smarty']->assign('CONTENT_MACROS', $smarty_data['macros']);
             }
             $GLOBALS['smarty']->assign('DISPLAY_CONTENT_FORM', true);
     }
     break;
 case 'template':
     ## EMAIL TEMPLATES
     switch (strtolower($_GET['action'])) {
         case 'delete':
             if (isset($_GET['template_id']) && is_numeric($_GET['template_id']) && Admin::getInstance()->permissions('documents', CC_PERM_DELETE)) {
                 if ($GLOBALS['db']->delete('CubeCart_email_template', array('template_id' => (int) $_GET['template_id']))) {
                     httpredir(currentPage(array('action', 'type', 'template_id')), 'email_templates');
                 }
             }
             break;
         default:
             if (in_array(strtolower($_GET['action']), array('clone', 'edit')) && isset($_GET['template_id']) && is_numeric($_GET['template_id'])) {
                 ## Edit Template
                 $template = $GLOBALS['db']->select('CubeCart_email_template', false, array('template_id' => (int) $_GET['template_id']));
                 if ($template) {
                     $data = $template[0];
                     if (strtolower($_GET['action']) == 'clone') {
                         unset($data['template_id']);
                     } else {
                         $breadcrumb = $data['title'];
Beispiel #5
0
 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  */
 protected function setUp()
 {
     $this->markTestSkipped('side effects');
     $this->object = Admin::getInstance();
 }
}
$_GET['_g'] = isset($_GET['_g']) ? $_GET['_g'] : 'login';
switch (strtolower($_GET['_g'])) {
    case 'recovery':
        if (isset($_POST['email']) && isset($_POST['validate']) && isset($_POST['password'])) {
            if (!Admin::getInstance()->passwordReset($_POST['email'], $_POST['validate'], $_POST['password'])) {
                $GLOBALS['gui']->setError($lang['account']['error_validation']);
            }
        }
        $GLOBALS['smarty']->assign('REQUEST', $_REQUEST);
        $GLOBALS['smarty']->assign('RECOVERY', true);
        break;
    case 'password':
        if (isset($_POST['email']) && isset($_POST['username'])) {
            // Send a recovery email
            if (Admin::getInstance()->passwordRequest($_POST['username'], $_POST['email'])) {
                $GLOBALS['gui']->setNotify($lang['account']['notify_password_recovery']);
            } else {
                $GLOBALS['gui']->setError($lang['account']['error_details_wrong']);
            }
        }
        $GLOBALS['smarty']->assign('PASSWORD', true);
        break;
    default:
        switch (true) {
            case isset($_GET['redir']) && !empty($_GET['redir']):
                $redir = $_GET['redir'];
                break;
            case isset($_POST['redir']) && !empty($_POST['redir']):
                $redir = $_POST['redir'];
                break;
Beispiel #7
0
 /**
  * Work out SQL where clause
  *
  * @param bool $original
  * @param bool $label
  * @param bool $force
  * @return string
  */
 public function outOfStockWhere($original = false, $label = false, $force = false)
 {
     $def = $original ? str_replace('WHERE ', '', $GLOBALS['db']->where('CubeCart_inventory', $original)) : '';
     if ($GLOBALS['config']->get('config', 'hide_out_of_stock') && !Admin::getInstance()->is()) {
         $def .= $force || $def ? ' AND' : '';
         $oos = sprintf('%1$s ((%2$s.stock_level > 0 AND %2$s.use_stock_level = 1) OR %2$s.use_stock_level = 0)', $def, $label ? $label : sprintf('%sCubeCart_inventory', $GLOBALS['config']->get('config', 'dbprefix')));
     }
     return $GLOBALS['config']->get('config', 'hide_out_of_stock') && !Admin::getInstance()->is() ? $oos : $def;
 }
Beispiel #8
0
    $GLOBALS['cache']->clear();
    $GLOBALS['cache']->tidy();
    $GLOBALS['main']->setACPNotify($lang['maintain']['notify_cache_cleared']);
    $clear_post = true;
}
if (isset($_POST['clearSQLCache']) && Admin::getInstance()->permissions('maintenance', CC_PERM_DELETE)) {
    $GLOBALS['cache']->clear('sql');
    $GLOBALS['main']->setACPNotify($lang['maintain']['notify_cache_cleared']);
    $clear_post = true;
}
if (isset($_POST['clearLangCache']) && Admin::getInstance()->permissions('maintenance', CC_PERM_DELETE)) {
    $GLOBALS['cache']->clear('lang');
    $GLOBALS['main']->setACPNotify($lang['maintain']['notify_cache_cleared']);
    $clear_post = true;
}
if (isset($_POST['clearImageCache']) && Admin::getInstance()->permissions('maintenance', CC_PERM_DELETE)) {
    function cleanImageCache($path = null)
    {
        $path = isset($path) && is_dir($path) ? $path : CC_ROOT_DIR . '/images/cache' . '/';
        $scan = glob($path . '*', GLOB_MARK);
        if (is_array($scan) && !empty($scan)) {
            foreach ($scan as $result) {
                if (is_dir($result)) {
                    cleanImageCache($result);
                    rmdir($result);
                } else {
                    unlink($result);
                }
            }
        }
    }
Beispiel #9
0
/**
 * Take the store offline?
 */
function offline()
{
    ## Check if store should be offline or not
    if ($GLOBALS['config']->get('config', 'offline')) {
        ## Only show offline content if no admin session or admin is not allowed to view store front
        if (!Admin::getInstance()->is()) {
            $offlineContent = stripslashes($GLOBALS['config']->get('config', 'offline_content'));
            // No needs to base64_decode as the main config is already plain since 5.1.1
            $offlineFiles = glob('offline.{php,htm,html,txt}', GLOB_BRACE);
            if (!empty($offlineFiles) && is_array($offlineFiles)) {
                foreach ($offlineFiles as $file) {
                    include $file;
                    break;
                }
            } else {
                echo $offlineContent;
            }
            ## Load 'offline' hooks
            foreach ($GLOBALS['hooks']->load('offline') as $hook) {
                include $hook;
            }
            exit;
        } else {
            $GLOBALS['smarty']->assign('STORE_OFFLINE', true);
        }
    }
}
Beispiel #10
0
            if ($status_updated) {
                $GLOBALS['main']->setACPNotify($lang['documents']['notify_document_status']);
            }
        }
        ## If no changes have been made let administrator know
        if (!$updated && !$status_updated && !$order_updated) {
            $GLOBALS['main']->setACPWarning($lang['common']['notify_no_changes']);
        }
        httpredir(currentPage());
    }
}
if (isset($_GET['delete']) && is_numeric($_GET['delete'])) {
    foreach ($GLOBALS['hooks']->load('admin.documents.delete') as $hook) {
        include $hook;
    }
    if (Admin::getInstance()->permissions('documents', CC_PERM_DELETE)) {
        ## Load from db, and assign
        $document = $GLOBALS['db']->select('CubeCart_documents', array('doc_name'), array('doc_id' => $_GET['delete']));
        $GLOBALS['db']->delete('CubeCart_documents', array('doc_parent_id' => $_GET['delete']));
        $GLOBALS['db']->delete('CubeCart_documents', array('doc_id' => $_GET['delete']));
        $GLOBALS['seo']->delete('doc', $_GET['delete']);
        $GLOBALS['main']->setACPNotify($lang['documents']['notify_document_delete']);
    } else {
        $GLOBALS['main']->setACPWarning($lang['documents']['error_document_delete']);
    }
    httpredir(currentPage(array('delete')));
}
###############################################
if (isset($_GET['action'])) {
    foreach ($GLOBALS['hooks']->load('admin.documents.pre_display') as $hook) {
        include $hook;
Beispiel #11
0
 /**
  * Display select skin box
  */
 private function _displaySkinSelect()
 {
     if (!$GLOBALS['smarty']->templateExists('templates/box.skins.php')) {
         return false;
     }
     $skin_setting = $GLOBALS['config']->get('config', 'skin_change');
     if ($skin_setting == '1' || $skin_setting == '2' && Admin::getInstance()->is()) {
         foreach ($this->_skins as $skin => $data) {
             ## Do not show mobile skins
             if (!$data['info']['mobile']) {
                 $data['info']['selected'] = $this->_skin == $data['info']['name'] ? 'selected="selected"' : '';
                 $vars[$skin] = $data['info'];
                 if (isset($data['styles']) && is_array($data['styles'])) {
                     foreach ($data['styles'] as $style) {
                         $style['selected'] = $this->_skin == $data['info']['name'] && $this->_style == $style['directory'] ? 'selected="selected"' : '';
                         $vars[$skin]['styles'][] = $style;
                     }
                 }
             }
         }
         foreach ($GLOBALS['hooks']->load('class.gui.display_skin_select') as $hook) {
             include $hook;
         }
         $GLOBALS['smarty']->assign('SKINS', $vars);
         $content = $GLOBALS['smarty']->fetch('templates/box.skins.php');
         $GLOBALS['smarty']->assign('SKIN_SELECT', $content);
     }
 }
 * ========================================
 * CubeCart is a registered trade mark of CubeCart Limited
 * Copyright CubeCart Limited 2015. All rights reserved.
 * UK Private Limited Company No. 5323904
 * ========================================
 * Web:   http://www.cubecart.com
 * Email:  sales@cubecart.com
 * License:  GPL-3.0 https://www.gnu.org/licenses/quick-guide-gplv3.html
 */
if (!defined('CC_INI_SET')) {
    die('Access Denied');
}
Admin::getInstance()->permissions('reviews', CC_PERM_READ, true);
global $lang;
## Delete Manufacturer
if (isset($_GET['delete']) && is_numeric($_GET['delete']) && Admin::getInstance()->permissions('products', CC_PERM_DELETE)) {
    if ($GLOBALS['db']->delete('CubeCart_manufacturers', array('id' => (int) $_GET['delete']))) {
        $GLOBALS['main']->setACPNotify($lang['catalogue']['notify_manufacturer_delete']);
    } else {
        $GLOBALS['main']->setACPWarning($lang['catalogue']['error_manufacturer_delete']);
    }
    foreach ($GLOBALS['hooks']->load('admin.product.manufacturers.delete') as $hook) {
        include $hook;
    }
    httpredir(currentPage(array('delete')));
}
## Update Manufacturer
if (isset($_POST['manufacturer']) && is_array($_POST['manufacturer'])) {
    foreach ($GLOBALS['hooks']->load('admin.product.manufacturers.save.pre_process') as $hook) {
        include $hook;
    }
Beispiel #13
0
    }
    httpredir(currentPage(array('rebuild')));
}
if (Admin::getInstance()->permissions('filemanager', CC_PERM_EDIT) && !empty($_FILES)) {
    if ($fm->upload()) {
        if (count($_FILES) > 1) {
            $GLOBALS['main']->setACPNotify($lang['filemanager']['notify_files_upload']);
        } else {
            $GLOBALS['main']->setACPNotify($lang['filemanager']['notify_file_upload']);
        }
    } else {
        $GLOBALS['main']->setACPWarning($lang['filemanager']['error_file_upload']);
    }
    httpredir(currentPage());
}
if (Admin::getInstance()->permissions('filemanager', CC_PERM_DELETE) && isset($_GET['delete'])) {
    if ($fm->delete($_GET['delete'])) {
        $GLOBALS['main']->setACPNotify($lang['filemanager']['notify_file_delete']);
    } else {
        $GLOBALS['main']->setACPWarning($lang['filemanager']['error_file_delete']);
    }
    httpredir(currentPage(array('delete')));
}
$GLOBALS['smarty']->assign('UPLOAD_LIMIT', ini_get('post_max_size'));
if (isset($_GET['fm-edit']) && is_numeric($_GET['fm-edit'])) {
    $page_content = $fm->editor($_GET['fm-edit']);
} else {
    $GLOBALS['main']->addTabControl($lang['filemanager']['tab_files'], 'filemanager');
    $GLOBALS['main']->addTabControl($lang['filemanager']['file_upload'], 'upload');
    $GLOBALS['main']->addTabControl($lang['filemanager']['folder_create'], 'folder');
    $GLOBALS['main']->addTabControl($lang['filemanager']['tab_rebuild'], false, currentPage(null, array('rebuild' => 'true')));
Beispiel #14
0
    }
    ## Set default currency to have an exchange rate of 1
    $GLOBALS['db']->update('CubeCart_currency', array('value' => 1), array('code' => $_POST['config']['default_currency']));
    $updated = $GLOBALS['config']->set('config', '', $config_new) ? true : false;
    if (isset($updated) && $updated || isset($logo_update)) {
        $GLOBALS['main']->setACPNotify($lang['settings']['notify_settings_update']);
    } else {
        $GLOBALS['main']->setACPWarning($lang['settings']['error_settings_update']);
    }
    httpredir(currentPage());
}
if (isset($_GET['logo']) && isset($_GET['logo_id'])) {
    if (($logo = $GLOBALS['db']->select('CubeCart_logo', false, array('logo_id' => (int) $_GET['logo_id']))) !== false) {
        switch (strtolower($_GET['logo'])) {
            case 'delete':
                if (Admin::getInstance()->permissions('settings', CC_PERM_DELETE)) {
                    $paths = array('images/logos/' . $logo[0]['filename'], 'images/logos/' . $logo[0]['skin'] . '-' . $logo[0]['style'] . '.php', 'images/logos/' . $logo[0]['skin'] . '.php');
                    foreach ($paths as $path) {
                        if (file_exists($logo_path)) {
                            unlink($logo_path);
                        }
                    }
                    $GLOBALS['db']->delete('CubeCart_logo', array('logo_id' => $logo[0]['logo_id']));
                    $GLOBALS['main']->setACPNotify('Logo removed');
                }
                break;
        }
    }
    $GLOBALS['gui']->rebuildLogos();
    httpredir(currentPage(array('logo', 'logo_id')), 'Logos');
}
Beispiel #15
0
 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  */
 protected function setUp()
 {
     $this->object = Admin::getInstance();
 }
 * CubeCart v6
 * ========================================
 * CubeCart is a registered trade mark of CubeCart Limited
 * Copyright CubeCart Limited 2015. All rights reserved.
 * UK Private Limited Company No. 5323904
 * ========================================
 * Web:   http://www.cubecart.com
 * Email:  sales@cubecart.com
 * License:  GPL-3.0 https://www.gnu.org/licenses/quick-guide-gplv3.html
 */
if (!defined('CC_INI_SET')) {
    die('Access Denied');
}
Admin::getInstance()->permissions('settings', CC_PERM_READ, true);
global $lang;
if (isset($_POST['gc']) && is_array($_POST['gc']) && Admin::getInstance()->permissions('settings', CC_PERM_EDIT)) {
    $filemanager = new FileManager(FileManager::FM_FILETYPE_IMG);
    if (($uploaded = $filemanager->upload()) !== false) {
        foreach ($uploaded as $file_id) {
            $_POST['image'][(int) $file_id] = true;
        }
    }
    if (isset($_POST['image']) && is_array($_POST['image'])) {
        $gc = $GLOBALS['config']->get('gift_certs');
        foreach ($_POST['image'] as $image_id => $enabled) {
            if ($enabled == 0) {
                if ($image_id == $gc['image']) {
                    $_POST['gc']['image'] = '';
                }
                continue;
            }
Beispiel #17
0
            $_POST['addrule']['country_id'] = $country['numcode'];
            $_POST['addrule']['county_id'] = 0;
            $GLOBALS['db']->insert('CubeCart_tax_rates', $_POST['addrule']);
            $GLOBALS['main']->setACPNotify($lang['settings']['notify_tax_rule_add']);
        }
    } else {
        if ($GLOBALS['db']->insert('CubeCart_tax_rates', $_POST['addrule'])) {
            $GLOBALS['main']->setACPNotify($lang['settings']['notify_tax_rule_add']);
        } else {
            $GLOBALS['main']->setACPWarning($lang['settings']['error_tax_rule_add']);
        }
    }
    $redirect = true;
}
## Delete Tax Rule
if (isset($_GET['delete_rule']) && !empty($_GET['delete_rule']) && Admin::getInstance()->permissions('settings', CC_PERM_DELETE)) {
    if ($GLOBALS['db']->delete('CubeCart_tax_rates', array('id' => (int) $_GET['delete_rule']))) {
        $GLOBALS['main']->setACPNotify($lang['settings']['notify_tax_rule_delete']);
    } else {
        $GLOBALS['main']->setACPWarning($lang['settings']['error_tax_rule_delete']);
    }
    $redirect = true;
    $anchor = 'taxrules';
}
if ($updated) {
    ## Generic message as a few things can be updated at once
    $GLOBALS['main']->setACPNotify($lang['settings']['notify_tax_updated']);
}
if ($redirect) {
    httpredir(currentPage(array('delete_class', 'delete_detail', 'delete_rule')), $anchor);
}
    } else {
        $GLOBALS['main']->setACPWarning($lang['settings']['changes_not_made']);
    }
}
$per_page = 25;
$page = isset($_GET['page']) ? $_GET['page'] : 1;
$error_log = $GLOBALS['db']->select('CubeCart_admin_error_log', array('message', 'time', 'log_id', 'read'), array('admin_id' => Admin::getInstance()->get('admin_id')), array('time' => 'DESC'), $per_page, $page, false);
if (is_array($error_log)) {
    foreach ($error_log as $log) {
        $smarty_data['error_log'][] = array('time' => formatTime($log['time']), 'message' => $log['message'], 'read' => $log['read'], 'log_id' => $log['log_id'], 'style' => $log['read'] ? '' : 'style="font-weight: bold"');
    }
}
$GLOBALS['smarty']->assign('ADMIN_ERROR_LOG', $smarty_data['error_log']);
$count = $GLOBALS['db']->count('CubeCart_admin_error_log', 'log_id', array('admin_id' => Admin::getInstance()->get('admin_id')));
$GLOBALS['smarty']->assign('PAGINATION_ADMIN_ERROR_LOG', $GLOBALS['db']->pagination($count, $per_page, $page, 5, 'page', 'admin_error_log'));
if (Admin::getInstance()->superUser()) {
    $count_unread = $GLOBALS['db']->count('CubeCart_system_error_log', 'log_id', array('read' => '0'));
    $GLOBALS['main']->addTabControl($lang['settings']['title_system_error_log'], 'system_error_log', null, null, $count_unread);
    //System errors
    $per_page = 25;
    $page = isset($_GET['page']) ? $_GET['page'] : 1;
    $system_error_log = $GLOBALS['db']->select('CubeCart_system_error_log', array('message', 'time', 'log_id', 'read'), false, array('time' => 'DESC'), $per_page, $page, false);
    if (is_array($system_error_log)) {
        foreach ($system_error_log as $log) {
            $smarty_data['system_error_log'][] = array('time' => formatTime($log['time']), 'message' => $log['message'], 'read' => $log['read'], 'log_id' => $log['log_id'], 'style' => $log['read'] == '1' ? '' : 'style="font-weight: bold"');
        }
        $GLOBALS['smarty']->assign('SYSTEM_ERROR_LOG', $smarty_data['system_error_log']);
    }
    $count = $GLOBALS['db']->count('CubeCart_system_error_log', 'log_id');
    $GLOBALS['smarty']->assign('PAGINATION_SYSTEM_ERROR_LOG', $GLOBALS['db']->pagination($count, $per_page, $page, 5, 'page', 'system_error_log'));
}
Beispiel #19
0
 }
 #// Order Summary data
 $record = array('cart_order_id' => $order_id, 'dashboard' => isset($_POST['dashboard']) ? (int) $_POST['dashboard'] : false, 'discount_type' => $_POST['summary']['discount_type']);
 $customer_data = $_POST['customer'];
 if (isset($_POST['customer']['customer_id']) && !empty($_POST['customer']['customer_id'])) {
     if (($customer = $GLOBALS['db']->select('CubeCart_customer', array('customer_id', 'title', 'first_name', 'last_name'), array('customer_id' => (int) $_POST['customer']['customer_id']))) !== false) {
         $customer_data = array_merge($customer[0], $_POST['customer']);
     }
 }
 if ($_POST['summary']['discount_type'] == 'p') {
     $_POST['summary']['discount'] = $_POST['summary']['subtotal'] * ($_POST['summary']['discount'] * 0.01);
 }
 $record = array_merge($customer_data, $_POST['summary'], $record);
 // Add a new note, if there's any content
 if (!empty($_POST['note'])) {
     $note = array('admin_id' => Admin::getInstance()->get('admin_id'), 'cart_order_id' => $order_id, 'content' => strip_tags($_POST['note']));
     if ($GLOBALS['db']->insert('CubeCart_order_notes', $note)) {
         $notes_added = true;
     }
 }
 if (empty($_POST['cart_order_id'])) {
     // Create order record
     $record['order_date'] = time();
     if ($GLOBALS['db']->insert('CubeCart_order_summary', $record)) {
         $GLOBALS['main']->setACPNotify($lang['orders']['notify_order_create']);
     } else {
         $GLOBALS['main']->setACPWarning($lang['orders']['error_order_create']);
     }
     // Update order status, if set
     $order->orderStatus($_POST['order']['status'], $order_id, true);
 } else {
Beispiel #20
0
        }
        $send_redirect = true;
    }
    if (isset($send_redirect) && $send_redirect) {
        httpredir(currentPage(array('delete_addr')));
    }
}
######################################
$per_page = 20;
if (isset($_GET['action']) && Admin::getInstance()->permissions('customers', CC_PERM_EDIT)) {
    if ($_GET['action'] == 'signinas' && isset($_GET['customer_id']) && $_GET['customer_id']) {
        $GLOBALS['db']->update('CubeCart_sessions', array('customer_id' => $_GET['customer_id']), array('session_id' => $GLOBALS['session']->getId()));
        httpredir('index.php');
        exit;
    }
    if ($_GET['action'] == 'delete' && isset($_GET['customer_id']) && Admin::getInstance()->permissions('customers', CC_PERM_DELETE)) {
        if (($customer = $GLOBALS['db']->select('CubeCart_customer', array('customer_id'), array('customer_id' => (int) $_GET['customer_id']))) !== false) {
            if (!$GLOBALS['db']->select('CubeCart_order_summary', array('cart_order_id'), array('customer_id' => $customer[0]['customer_id']))) {
                if ($GLOBALS['db']->delete('CubeCart_customer', array('customer_id' => $customer[0]['customer_id'])) !== false) {
                    $GLOBALS['db']->delete('CubeCart_addressbook', array('customer_id' => $customer[0]['customer_id']));
                    $GLOBALS['db']->delete('CubeCart_customer_membership', array('customer_id' => $customer[0]['customer_id']));
                    $GLOBALS['db']->delete('CubeCart_newsletter_subscriber', array('customer_id' => $customer[0]['customer_id']));
                    foreach ($GLOBALS['hooks']->load('admin.customer.delete') as $hook) {
                        include $hook;
                    }
                    $GLOBALS['main']->setACPNotify($lang['customer']['notify_customer_delete']);
                } else {
                    $GLOBALS['main']->setACPWarning($lang['customer']['error_customer_delete']);
                }
            } else {
                $GLOBALS['main']->setACPWarning($lang['customer']['error_customer_delete_orders']);
Beispiel #21
0
/**
 * CubeCart v6
 * ========================================
 * CubeCart is a registered trade mark of CubeCart Limited
 * Copyright CubeCart Limited 2015. All rights reserved.
 * UK Private Limited Company No. 5323904
 * ========================================
 * Web:   http://www.cubecart.com
 * Email:  sales@cubecart.com
 * License:  GPL-3.0 https://www.gnu.org/licenses/quick-guide-gplv3.html
 */
if (!defined('CC_INI_SET')) {
    die('Access Denied');
}
Admin::getInstance()->permissions('statistics', CC_PERM_READ, true);
global $lang;
if (isset($_POST['select'])) {
    httpredir(currentPage(null, $_POST['select']));
}
$select['year'] = isset($_GET['year']) && is_numeric($_GET['year']) ? (int) $_GET['year'] : date('Y');
$select['month'] = isset($_GET['month']) && in_array($_GET['month'], range(1, 12)) ? str_pad((int) $_GET['month'], 2, '0', STR_PAD_LEFT) : date('m');
$select['day'] = isset($_GET['day']) && in_array($_GET['day'], range(1, 31)) ? str_pad((int) $_GET['day'], 2, '0', STR_PAD_LEFT) : date('d');
$select['status'] = isset($_GET['status']) && in_array($_GET['status'], range(1, 6)) ? (int) $_GET['status'] : 3;
// Sales
$GLOBALS['main']->addTabControl($lang['statistics']['title_sales'], 'stats_sales');
$earliest_order = $GLOBALS['db']->select('CubeCart_order_summary', array('MIN' => 'order_date'), array('status' => $select['status']), array('order_date' => 'ASC'));
// $earliest_order will always return true but MIN_order_date may not have a value
$yearly = $monthly = $daily = $hourly = array();
if (!empty($earliest_order[0]['MIN_order_date'])) {
    $earliest = array('year' => date('Y', $earliest_order[0]['MIN_order_date']), 'month' => date('m', $earliest_order[0]['MIN_order_date']), 'day' => date('d', $earliest_order[0]['MIN_order_date']));
Beispiel #22
0
    if (Admin::getInstance()->permissions('customers', CC_PERM_DELETE) && $newsletter->deleteNewsletter($_GET['newsletter_id'])) {
        $GLOBALS['main']->setACPNotify($lang['email']['notify_news_delete']);
    } else {
        $GLOBALS['main']->setACPWarning($lang['email']['error_news_delete']);
    }
    httpredir(currentPage(array('newsletter_id', 'action')));
} elseif (isset($_GET['action']) && strtolower($_GET['action']) == 'send') {
    if (isset($_GET['newsletter_id']) && is_numeric($_GET['newsletter_id'])) {
        $GLOBALS['main']->setACPNotify($lang['email']['notify_news_sent']);
        $GLOBALS['gui']->addBreadcrumb($lang['email']['title_sending'], currentPage());
        $GLOBALS['smarty']->assign('NEWSLETTER_ID', (int) $_GET['newsletter_id']);
    }
    $GLOBALS['smarty']->assign('DISPLAY_SEND', true);
} else {
    if (isset($_GET['action']) && in_array(strtolower($_GET['action']), array('add', 'edit'))) {
        Admin::getInstance()->permissions('customers', CC_PERM_EDIT, true);
        $GLOBALS['main']->addTabControl($lang['common']['general'], 'general');
        $GLOBALS['main']->addTabControl($lang['email']['title_content_html'], 'email_html');
        $GLOBALS['main']->addTabControl($lang['email']['title_content_text'], 'email_text');
        $GLOBALS['main']->addTabControl($lang['email']['title_send_test'], 'send_test');
        if (isset($_GET['newsletter_id']) && is_numeric($_GET['newsletter_id'])) {
            if (($content = $GLOBALS['db']->select('CubeCart_newsletter', false, array('newsletter_id' => (int) $_GET['newsletter_id']))) !== false) {
                // Render editor window
                $GLOBALS['gui']->addBreadcrumb($content[0]['subject'], currentPage());
                $GLOBALS['smarty']->assign('NEWSLETTER', $content[0]);
            } else {
                httpredir(currentPage(array('newsletter_id')));
            }
        }
        // Get template list
        if (($templates = $GLOBALS['db']->select('CubeCart_email_template', array('template_default', 'template_id', 'title'))) !== false) {
/**
 * CubeCart v6
 * ========================================
 * CubeCart is a registered trade mark of CubeCart Limited
 * Copyright CubeCart Limited 2015. All rights reserved.
 * UK Private Limited Company No. 5323904
 * ========================================
 * Web:   http://www.cubecart.com
 * Email:  sales@cubecart.com
 * License:  GPL-3.0 https://www.gnu.org/licenses/quick-guide-gplv3.html
 */
if (!defined('CC_INI_SET')) {
    die('Access Denied');
}
Admin::getInstance()->permissions('orders', CC_PERM_READ, true);
$GLOBALS['main']->addTabControl($GLOBALS['language']->orders['title_transaction_logs'], 'logs');
$GLOBALS['gui']->addBreadcrumb($GLOBALS['language']->orders['title_transaction_logs']);
if (isset($_POST['search'])) {
    httpredir(currentPage(null, array('search' => $_POST['search'])));
}
$per_page = 20;
$page = isset($_GET['page']) ? $_GET['page'] : 1;
if (isset($_GET['order_id'])) {
    $GLOBALS['smarty']->assign('TRANSACTION_LOGS_TITLE', sprintf($GLOBALS['lang']['orders']['title_transaction_logs_for_order'], $_GET['order_id']));
    if (($transactions = $GLOBALS['db']->select('CubeCart_transactions', false, array('order_id' => $_GET['order_id']), array('time' => 'DESC'))) !== false) {
        $GLOBALS['gui']->addBreadcrumb($transactions[0]['order_id'], currentPage());
        foreach ($transactions as $transaction) {
            $transaction['time'] = formatTime($transaction['time']);
            $transaction['amount'] = Tax::getInstance()->priceFormat($transaction['amount']);
            $transaction['trans_id'] = empty($transaction['trans_id']) ? $GLOBALS['lang']['common']['null'] : $transaction['trans_id'];
/**
 * CubeCart v6
 * ========================================
 * CubeCart is a registered trade mark of CubeCart Limited
 * Copyright CubeCart Limited 2015. All rights reserved.
 * UK Private Limited Company No. 5323904
 * ========================================
 * Web:   http://www.cubecart.com
 * Email:  sales@cubecart.com
 * License:  GPL-3.0 https://www.gnu.org/licenses/quick-guide-gplv3.html
 */
if (!defined('CC_INI_SET')) {
    die('Access Denied');
}
Admin::getInstance()->permissions('documents', CC_PERM_EDIT, true);
global $lang;
$contact = $GLOBALS['config']->get('Contact_Form');
if (isset($_POST['contact']) && is_array($_POST['contact'])) {
    $data = $_POST['contact'];
    if (isset($_POST['department']) && is_array($_POST['department'])) {
        $i = 0;
        foreach ($_POST['department']['name'] as $key => $value) {
            if (empty($value)) {
                continue;
            }
            ++$i;
            $data['department'][$i] = array('name' => $value, 'email' => $_POST['department']['email'][$key]);
        }
    }
    $data['description'] = base64_encode(stripslashes($GLOBALS['RAW']['POST']['contact']['description']));
Beispiel #25
0
                 continue;
             }
             $GLOBALS['db']->insert('CubeCart_category_index', array('cat_id' => (int) $category_id, 'product_id' => (int) $product_id));
         }
     }
 }
 if ($_POST['price']['what'] == 'products') {
     $product_ids = $_POST['product'];
 } else {
     if ($category_products = $GLOBALS['db']->select('CubeCart_category_index', array('DISTINCT' => 'product_id'), array('cat_id' => $_POST['category']))) {
         foreach ($category_products as $category_product) {
             $product_ids[] = $category_product['product_id'];
         }
     }
 }
 if (is_array($product_ids) && isset($_POST['price']) && is_array($_POST['price']) && Admin::getInstance()->permissions('products', CC_PERM_EDIT)) {
     if (!empty($_POST['price']['value']) && is_numeric($_POST['price']['value'])) {
         ## Update prices by x amount/percent
         $field = $_POST['price']['field'];
         foreach ($product_ids as $product_id) {
             if (!is_numeric($product_id)) {
                 continue;
             }
             $fields = $field == 'all' ? array('price', 'sale_price', 'cost_price') : array($field);
             foreach ($fields as $field) {
                 if (($product = $GLOBALS['db']->select('CubeCart_inventory', array($field), array('product_id' => (int) $product_id))) !== false) {
                     $action = $_POST['price']['action'];
                     $price = $product[0][$field];
                     $value = $_POST['price']['value'];
                     switch (strtolower($_POST['price']['method'])) {
                         case 'percent':
    $cats = $GLOBALS['main']->getCategoryPath($_GET['parent']);
    if (is_array($cats)) {
        foreach ($cats as $cat) {
            $GLOBALS['gui']->addBreadcrumb($cat['cat_name'], array('_g' => $_GET['_g'], 'parent' => $cat['cat_id']));
        }
    }
}
###########################################
$filemanager = new FileManager(FileManager::FM_FILETYPE_IMG);
foreach ($GLOBALS['hooks']->load('admin.category.pre_display') as $hook) {
    include $hook;
}
if (isset($_GET['action'])) {
    if (strtolower($_GET['action']) == 'delete') {
        if (isset($_GET['translation_id']) && is_numeric($_GET['translation_id'])) {
            if (Admin::getInstance()->permissions('categories', CC_PERM_DELETE) && $GLOBALS['db']->delete('CubeCart_category_language', array('translation_id' => (int) $_GET['translation_id'], 'cat_id' => (int) $_GET['cat_id']))) {
                $GLOBALS['main']->setACPNotify($lang['translate']['notify_translation_delete']);
            } else {
                $GLOBALS['main']->setACPWarning($lang['translate']['error_translation_delete']);
            }
        }
        httpredir(currentPage(array('translation_id'), array('action' => 'edit')), 'cat_translate');
    } else {
        if (strtolower($_GET['action']) == 'translate') {
            // Check to see if translation space is available
            if (!isset($_GET['translation_id']) && $GLOBALS['language']->fullyTranslated('category', (int) $_GET['cat_id'])) {
                $GLOBALS['main']->setACPWarning($lang['common']['all_translated']);
                httpredir('?_g=categories');
            }
            if (($category = $GLOBALS['db']->select('CubeCart_category', array('cat_name'), array('cat_id' => (int) $_GET['cat_id']))) !== false) {
                $GLOBALS['gui']->addBreadcrumb($category[0]['cat_name'], currentPage(array('translate_id'), array('action' => 'edit')));
        $anchor = 'reviews';
    } else {
        if (isset($_POST['filter']['product_string']) && !empty($_POST['filter']['product_string'])) {
            $GLOBALS['main']->setACPWarning($lang['catalogue']['error_search_no_results']);
            $anchor = 'search';
        }
    }
    ## If not empty keywords append that too
    if (!empty($_POST['filter']['keywords'])) {
        $append['keywords'] = $_POST['filter']['keywords'];
    }
    ## filter is always set on any submit so we can redirect here for all
    httpredir(currentPage($rem_array, $append, $anchor), 'reviews');
}
$GLOBALS['gui']->addBreadcrumb($lang['reviews']['title_reviews'], currentPage(array('edit', 'field', 'sort', 'product_id', 'approved')));
if (isset($_GET['edit']) && is_numeric($_GET['edit']) && Admin::getInstance()->permissions('reviews', CC_PERM_EDIT)) {
    $GLOBALS['main']->addTabControl($lang['reviews']['title_review_edit'], 'review');
    // Edit review
    if (($reviews = $GLOBALS['db']->select('CubeCart_reviews', false, array('id' => (int) $_GET['edit']))) !== false) {
        $review = $reviews[0];
        $GLOBALS['gui']->addBreadcrumb($review['title'], currentPage());
        for ($i = 1; $i <= 5; $i++) {
            $GLOBALS['smarty']->assign('STAR', array('value' => $i, 'checked' => $i == $review['rating'] ? ' checked="checked"' : ''));
        }
        $GLOBALS['smarty']->assign('REVIEW', $review);
        $GLOBALS['smarty']->assign('DISPLAY_FORM', true);
    } else {
        httpredir(currentPage(array('edit')));
    }
} else {
    $GLOBALS['main']->addTabControl($lang['reviews']['title_reviews'], 'reviews');
## Update From The List Page ##
###############################
$update = array();
if (isset($_POST['testimonial_status']) && is_array($_POST['testimonial_status'])) {
    // Update testimonial status
    foreach ($_POST['testimonial_status'] as $testimonial_id => $testimonial_status) {
        $update[$testimonial_id]['testimonial_status'] = $testimonial_status;
    }
}
if (isset($_POST['testimonial_order']) && is_array($_POST['testimonial_order'])) {
    // Update testimonial order
    foreach ($_POST['testimonial_order'] as $key => $testimonial_id) {
        $update[$testimonial_id]['testimonial_order'] = $key + 1;
    }
}
if (!empty($update) && is_array($update) && Admin::getInstance()->permissions('settings', CC_PERM_EDIT)) {
    // Put changes into the database
    $updated = false;
    foreach ($update as $testimonial_id => $array) {
        if ($GLOBALS['db']->update('CubeCart_Testimonials', $array, array('testimonial_id' => $testimonial_id), true)) {
            $updated = true;
        }
    }
    if ($updated) {
        $GLOBALS['main']->setACPNotify('Testimonial status and display order saved.');
    } else {
        $GLOBALS['main']->setACPWarning('No changes have been made to the testimonial status or display order.');
    }
    $GLOBALS['cache']->clear();
    httpredir(currentPage());
}
 if (!empty($_FILES['import']['tmp_name']['file'])) {
     if ($GLOBALS['language']->importLanguage($_FILES['import'], $_POST['import']['overwrite'])) {
         $GLOBALS['main']->setACPNotify($lang['translate']['notify_language_import_success']);
     } else {
         $GLOBALS['main']->setACPWarning($lang['translate']['error_language_import_failed']);
     }
 } elseif (isset($_POST['create']) && !empty($_POST['create']['code'])) {
     if ($GLOBALS['language']->create($_POST['create'])) {
         $GLOBALS['main']->setACPNotify($lang['translate']['notify_language_create']);
         ## Set status to disabled to begin with
         $GLOBALS['config']->set('languages', $_POST['create']['code'], "0");
         httpredir(currentPage(null, array('language' => $_POST['create']['code'])));
     } else {
         $GLOBALS['main']->setACPWarning($lang['translate']['error_language_create']);
     }
 } elseif (isset($_POST['status']) && Admin::getInstance()->permissions('settings', CC_PERM_EDIT)) {
     if ($GLOBALS['config']->set('languages', false, $_POST['status'])) {
         $GLOBALS['main']->setACPNotify($lang['translate']['notify_language_status']);
     } else {
         $GLOBALS['main']->setACPWarning($lang['translate']['error_language_status']);
     }
     httpredir(currentPage());
 }
 $enabled = $GLOBALS['config']->get('languages');
 $GLOBALS['main']->addTabControl($lang['translate']['title_languages'], 'lang_list');
 ## List available language files
 if (($languageList = $GLOBALS['language']->listLanguages()) !== false) {
     foreach ($languageList as $code => $info) {
         $info['status'] = isset($enabled[$code]) ? (int) $enabled[$code] : 1;
         if (file_exists('language/flags/' . $info['code'] . '.png')) {
             $info['flag'] = 'language/flags/' . $info['code'] . '.png';
Beispiel #30
0
/**
 * CubeCart v6
 * ========================================
 * CubeCart is a registered trade mark of CubeCart Limited
 * Copyright CubeCart Limited 2015. All rights reserved.
 * UK Private Limited Company No. 5323904
 * ========================================
 * Web:   http://www.cubecart.com
 * Email:  sales@cubecart.com
 * License:  GPL-3.0 https://www.gnu.org/licenses/quick-guide-gplv3.html
 */
if (!defined('CC_INI_SET')) {
    die('Access Denied');
}
Admin::getInstance()->permissions('products', CC_PERM_EDIT, true);
global $lang;
$dir = CC_ROOT_DIR . CC_DS . 'includes' . CC_DS . 'extra' . CC_DS;
$source = $dir . 'importdata.tmp';
$import_source = $dir . 'importdata_%s.tmp';
$splitSize = 50;
$delimiter = isset($_POST['delimiter']) && !empty($_POST['delimiter']) ? $_POST['delimiter'] : ',';
$GLOBALS['main']->addTabControl($lang['common']['import'], 'general');
if (isset($_POST['process']) || isset($_GET['cycle'])) {
    ## This will (theoretically) prevent a partial import
    ignore_user_abort(true);
    set_time_limit(0);
    ini_set('max_execution_time', '0');
    ## Truncate?
    if (isset($_POST['option']['truncate'])) {
        $tables = array('CubeCart_inventory', 'CubeCart_image_index', 'CubeCart_option_assign', 'CubeCart_reviews', 'CubeCart_category_index', 'CubeCart_inventory_language', 'CubeCart_options_set_product', 'CubeCart_pricing_quantity', 'CubeCart_pricing_group');