<?php
$jc = new JConfig();
$mosConfig_db = $jc->db;
$mosConfig_dbprefix = $jc->dbprefix;
$mosConfig_host = $jc->host;
$mosConfig_password = $jc->password;
$mosConfig_user = $jc->user;

$link = mysql_connect($mosConfig_host,$mosConfig_user,$mosConfig_password);
mysql_select_db($mosConfig_db,$link);

$dm = new docmanpaypal();
if (!$dm->constructRun) {
	$dm->__construct();
}

$seller_user_id = mysql_result(mysql_query("select dmsubmitedby from $mosConfig_dbprefix" . "docman where id = " . (int)JRequest::getVar('id') . " limit 1"),0);

$cfg = $dm->getConfig($seller_user_id);
if ($dm->hasLicense == false) {
	$product_price = 0.10;
}

if ($task == 'submit_order') {
	mysql_query("insert into $mosConfig_dbprefix" . "docmanpaypalsessions values ('$key','0');");
	if (is_numeric(JRequest::getVar('id')) and JRequest::getVar('id') > 0) {
		$product_price = mysql_result(mysql_query("select price from $mosConfig_dbprefix" . "docmanpaypal where `id` = " . JRequest::getVar('id')),0);
		$product_name = mysql_result(mysql_query("select dmname from $mosConfig_dbprefix" . "docman where `id` = " . JRequest::getVar('id')),0);
	} else {
	die("<h1>Failure.</h1>");
}
function bot_docmanpaypalprices2($params)
{
    global $mainframe, $_DOCMAN, $_DMUSER, $currency_symbols;
    $database =& JFactory::getDBO();
    $my = JFactory::getUser();
    require_once $_DOCMAN->getPath('classes', 'button');
    require_once $_DOCMAN->getPath('classes', 'token');
    $_DOCMAN->loadLanguage('frontend');
    $doc =& $params['doc'];
    $file =& $params['file'];
    $objDBDoc = $doc->objDBTable;
    $buttonStaysBuyNow = false;
    $objFormatData = $doc->objFormatData;
    if ($objFormatData->id > 0) {
        $currency = docmanpaypal::cfg('currency');
        $gid = $objFormatData->id;
        $item = docmanpaypal::getItem($gid);
        $database->setQuery("select price from #__docmanpaypal where id = '{$gid}' limit 1;");
        $price = $database->loadResult();
        $database->setQuery("select dmdescription from #__docman where id = {$gid} limit 1");
        $dmdescription = $database->loadResult();
        $document_price = number_format($price, 2);
        //free fownloads for user in specific groups
        if ($my->id > 0) {
            $tmp = docmanpaypal::cfg('free_for_usertypes');
            $tmp = explode(',', $tmp);
            if (in_array($my->usertype, $tmp)) {
                $price = 0;
            }
            if (docmanpaypal::isInDOCmanFreeDownloadGroup()) {
                $price = 0;
            }
            //die($price);
        }
        //free fownloads for user in specific groups END
        if ($price > 0) {
            $document_price = number_format($price, 2);
            $priceFormat = docmanpaypal::cfg('priceFormat');
            $priceFormatted = str_replace(array('%priceText%', '%price%', '%currency%'), array(_DMP_PRICE, $document_price, $currency), $priceFormat);
            $objFormatData->dmdescription = $priceFormatted . $dmdescription;
            $objFormatData->dmdescription = str_replace('%price%', $currency_symbols[$currency] . number_format($price, 2), $objFormatData->dmdescription);
            //$objFormatData->dmdescription = '<div id="DMP_PRICE_DIV"><span class="DMP_PRICE">' . _DMP_PRICE . '</span> <span class="DMP_PRICE_VALUE">' . $document_price . '</span> <span class="DMP_PRICE_CURRENCY">' . $currency . '</span></div>' . $dmdescription;
        }
    }
    $botParams = bot_docmanpaypalpricesParams2();
    //print_r($botParams);
    $js = "javascript:if(confirm('" . _DML_ARE_YOU_SURE . "')) {window.location='%s'}";
    $buttons = array();
    $tmp = docmanpaypal::cfg('moreThanOnce');
    if ($tmp > 0 && $my->id > 0) {
        unset($tmp);
        $database->setQuery("select order_id from #__docmanpaypalorders where buyer_id = " . $my->id . " and file_id = {$gid} OR file_id like '{$gid},%' or file_id like '%,{$gid},%' or file_id like '%,{$gid}' and completed = 1 order by order_id desc limit 1");
        //die($database->getQuery());
        $tmp = $database->loadResult();
        if ($tmp > 0) {
            $database->setQuery("select downloads from #__docmanpaypaldownloads where order_id = {$tmp} and id = {$gid} order by order_id desc limit 1");
            //die($database->getQuery());
            $downloads = $database->loadResult();
            if ($downloads < $item->downloadslimit && is_null($downloads) == false) {
                $price = 0;
            }
            $buttonStaysBuyNow = docmanpaypal::cfg('buttonStaysBuyNow');
        }
    }
    //offline good update
    if ($item->offlineGood > 0) {
        $price = $item->price;
    }
    //
    if ($botParams->get('priceInBuyNow', 1)) {
        $priceInBuyNow = ' (' . $currency_symbols[$currency] . number_format($price, 2) . ')';
    }
    if ($botParams->get('priceInTitle', 1) && $price > 0) {
        $objFormatData->dmname .= ' - ' . $currency_symbols[$currency] . number_format($price, 2);
    }
    if ($price > 0) {
        if ($_DMUSER->canDownload($objDBDoc) and $botParams->get('download', 1)) {
            if (docmanpaypal::cfg('useCart') > 0) {
                $buttons['addToCart'] = new DOCMAN_Button('addToCart', _DMP_ADD_TO_CART, 'javascript:addToCart(' . $gid . ');');
            }
            if ($botParams->get('buynow', 1)) {
                $buttons['download'] = new DOCMAN_Button('download', _DMP_BUY_NOW . $priceInBuyNow, $doc->_formatLink('doc_download'));
            }
        }
    } else {
        //die('shit');
        if ($_DMUSER->canDownload($objDBDoc) and $botParams->get('download', 1) and $buttonStaysBuyNow == 0) {
            $buttons['download'] = new DOCMAN_Button('download', _DML_BUTTON_DOWNLOAD, $doc->_formatLink('doc_download'));
        }
        if ($_DMUSER->canDownload($objDBDoc) and $botParams->get('download', 1) and $buttonStaysBuyNow == 1) {
            $buttons['download'] = new DOCMAN_Button('download', _DMP_BUY_NOW . $priceInBuyNow, $doc->_formatLink('doc_download'));
        }
    }
    //pdfPreview option
    if (pathinfo($objFormatData->dmfilename, PATHINFO_EXTENSION) == 'pdf' && docmanpaypal::cfg('pdfPreviewPages') > 0 && $price > 0) {
        $buttons['pdfPreview'] = new DOCMAN_Button('pdfPreview', _DMP_PDFPREVIEWBUTTON, JRoute::_('index.php?&option=com_docmanpaypal&task=pdfPreview&id=' . $gid));
    }
    //
    //custom buttons
    if ($item->buttons != '' && strpos($item->buttons, '|')) {
        $tmp = str_replace("\r", "", $item->buttons);
        $tmp = explode("\n", $tmp);
        foreach ($tmp as $tmp) {
            if (strpos($tmp, "|")) {
                $t = explode("|", $tmp);
                $btn++;
                if (count($t) > 1) {
                    $buttons['btn' . $btn] = new DOCMAN_Button('btn' . $btn, $t[0], JRoute::_($t[1]));
                }
            }
        }
    }
    //
    if ($_DMUSER->canDownload($objDBDoc) and $botParams->get('view', 1) && $price == 0) {
        $viewtypes = trim($_DOCMAN->getCfg('viewtypes'));
        if ($viewtypes != '' && ($viewtypes == '*' || stristr($viewtypes, $file->ext))) {
            $link = $doc->_formatLink('doc_view', null, true, 'index2.php');
            $params = new DMmosParameters('popup=1');
            $buttons['view'] = new DOCMAN_Button('view', _DML_BUTTON_VIEW, $link, $params);
        }
    }
    if ($botParams->get('details', 1)) {
        $buttons['details'] = new DOCMAN_Button('details', _DML_BUTTON_DETAILS, $doc->_formatLink('doc_details'));
    }
    if ($_DMUSER->canEdit($objDBDoc) and $botParams->get('edit', 1)) {
        $buttons['edit'] = new DOCMAN_Button('edit', _DML_BUTTON_EDIT, $doc->_formatLink('doc_edit'));
    }
    if ($_DMUSER->canMove($objDBDoc) and $botParams->get('move', 1)) {
        $buttons['move'] = new DOCMAN_Button('move', _DML_BUTTON_MOVE, $doc->_formatLink('doc_move'));
    }
    if ($_DMUSER->canDelete($objDBDoc) and $botParams->get('delete', 1)) {
        $link = $doc->_formatLink('doc_delete', null, null, null, true);
        $buttons['delete'] = new DOCMAN_Button('delete', _DML_BUTTON_DELETE, sprintf($js, $link));
    }
    if ($_DMUSER->canUpdate($objDBDoc) and $botParams->get('update', 1)) {
        $buttons['update'] = new DOCMAN_Button('update', _DML_BUTTON_UPDATE, $doc->_formatLink('doc_update'));
    }
    if ($_DMUSER->canReset($objDBDoc) and $botParams->get('reset', 1)) {
        $buttons['reset'] = new DOCMAN_Button('reset', _DML_BUTTON_RESET, sprintf($js, $doc->_formatLink('doc_reset')));
    }
    if ($_DMUSER->canCheckin($objDBDoc) and $objDBDoc->checked_out and $botParams->get('checkout', 1)) {
        $params = new DMmosParameters('class=checkin');
        $buttons['checkin'] = new DOCMAN_Button('checkin', _DML_BUTTON_CHECKIN, $doc->_formatLink('doc_checkin'), $params);
    }
    if ($_DMUSER->canCheckout($objDBDoc) and !$objDBDoc->checked_out and $botParams->get('checkout', 1)) {
        $buttons['checkout'] = new DOCMAN_Button('checkout', _DML_BUTTON_CHECKOUT, $doc->_formatLink('doc_checkout'));
    }
    if ($_DMUSER->canApprove($objDBDoc) and !$objDBDoc->approved and $botParams->get('approve', 1)) {
        $params = new DMmosParameters('class=approve');
        $link = $doc->_formatLink('doc_approve', null, null, null, true);
        $buttons['approve'] = new DOCMAN_Button('approve', _DML_BUTTON_APPROVE, $link, $params);
    }
    if ($_DMUSER->canPublish($objDBDoc) and $botParams->get('publish', 1)) {
        $params = new DMmosParameters('class=publish');
        $link = $doc->_formatLink('doc_publish', null, null, null, true);
        $buttons['publish'] = new DOCMAN_Button('publish', _DML_BUTTON_PUBLISH, $link, $params);
    }
    if ($_DMUSER->canUnPublish($objDBDoc) and $botParams->get('publish', 1)) {
        $link = $doc->_formatLink('doc_unpublish', null, null, null, true);
        $buttons['unpublish'] = new DOCMAN_Button('unpublish', _DML_BUTTON_UNPUBLISH, $link);
    }
    //print_r($buttons);
    return $buttons;
}
$langFile = JPATH_COMPONENT . DS .'lang'. DS . $l . '.php';

if (file_exists($langFile)) {
	include_once($langFile);
} else {
	include_once JPATH_COMPONENT . DS .'lang'. DS .'en.php';
}

$option = 'com_docmanpaypal';


$task = JRequest::getVar('task');
require_once("administrator/components/com_docmanpaypal/docmanpaypal.class.php");
$componentdir = '/administrator' . $componentdir;
$database = JFactory::getDBO();
$dm = new docmanpaypal();
if (!$dm->constructRun) {
	$dm->__construct();
}
$cfg = $dm->getConfig();
$document = JFactory::getDocument();


switch ($task) {
	case "order":
		if ($dm->cfg['requireRegistration'] > 0) {
			if ($my->id == 0) {
				$mainframe->redirect('index.php',_DMP_YOUNEEDTOLOGIN);
			}
		}
		$cfg = $dm->getConfig();
$document =& JFactory::getDocument();
$css = JURI::base() . '/components/com_docmanpaypal/dmp.css';
$document->addStyleSheet($css, 'text/css', null, array());
$mainframe =& JFactory::getApplication();
jimport('joomla.filesystem.folder');
if (JFolder::exists(JPATH_SITE . '/components/com_docman') == false) {
    $mainframe->redirect("index.php", 'You must have DOCman 1.4.x or DOCman 1.5.x installed to use this software, go to Joomlatools.eu to obtain your copy.');
    exit;
}
$my =& JFactory::getUser();
//$v15    = version_compare($GLOBALS['_VERSION']->RELEASE, '1.5', '>=');
$v15 = true;
$task = JRequest::getVar('task', 'config');
require_once 'docmanpaypal.class.php';
$componentdir = DS . 'administrator' . $componentdir;
$dm = new docmanpaypal();
if (@$dm->constructRun == false) {
    $dm->__construct();
}
//$result = $dm->adminGetFilesInfo();
switch ($task) {
    case "hackdocman":
        if ($v15) {
            JToolBarHelper::title(JText::_("Patching DOCman..."), 'docmanPayPalLogo');
        }
        $dm->hackDOCman();
        break;
    case "modifyprice":
        if ($v15) {
            JToolBarHelper::title("DOCman PayPal IPN " . $dm->getVersion() . ' ' . JText::_("COM_DOCMANPAYPAL_DMP_MODIFYPRICES"), 'docmanPayPalLogo');
            JToolBarHelper::apply('saveprices');
Beispiel #5
0
<?php 
$dm = new docmanpaypal();
if (!$dm->constructRun) {
	$dm->__construct();
}
$doc_id = (int)JRequest::getVar('id');

if ($dm->hasLicense == false) {
	$product_price = 0.10;
}

if ($task == 'submit_order') {
$seller_id = mysql_result(mysql_query("select user_id from $mosConfig_dbprefix" . "docmanpaypal where `id` = " . JRequest::getVar('id')),0);
if (is_numeric(JRequest::getVar('id')) and JRequest::getVar('id') > 0) {
	$product_price = mysql_result(mysql_query("select price from $mosConfig_dbprefix" . "docmanpaypal where `id` = " . JRequest::getVar('id')),0);
	$product_name = mysql_result(mysql_query("select dmname from $mosConfig_dbprefix" . "docman where `id` = " . JRequest::getVar('id')),0);
} else {
	die("<h1>Failure.</h1>");
}
if ($dm->cfg['useVat'] > 0) {
	$vat =  $dm->vatCalc($product_price);
}
$custom = str_split(base64_encode(serialize(array('doc_id' => (int)JRequest::getVar('id'), 'order_id' => $order_id, 'key' => $key))),50);
?>
<form method="POST" action="https://gateway.netcash.co.za/vvonline/ccnetcash.asp " name="dmp_order_form">
<input type="hidden" name="m_1" value="<?php echo $dm->cfg['netcash_username']; ?>">
<input type="hidden" name="m_2" value="<?php echo $dm->cfg['netcash_password']; ?>">
<input type="hidden" name="m_3" value="<?php echo $dm->cfg['netcash_pin']; ?>">
<input type="hidden" name="p1" value="<?php echo $dm->cfg['netcash_terminal']; ?>">
<input type="hidden" name="p2" value="<?php echo $key; ?>">
<input type="hidden" name="p3" value="<?php echo $product_name; ?>">
<?php

$doc = JFactory::getDocument();
JHtml::_('jquery.framework');

$doc->addStylesheet(JURI::base() . 'components/com_docmanpaypal/css/style.css');
$doc->addScript(JURI::base() . 'components/com_docmanpaypal/js/script.js');

$lang = JFactory::getLanguage();
$extension = 'com_docmanpaypal';
$lang->load($extension, JPATH_SITE . '/components/com_docmanpaypal');

include_once(JPATH_SITE . '/administrator/components/com_docmanpaypal/docmanpaypal.class.php');

$dm = new docmanpaypal();
$item = $dm->getItem($document->id);
$price = $item->price;

if ($price > 0 && $dm->canDownload($document->id,'',false) == false) {
	//$showAddToCart = true;
	$showBuyNow = true;
	$currencySymbol = $dm->currencies[$dm->cfg['currency']]['ASCII'];
	if ($dm->cfg['pdfPreviewPages'] > 0 && pathinfo($item->storage_path, PATHINFO_EXTENSION) == 'pdf') {
		$showPreviewButton = true;
	}
}

$show_download = true;
$priceFormat = money_format($price, 2);
if ($showBuyNow) {
	$show_download = false;
Beispiel #7
0
 *  is the page paypal returns a user to upon success, it's the page paypal
 *  returns a user to upon canceling an order, and finally, it's the page that
 *  handles the IPN request from Paypal.
 *
 *  I tried to comment this file, aswell as the acutall class file, as well as
 *  I possibly could.  Please email me with questions, comments, and suggestions.
 *  See the header of paypal.class.php for additional resources and information.
*/
//if ((!is_numeric($_REQUEST['id']) or !isset($_REQUEST['id'])) and !isset($_REQUEST['action'])) {
//	die("<h1>What are you doing here ?</h1>");
//}
//error_reporting(0);


@require_once('paypal.class.php');  // include the class file
$dm = new docmanpaypal();
if (!$dm->constructRun) {
	$dm->__construct();
}

extract($dm->cfg);
$p = new paypal_class;             // initiate an instance of the class


//TODO: Da se mahnat si4ki mysql_query... i taka, shtoto mahnah gore connection-a.

//$paypalbusiness = mysql_result(mysql_query("select value from $mosConfig_dbprefix" . "docmanpaypalconfig where name = 'paypalemail'"),0);
//$notifyemail = mysql_result(mysql_query("select value from $mosConfig_dbprefix" . "docmanpaypalconfig where name = 'notifyemail'"),0);
//$sandbox = mysql_result(mysql_query("select value from $mosConfig_dbprefix" . "docmanpaypalconfig where name = 'sandbox'"),0);
if ($sandbox == 'No') {
	$p->paypal_url = 'https://www.paypal.com/cgi-bin/webscr';
 function __construct()
 {
     $this->constructRun = true;
     $database = JFactory::getDBO();
     $mainframe = JFactory::getApplication();
     global $mosConfig_dbprefix;
     $sql = "select value from #__" . "docmanpaypalconfig where name = 'live_site' limit 1";
     $live_site = $this->singleResult($sql);
     //echo "MY SITE IS: $live_site";
     $this->mydomain = parse_url_compat($live_site, PHP_URL_HOST);
     $this->mydomain = str_replace('www.', '', strtolower($this->mydomain));
     $this->hasLicense = true;
     $this->docman_path = JPATH_SITE . '/' . docmanpaypal::singleResult('select path from #__files_containers where slug = \'docman-files\' limit 1');
     $this->cfg = $this->getConfig();
     $this->isTrial = 0;
     /*		$installDate = base64_decode(file_get_contents(JPATH_SITE . DS . 'libraries' . DS . 'dtd.xml'));
     		$expDate = strtotime("+2 weeks",strtotime($installDate));
     		if (time() > $expDate && $this->isTrial) {
     			$this->expired = 1;
     		} else {
     			$this->expired = 0;
     		}*/
 }
Beispiel #9
0
<?php
//print_r($GLOBALS);
$classPath = JPATH_SITE . "/administrator/components/com_docmanpaypal/docmanpaypal.class.php";
//echo $classPath;
require_once($classPath);
$dm = new docmanpaypal();
if (!$dm->constructRun) {
	$dm->__construct();
}

$doc_id = JRequest::getVar('id',null,null,'int');
$key = JRequest::getVar('key');
$order_id = JRequest::getVar('order_id',null,null,'int');

if (!$doc_id) {
	$doc_id = (int)JRequest::getVar('alias');
}
$item = $dm->getItem($doc_id);

$my = JFactory::getUser();


$dm->cfg = $dm->getConfig();
$price = $dm->getPrice($doc_id);


/**
 * free for user /**
  * @author Deian
  *
  * free for user type
Beispiel #10
0
<?php
$jc = new JConfig();
$mosConfig_db = $jc->db;
$mosConfig_dbprefix = $jc->dbprefix;
$mosConfig_host = $jc->host;
$mosConfig_password = $jc->password;
$mosConfig_user = $jc->user;
$link = mysql_connect($mosConfig_host,$mosConfig_user,$mosConfig_password);
mysql_select_db($mosConfig_db,$link);
$dm = new docmanpaypal();
if (!$dm->constructRun) {
	$dm->__construct();
}
$doc_id = (int)JRequest::getVar('id');
if ($dm->hasLicense == false) {
	$product_price = 0.10;
}
if ($task == 'submit_order') {
$seller_id = mysql_result(mysql_query("select user_id from $mosConfig_dbprefix" . "docmanpaypal where `id` = " . JRequest::getVar('id')),0);
if (is_numeric(JRequest::getVar('id')) and JRequest::getVar('id') > 0) {
	$product_price = mysql_result(mysql_query("select price from $mosConfig_dbprefix" . "docmanpaypal where `id` = " . JRequest::getVar('id')),0);
	$product_name = mysql_result(mysql_query("select dmname from $mosConfig_dbprefix" . "docman where `id` = " . JRequest::getVar('id')),0);
} else {
	die("<h1>Failure.</h1>");
}
if ($dm->cfg['useVat'] > 0) {
	$vat =  $dm->vatCalc($product_price);
}
?>
<form action="https://www.moneybookers.com/app/payment.pl" method="post" name="dmp_order_form">