Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- *
- * @ This file is created by http://DeZender.Net
- * @ deZender (PHP5 Decoder for ionCube Encoder)
- *
- * @ Version : 3.5.0.0
- * @ Author : DeZender
- * @ Release on : 22.06.2018
- * @ Official site : http://DeZender.Net
- *
- */
- if (!defined('WHMCS')) {
- exit('This file cannot be accessed directly');
- }
- if (!defined('DS')) {
- define('DS', DIRECTORY_SEPARATOR);
- }
- if (!defined('INVOICEPATH')) {
- define('INVOICEPATH', ROOTDIR . '/modules/addons/invoiceme');
- }
- if (isset($_REQUEST['m']) && $_REQUEST['m'] == 'invoiceme' && $_REQUEST['type'] == 'i' && 0 < (int) $_SESSION['uid'] && 0 < (int) $_REQUEST['id']) {
- $openAPI = ROOTDIR . DS . 'modules' . DS . 'addons' . DS . 'openAPI' . DS . 'init.php';
- if (!file_exists($openAPI)) {
- exit('Please install the openAPI module');
- }
- require $openAPI;
- if (!class_exists('DB_INVOICES')) {
- require_once INVOICEPATH . '/classes/db.php';
- }
- if (!class_exists('INVOICEAPI')) {
- require_once INVOICEPATH . '/classes/api.php';
- }
- if (!class_exists('INVOICESME')) {
- require_once INVOICEPATH . '/classes/invoices.php';
- }
- @header('Cache-Control: private');
- $db = DB_INVOICES::getInstance();
- $api = INVOICEAPI::getInstance();
- $inv = INVOICESME::getInstance();
- $userID = (int) $_SESSION['uid'];
- $invoiceID = (int) $_REQUEST['id'];
- $invoice = $inv->getInvoice($invoiceID);
- $isSkipped = (int) $db->getValue('SELECT COUNT(*) FROM `mod_invoiceme_skipped` WHERE `invoiceid`=' . $invoiceID . ';');
- if ($isSkipped) {
- WOAAPI::redirect('index.php?m=invoiceme');
- }
- if (!$isSkipped && in_array($invoice['status'], array('Paid', 'Unpaid', 'Cancelled', 'Refunded'))) {
- $genID = (int) $db->getValue('SELECT g.id FROM `mod_invoiceme_generated` as g LEFT JOIN `tblinvoices` as i ON g.invoiceid=i.id WHERE i.userid=' . $userID . ' AND g.invoiceid=' . $invoiceID . ' ORDER BY g.`generated` DESC LIMIT 1;');
- if (0 < $genID) {
- WOAAPI::redirect('index.php?m=invoiceme&action=download&id=' . $genID);
- }
- }
- if ($invoice['status'] == 'Paid') {
- WOAAPI::redirect('index.php?m=invoiceme');
- }
- WOAAPI::redirect('dl.php?type=i&id=' . $invoiceID);
- }
- if (isset($_REQUEST['module']) && $_REQUEST['module'] == 'invoiceme' && 0 < $_SESSION['adminid'] && strpos($_SERVER['REQUEST_URI'], 'addonmodules.php?') !== false) {
- $openAPI = ROOTDIR . DS . 'modules' . DS . 'addons' . DS . 'openAPI' . DS . 'init.php';
- if (!file_exists($openAPI)) {
- exit('Please install the openAPI module');
- }
- require $openAPI;
- if (!class_exists('DB_INVOICES')) {
- require_once INVOICEPATH . '/classes/db.php';
- }
- if (!class_exists('INVOICEAPI')) {
- require_once INVOICEPATH . '/classes/api.php';
- }
- if (!class_exists('INVOICESME')) {
- require_once INVOICEPATH . '/classes/invoices.php';
- }
- @header('Cache-Control: private');
- $api = INVOICEAPI::getInstance();
- $db = DB_INVOICES::getInstance();
- $inv = INVOICESME::getInstance();
- $PDFreportsPath = INVOICEPATH . '/reports/';
- $lang = (isset($_REQUEST['lang']) ? trim($_REQUEST['lang']) : $sysConfig['language']);
- $_LANG = $api->getAddonLang($lang, 'invoiceme');
- if ($_REQUEST['view'] == 'reports' && !empty($_REQUEST['pdf'])) {
- $_REQUEST['pdf'] = basename(urldecode(trim($_REQUEST['pdf'])));
- if ($_REQUEST['a'] == 'download' && $api->checkACL($_REQUEST['view'], 'download')) {
- if (!class_exists('DownloaderPDF')) {
- require_once INVOICEPATH . '/classes/downloader.php';
- }
- if (file_exists($PDFreportsPath . $_REQUEST['pdf'])) {
- error_reporting(0);
- $ddl = new DownloaderPDF();
- $result = $ddl->doDownload($PDFreportsPath, $_REQUEST['pdf'], true);
- exit();
- }
- exit('Not exists');
- }
- if ($_REQUEST['a'] == 'delete' && $api->checkACL($_REQUEST['view'], 'delete')) {
- if (file_exists($PDFreportsPath . $_REQUEST['pdf'])) {
- unlink($PDFreportsPath . $_REQUEST['pdf']);
- @header('Location: addonmodules.php?module=invoiceme&view=reports&cid=' . @$api->getProfileID());
- }
- } else {
- if ($_REQUEST['a'] == 'send' && $api->checkACL($_REQUEST['view'], 'send') && !empty($_REQUEST['email'])) {
- $_REQUEST['pdf'] = basename(urldecode(trim($_REQUEST['pdf'])));
- $file = $PDFreportsPath . $_REQUEST['pdf'];
- if (file_exists($PDFreportsPath . $_REQUEST['pdf'])) {
- $ccEmail = $api->getConfig('ccemail', 0);
- $sendTo = array('to' => array(trim(urldecode($_REQUEST['email']))));
- if (!empty($ccEmail)) {
- $sendTo['bcc'] = @explode(',', $ccEmail);
- }
- $whmcs = $api->getWhmcsConfig();
- ...................................................................
- ........................................
- ................
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement