コード例 #1
0
ファイル: config.php プロジェクト: aldegtyarev/stelsvelo
 public static function tableExists()
 {
     static $ret;
     if (isset($ret)) {
         return $ret;
     }
     require_once JPATH_ROOT . DS . 'components' . DS . 'com_onepage' . DS . 'helpers' . DS . 'mini.php';
     $ret = OPCmini::tableExists('onepage_config');
     return $ret;
 }
コード例 #2
0
ファイル: pickup.php プロジェクト: aldegtyarev/stelsvelo
    function store()
    {
        require_once JPATH_SITE . DS . 'components' . DS . 'com_onepage' . DS . 'helpers' . DS . 'mini.php';
        if (!OPCmini::tableExists('virtuemart_shipment_plg_pickup_or_free_conf')) {
            $db = JFactory::getDBO();
            $q = '
	
CREATE TABLE IF NOT EXISTS `#__virtuemart_shipment_plg_pickup_or_free_conf` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `from` int(11) NOT NULL,
  `to` int(11) NOT NULL,
  `route` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_slovak_ci AUTO_INCREMENT=1 ;';
            $db->setQuery($q);
            $db->query();
            $e = $db->getErrorMsg();
            if (!empty($e)) {
                return $e;
            }
        }
        require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_onepage' . DS . 'models' . DS . 'config.php';
        /*	
        if (!OPCJ3)
        	{
        	 require_once(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_onepage'.DS.'helpers'.DS.'opcparameters.php'); 
        	}
        	else
        	{
        
        	}
        */
        require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_onepage' . DS . 'helpers' . DS . 'jformrender.php';
        require_once JPATH_SITE . DS . 'components' . DS . 'com_onepage' . DS . 'helpers' . DS . 'config.php';
        $config = new JModelConfig();
        $config->loadVmConfig();
        $files = $config->getPhpTrackingThemes();
        $statuses = $config->getOrderStatuses();
        $data = JRequest::get('post');
        jimport('joomla.filesystem.file');
        return;
    }
コード例 #3
0
ファイル: config.php プロジェクト: aldegtyarev/stelsvelo
 function updateVmConfig($arr)
 {
     $db = JFactory::getDBO();
     /*
     if(!class_exists('VirtueMartModelConfig')) require(JPATH_VM_ADMINISTRATOR .'/models/config.php');
     $configTable  = VirtueMartModelConfig::checkConfigTableExists();
     */
     require_once JPATH_ROOT . DS . 'components' . DS . 'com_onepage' . DS . 'helpers' . DS . 'mini.php';
     $configTable = OPCmini::tableExists('virtuemart_configs');
     if (!empty($configTable)) {
         $q = ' SELECT `config` FROM `#__virtuemart_configs` WHERE `virtuemart_config_id` = "1" limit 0,1';
         $db->setQuery($q);
         $res = $db->loadResult();
         $new = array();
         $config = explode('|', $res);
         foreach ($config as $item) {
             $citem = explode('=', $item);
             $key = $citem[0];
             $val = $citem[1];
             $new[$key] = $val;
         }
         foreach ($arr as $key => $val) {
             $new[$key] = serialize($val);
         }
     }
     $string = '';
     foreach ($new as $key => $val) {
         if (!empty($string)) {
             $string .= '|';
         }
         $string .= $key . '=' . $val;
     }
     //echo $string; die();
     $q = "update #__virtuemart_configs set config = '" . $db->escape($string) . "' where virtuemart_config_id = 1";
     $db->setQuery($q);
     $db->query();
     $e = $db->getErrorMsg();
     if (!empty($e)) {
         die($e);
     }
 }
コード例 #4
0
ファイル: opctracking.php プロジェクト: aldegtyarev/stelsvelo
 public static function getTextFields(&$order)
 {
     OPCtrackingHelper::getOrderExtras($order);
     $db = JFactory::getDBO();
     $vmlang = self::getOrderLang($order);
     if (empty($order['details']['BT'])) {
         return;
     }
     $currency = (int) $order['details']['BT']->user_currency_id;
     if (empty($currency)) {
         $currency = (int) $order['details']['BT']->order_currency;
     }
     if (!empty($currency)) {
         $q = 'select * from #__virtuemart_currencies where virtuemart_currency_id = ' . $currency . ' limit 0,1';
         $db->setQuery($q);
         $res = $db->loadAssoc();
         foreach ($res as $key5 => $val5) {
             $order['details']['BT']->{$key5} = $val5;
         }
     }
     $paymenttext = '';
     $payment_id = (int) $order['details']['BT']->virtuemart_paymentmethod_id;
     if (!empty($payment_id)) {
         $orig1 = JFactory::getApplication()->get('messageQueue', array());
         $orig2 = JFactory::getApplication()->get('_messageQueue', array());
         JPluginHelper::importPlugin('vmpayment');
         $_dispatcher = JDispatcher::getInstance();
         $ordercopy = $order;
         ob_start();
         $_returnValues = $_dispatcher->trigger('plgVmOnShowOrderFEPayment', array($order['details']['BT']->virtuemart_order_id, $order['details']['BT']->virtuemart_paymentmethod_id, &$ordercopy));
         foreach ($_returnValues as $_returnValue) {
             if ($_returnValue !== null) {
                 $paymenttext .= $_returnValue;
             }
         }
         JFactory::getApplication()->set('messageQueue', $orig1);
         JFactory::getApplication()->set('_messageQueue', $orig2);
         $delete = ob_get_clean();
     }
     $order['details']['BT']->payment_name = $paymenttext;
     $shipment = '';
     $shipment_id = $order['details']['BT']->virtuemart_shipmentmethod_id;
     if (!empty($shipment_id)) {
         ob_start();
         $orig1 = JFactory::getApplication()->get('messageQueue', array());
         $orig2 = JFactory::getApplication()->get('_messageQueue', array());
         JPluginHelper::importPlugin('vmshipment');
         $_dispatcher = JDispatcher::getInstance();
         $ordercopy2 = $order;
         $returnValues = $_dispatcher->trigger('plgVmOnShowOrderFEShipment', array($order['details']['BT']->virtuemart_order_id, $order['details']['BT']->virtuemart_shipmentmethod_id, &$ordercopy2));
         foreach ($returnValues as $returnValue) {
             if ($returnValue !== null) {
                 $shipment .= $returnValue;
             }
         }
         JFactory::getApplication()->set('messageQueue', $orig1);
         JFactory::getApplication()->set('_messageQueue', $orig2);
         $delete = ob_get_clean();
     }
     $order['details']['BT']->shipment_name = $shipment;
     require_once JPATH_SITE . DS . 'components' . DS . 'com_onepage' . DS . 'helpers' . DS . 'mini.php';
     $db = JFactory::getDBO();
     if (OPCmini::tableExists('virtuemart_categories_' . $vmlang)) {
         if (!empty($order['items'])) {
             foreach ($order['items'] as $key => $item) {
                 if (empty($item->virtuemart_category_id)) {
                     //stAn - check if we have category_id info elsewhere:
                     $q = 'select virtuemart_category_id from #__virtuemart_product_categories where virtuemart_product_id = ' . (int) $item->virtuemart_product_id . ' order by ordering asc limit 0,1';
                     $db->setQuery($q);
                     $cat_id = $db->loadResult();
                     if (!empty($cat_id)) {
                         $order['items'][$key]->virtuemart_category_id = $cat_id;
                         $order['items'][$key]->virtuemart_category_name = '';
                         $order['items'][$key]->category_name = '';
                     } else {
                         $order['items'][$key]->virtuemart_category_id = 0;
                         $order['items'][$key]->virtuemart_category_name = '';
                         $order['items'][$key]->category_name = '';
                     }
                     //continue;
                 }
                 $cat_id = (int) $item->virtuemart_category_id;
                 if (OPCmini::tableExists('virtuemart_categories_' . $vmlang)) {
                     if (!empty($cat_id)) {
                         $q = 'select * from `#__virtuemart_categories_' . $vmlang . '` where virtuemart_category_id = ' . $cat_id . ' limit 0,1';
                         $db->setQuery($q);
                         $res = $db->loadAssoc();
                         //$e = $db->getErrorMsg(); if (!empty($e)) {die($e);}
                         if (!empty($res)) {
                             foreach ($res as $key5 => $val5) {
                                 $order['items'][$key]->{$key5} = $val5;
                             }
                             $order['items'][$key]->virtuemart_category_name = $order['items'][$key]->category_name;
                         }
                     }
                 }
                 if (empty($item->virtuemart_manufacturer_id)) {
                     //stAn - check if we have category_id info elsewhere:
                     $q = 'select virtuemart_manufacturer_id from #__virtuemart_product_manufacturers where virtuemart_product_id = ' . (int) $item->virtuemart_product_id . '  limit 0,1';
                     $db->setQuery($q);
                     $man_id = $db->loadResult();
                     $e = $db->getErrorMsg();
                     if (!empty($e)) {
                         die($e);
                     }
                     if (!empty($man_id)) {
                         $order['items'][$key]->virtuemart_manufacturer_id = $man_id;
                         $order['items'][$key]->virtuemart_manufacturer_name = '';
                         $order['items'][$key]->manufacturer_name = '';
                         $order['items'][$key]->mf_name = '';
                     } else {
                         $order['items'][$key]->virtuemart_manufacturer_id = 0;
                         $order['items'][$key]->virtuemart_manufacturer_name = '';
                         $order['items'][$key]->manufacturer_name = '';
                         $order['items'][$key]->mf_name = '';
                     }
                     $mf_id = (int) $item->virtuemart_manufacturer_id;
                     if (OPCmini::tableExists('virtuemart_manufacturers_' . $vmlang)) {
                         if (!empty($mf_id)) {
                             $q = 'select * from `#__virtuemart_manufacturers_' . $vmlang . '` where virtuemart_manufacturer_id = ' . $mf_id . ' limit 0,1';
                             $db->setQuery($q);
                             $res = $db->loadAssoc();
                             $e = $db->getErrorMsg();
                             if (!empty($e)) {
                                 die($e);
                             }
                             if (!empty($res)) {
                                 foreach ($res as $key5 => $val5) {
                                     $order['items'][$key]->{$key5} = $val5;
                                 }
                                 $order['items'][$key]->virtuemart_manufacturer_name = $order['items'][$key]->manufacturer_name = $order['items'][$key]->mf_name;
                             }
                         }
                     }
                 }
             }
         }
     }
     if (!empty($order['details']['BT']->virtuemart_country_id)) {
         $val = (int) $order['details']['BT']->virtuemart_country_id;
         $db = JFactory::getDBO();
         $q = "select * from #__virtuemart_countries where virtuemart_country_id = '" . (int) $val . "' limit 0,1";
         $db->setQuery($q);
         $res = $db->loadAssoc();
         if (!empty($res)) {
             foreach ($res as $key5 => $val5) {
                 $order['details']['BT']->{$key5} = $val5;
             }
         }
     }
     $order['details']['BT']->state_name = '';
     if (!empty($order['details']['BT']->virtuemart_state_id)) {
         $val = (int) $order['details']['BT']->virtuemart_state_id;
         $db = JFactory::getDBO();
         $q = "select * from #__virtuemart_states where virtuemart_state_id = '" . (int) $val . "' limit 0,1";
         $db->setQuery($q);
         $res = $db->loadAssoc();
         if (!empty($res)) {
             $emptystate = array();
             foreach ($res as $key5 => $val5) {
                 $order['details']['BT']->{$key5} = $val5;
                 $emptystate[$key5] = '';
             }
         } else {
             $q = "select * from #__virtuemart_states where 1 limit 0,1";
             $db->setQuery($q);
             $res = $db->loadAssoc();
             $emptystate = array();
             foreach ($res as $key5 => $val5) {
                 $order['details']['BT']->{$key5} = '';
                 $emptystate[$key5] = '';
             }
         }
     }
     $order['details']['bt'] =& $order['details']['BT'];
     $history_sorted = array();
     if (!empty($order['history'])) {
         foreach ($order['history'] as $key => $val) {
             $sql = $order['history'][$key]->modified_on;
             $date = new JDate($sql);
             $time = $date->toUnix();
             if (empty($val)) {
                 $val = '';
             }
             if (isset($history_sorted[$time])) {
                 $time++;
             }
             $history_sorted[$time] = $order['history'][$key];
             //['history_'.$i.'_'.$key] = $val;
         }
     }
     ksort($history_sorted, SORT_NUMERIC);
     $history_sorted = array_reverse($history_sorted);
     unset($order['history']);
     $order['history'] = $history_sorted;
     if (empty($order['details']['ST'])) {
         return;
     }
     if (empty($order['details']['ST']->email)) {
         $order['details']['ST']->email = $order['details']['BT']->email;
     }
     if (!empty($order['details']['ST']->virtuemart_country_id)) {
         $val = (int) $order['details']['ST']->virtuemart_country_id;
         $db = JFactory::getDBO();
         $q = "select * from #__virtuemart_countries where virtuemart_country_id = '" . (int) $val . "' limit 0,1";
         $db->setQuery($q);
         $res = $db->loadAssoc();
         if (!empty($res)) {
             foreach ($res as $key5 => $val5) {
                 $order['details']['ST']->{$key5} = $val5;
             }
         }
     }
     if (!empty($order['details']['ST']->virtuemart_state_id)) {
         $val = (int) $order['details']['ST']->virtuemart_state_id;
         $db = JFactory::getDBO();
         $q = "select * from #__virtuemart_states where virtuemart_state_id = '" . (int) $val . "' limit 0,1";
         $db->setQuery($q);
         $res = $db->loadAssoc();
         if (empty($res)) {
             $res = $emptystate;
         }
         foreach ($res as $key5 => $val5) {
             $order['details']['ST']->{$key5} = $val5;
         }
     }
     $order['details']['st'] =& $order['details']['ST'];
 }
コード例 #5
0
ファイル: tracking.php プロジェクト: aldegtyarev/stelsvelo
    function setEnabled($enabled = null, $order = null)
    {
        if (is_null($enabled)) {
            $enabled = JRequest::getVar('adwords_enabled_0', false);
        }
        $order = JRequest::getInt('tracking_order', 9999);
        require_once JPATH_SITE . DS . 'components' . DS . 'com_onepage' . DS . 'helpers' . DS . 'mini.php';
        OPCmini::clearTableExistsCache();
        if (!OPCmini::tableExists('virtuemart_plg_opctracking')) {
            $db = JFactory::getDBO();
            $q = '
	CREATE TABLE IF NOT EXISTS `#__virtuemart_plg_opctracking` (
	`id` int(11) NOT NULL AUTO_INCREMENT,
	`virtuemart_order_id` int(11) NOT NULL,
	`hash` varchar(32) NOT NULL,
	`shown` text NOT NULL,
	`created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
	`created_by` int(11) NOT NULL,
	`modified` datetime NOT NULL DEFAULT \'0000-00-00 00:00:00\',
	`modified_by` int(11) NOT NULL,
	PRIMARY KEY (`id`),
	UNIQUE KEY `hash_2` (`hash`,`virtuemart_order_id`),
	KEY `virtuemart_order_id` (`virtuemart_order_id`),
	KEY `hash` (`hash`)
	) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=27 ;';
            $db->setQuery($q);
            $db->query();
            $e = $db->getErrorMsg();
            if (!empty($e)) {
                return $e;
            }
        }
        //update from prior opc versions:
        $db = JFactory::getDBO();
        $q = "delete from `#__extensions` WHERE  element = 'opctracking' and folder = 'system' ";
        $db->setQuery($q);
        $db->query();
        OPCmini::clearTableExistsCache();
        if (!file_exists(JPATH_SITE . DS . 'plugins' . DS . 'vmpayment' . DS . 'opctracking')) {
            jimport('joomla.filesystem.folder');
            jimport('joomla.filesystem.file');
            if (JFolder::create(JPATH_SITE . DS . 'plugins' . DS . 'vmpayment' . DS . 'opctracking') !== false) {
                JFile::copy(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_onepage' . DS . 'install' . DS . 'opctracking' . DS . 'opctracking.php', JPATH_SITE . DS . 'plugins' . DS . 'vmpayment' . DS . 'opctracking' . DS . 'opctracking.php');
                JFile::copy(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_onepage' . DS . 'install' . DS . 'opctracking' . DS . 'opctracking.xml', JPATH_SITE . DS . 'plugins' . DS . 'vmpayment' . DS . 'opctracking' . DS . 'opctracking.xml');
                JFile::copy(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_onepage' . DS . 'install' . DS . 'opctracking' . DS . 'index.html', JPATH_SITE . DS . 'plugins' . DS . 'vmpayment' . DS . 'opctracking' . DS . 'index.html');
            } else {
                return JText::sprintf('COM_ONEPAGE_CANNOT_CREATE_DIRECTORY', JPATH_SITE . DS . 'plugins' . DS . 'vmpayment' . DS . 'opctracking');
            }
        }
        if (!empty($enabled)) {
            $db = JFactory::getDBO();
            $q = "select * from #__extensions where element = 'opctracking' and type='plugin' and folder='vmpayment' limit 0,1";
            $db->setQuery($q);
            $isInstalled = $db->loadAssoc();
            if (empty($isInstalled)) {
                $q = ' INSERT INTO `#__extensions` (`extension_id`, `name`, `type`, `element`, `folder`, `client_id`, `enabled`, `access`, `protected`, `manifest_cache`, `params`, `custom_data`, `system_data`, `checked_out`, `checked_out_time`, `ordering`, `state`) VALUES ';
                $q .= " (NULL, 'plg_vmpayment_opctracking', 'plugin', 'opctracking', 'vmpayment', 0, 1, 1, 0, '{\"legacy\":false,\"name\":\"plg_vmpayment_opctracking\",\"type\":\"plugin\",\"creationDate\":\"December 2013\",\"author\":\"RuposTel s.r.o.\",\"copyright\":\"RuposTel s.r.o.\",\"authorEmail\":\"admin@rupostel.com\",\"authorUrl\":\"www.rupostel.com\",\"version\":\"1.7.0\",\"description\":\"One Page Checkout Affiliate Tracking support for VirtueMart 2\",\"group\":\"\"}', '{}', '', '', 0, '0000-00-00 00:00:00', '" . $order . "', 0) ";
                $db->setQuery($q);
                $db->query();
                $e = $db->getErrorMsg();
                if (!empty($e)) {
                    return $e;
                }
            } else {
                $order = JRequest::getVar('tracking_order', null);
                if (!empty($order)) {
                    $q = " UPDATE `#__extensions` SET  `enabled` =  '1', `ordering`='" . $order . "', state = 0 WHERE  element = 'opctracking' and folder = 'vmpayment' ";
                    $db->setQuery($q);
                    $db->query();
                    $e = $db->getErrorMsg();
                    if (!empty($e)) {
                        return $e;
                    }
                }
            }
        } else {
            $db = JFactory::getDBO();
            $q = "select * from #__extensions where element = 'opctracking' and type='plugin' and folder='vmpayment' limit 0,1";
            $db->setQuery($q);
            $isInstalled = $db->loadAssoc();
            if (!empty($isInstalled)) {
                $db = JFactory::getDBO();
                $q = " UPDATE `#__extensions` SET  enabled =  '0', ordering='" . $order . "', state = 0 WHERE  element = 'opctracking' and folder = 'vmpayment' ";
                $db->setQuery($q);
                $db->query();
                $e = $db->getErrorMsg();
                if (!empty($e)) {
                    return $e;
                }
            }
        }
        OPCmini::clearTableExistsCache();
        return '';
    }