예제 #1
0
 /**
  * Display the view
  */
 public function display($tpl = null)
 {
     $model = $this->getModel();
     require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_onepage' . DS . 'helpers' . DS . 'videohelp.php';
     //$config = JController::getModel('config', 'JModel');
     require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_onepage' . DS . 'models' . DS . 'config.php';
     $config = new JModelConfig();
     $config->loadVmConfig();
     //var_dump($config); die();
     $this->statuses = $config->getOrderStatuses();
     $this->trackingfiles = $config->getPhpTrackingThemes();
     $this->forms = $model->getJforms($this->trackingfiles);
     $this->isEnabled = $model->isEnabled();
     $this->tracking_order = $model->isEnabled(true);
     $this->config = $model->getStatusConfig($this->statuses);
     $rand_order = JRequest::getVar('show_order_vars', false);
     $named = array();
     $this->orderVars = $model->getOrderVars($named);
     $this->named = $named;
     $this->model =& $model;
     $this->aba_enabled = $model->getAba();
     if ($rand_order) {
         $model->showOrderVars();
         JFactory::getApplication()->close();
     }
     //debug_zval_dump ($this->forms['adwordstracking']); die();
     parent::display($tpl);
 }
예제 #2
0
    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
 function display($tpl = null)
 {
     if (!class_exists('VmConfig')) {
         require JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'config.php';
     }
     VmConfig::loadConfig(true);
     if (file_exists(JPATH_SITE . DS . 'components' . DS . 'com_onepage' . DS . 'config' . DS . 'onepage.cfg.php')) {
         include JPATH_SITE . DS . 'components' . DS . 'com_onepage' . DS . 'config' . DS . 'onepage.cfg.php';
     }
     require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_onepage' . DS . 'models' . DS . 'config.php';
     $model = new JModelConfig();
     //$limit = JRequest::getVar('limit', $mainframe->getCfg('list_limit'));
     //limitstart = JRequest::getVar('limitstart', 0);
     /*
     if (!file_exists(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_virtuemart'.DS.'classes'.DS.'ps_onepage.php'))
     {
      $model->install(true);
     }
     */
     $model->loadVmConfig('config');
     require_once JPATH_COMPONENT . DS . 'assets' . DS . 'export_helper.php';
     $this->ehelper = new OnepageTemplateHelper();
     $this->opcexts = $model->getOPCExtensions();
     $countries = $model->getShippingCountries();
     $pms = $model->getPaymentMethods();
     $sty = $model->getClassNames();
     $default_country = $model->getDefaultC();
     $dis = $model->getDisabledOPC();
     $this->assignRef('disable_onepage', $dis);
     $model->checkLangFiles();
     $trackingfiles = $model->getPhpTrackingThemes();
     $this->assignRef('trackingfiles', $trackingfiles);
     $model->getExtLangVars();
     $langs = $model->getLanguages();
     $css = $model->retCss();
     $php = $model->retPhp();
     $sids = $model->getShippingRates();
     if (empty($sids)) {
         $sids = array();
     }
     $coref = array();
     $ulist = $model->getUserFieldsLists($coref);
     $this->assignRef('clist', $coref);
     $this->assignRef('ulist', $ulist);
     $langse = array();
     $exts = array();
     $lext = $model->listExts($exts, $langse);
     $adminxts = array();
     $langse2 = array();
     $lext2 = $model->listExtsaAdmin($adminxts, $langse2);
     $this->assignRef('exts', $exts);
     $this->assignRef('adminxts', $adminxts);
     $this->assignRef('extlangs', $langse);
     $langerr = $model->getlangerr();
     $this->assignRef('langerr', $langerr);
     //$lang_vars = $model->getLangVars();
     $templates = $model->getTemplates();
     $errors = $model->getErrMsgs();
     $statuses = $model->getOrderStatuses();
     $codes = $model->getJLanguages();
     $exthtml = $model->getExtensions();
     $groups = $model->listShopperGroups();
     $vatgroups = $model->listShopperGroupsSelect();
     $lfields = $model->listUserfields();
     //function getArticleSelector($name, $value, $required=false)
     require_once JPATH_SITE . DS . 'components' . DS . 'com_onepage' . DS . 'helpers' . DS . 'config.php';
     $this->lang_thank_youpage = OPCconfig::getValue('ty_page', 'ty_page', 0, array(0 => ''));
     $this->model =& $model;
     $this->assignRef('groups', $groups);
     $this->assignRef('vatgroups', $vatgroups);
     $this->assignRef('lfields', $lfields);
     $this->assignRef('exthtml', $exthtml);
     $this->assignRef('codes', $codes);
     $this->assignRef('statuses', $statuses);
     $this->assignRef('errors', $errors);
     $this->assignRef('templates', $templates);
     //$this->assignRef('lang_vars', $lang_vars);
     if (empty($pms)) {
         $pms = array();
     }
     $this->assignRef('pms', $pms);
     $this->assignRef('sty', $sty);
     $this->assignRef('countries', $countries);
     $this->assignRef('default_country', $default_country);
     $this->assignRef('langs', $langs);
     // ok
     $this->assignRef('css', $css);
     $this->assignRef('php', $php);
     $this->assignRef('sids', $sids);
     $model2 = $this->getModel();
     $model2->checkTable();
     // $currencies = $model->getAllCurrency($limitstart, $limit);
     // $total = $model->countRows();
     jimport('joomla.html.pagination');
     //$pageNav = new JPagination($total, $limitstart, $limit);
     //$this->assignRef('currencies', $currencies);
     //$this->assignRef('pageNav', $pageNav);
     parent::display($tpl);
 }
예제 #4
0
 function store()
 {
     $enabled = JRequest::getVar('adwords_enabled_0', false);
     $order = JRequest::getInt('tracking_order', 9999);
     $this->setEnabled($enabled, $order);
     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'); 
     	}
     */
     $wasEnabled = array();
     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');
     foreach ($files as $file) {
         $file = JFile::makeSafe($file);
         $path = JPATH_SITE . DS . 'components' . DS . 'com_onepage' . DS . 'trackers' . DS . 'php' . DS . $file . '.xml';
         $nd = new stdClass();
         //$params = new OPCparameters($nd, $file, $path, 'opctracking');
         // the item is not enabled:
         if (empty($data[$file])) {
             $data[$file]['enabled'] = 0;
         }
         $config = OPCconfig::buildObject($data[$file]);
         if (!is_object($config)) {
             $config = new stdClass();
         }
         $prevConfig = OPCconfig::getValue('tracking_config', $file, 0, $config);
         $key = 'enabled';
         $is_enabled = (int) JRequest::getVar('plugin_' . $file, -1);
         if (!empty($prevConfig) && is_object($config)) {
             if (empty($prevConfig->enabled) && !empty($is_enabled)) {
                 $config->enabled_since = time();
                 $wasEnabled[$file] = time();
             } else {
                 if (!empty($prevConfig->enabled_since)) {
                     $wasEnabled[$file] = $prevConfig->enabled_since;
                 } else {
                     $wasEnabled[$file] = time();
                 }
                 $config->enabled_since = $wasEnabled[$file];
             }
         }
         foreach ($prevConfig as $kp => $vp) {
             if (!isset($config->{$kp})) {
                 $config->{$kp} = '';
             }
         }
         if (empty($is_enabled)) {
             $wasEnabled[$file] = false;
         }
         $config->{$key} = $is_enabled;
         OPCconfig::store('tracking_config', $file, 0, $config);
     }
     $aba = JRequest::getVar('aba_enabled', false);
     if (!empty($aba)) {
         $aba = true;
     }
     OPCconfig::store('aba', '', 0, $aba);
     foreach ($statuses as $status) {
         $status2 = $status['order_status_code'];
         $default = new stdClass();
         $config = OPCconfig::getValue('tracking', $status2, 0, $default);
         // config is an object of strings ONLY
         if (!empty($config)) {
             foreach ($config as $file => $data2) {
                 if (is_object($data2)) {
                     unset($config->{$file});
                 } else {
                     if (stripos($file, 'since') === 0) {
                         $file2 = substr($file, 5);
                         if (!in_array($file2, $files)) {
                             unset($config->{$file});
                         } else {
                             $config->{$file2 . '_since'} = $data2;
                             unset($config->{$file});
                         }
                     } else {
                         if (stripos($file, '_since') !== false) {
                             $file2 = str_replace('_since', '', $file);
                             if (!in_array($file2, $files)) {
                                 unset($config->{$file});
                             }
                         } else {
                             if (!in_array($file, $files)) {
                                 unset($config->{$file});
                             }
                         }
                     }
                 }
             }
         }
         foreach ($files as $file) {
             /*
             if (!empty($config->$file))
             $wasEnabled = true; 
             else $wasEnabled = false; 
             */
             $enabled = JRequest::getVar($file . '_' . $status2, 0);
             $t1 = JRequest::getVar('plugin_' . $file, -1);
             $is_enabled = (int) JRequest::getVar('plugin_' . $file, -1);
             $key = $file . '_since';
             $ct2 = new stdClass();
             //$ct = OPCconfig::getValue('tracking', $status2, 0, $ct2);
             // stAn - do not ovewrite since time when not altering status
             // enabled per status:
             if ($enabled) {
                 if (empty($config->{$file})) {
                     // if the file was not enabled per this status before
                     $config->{$key} = time();
                 } else {
                     $config->{$key} = $wasEnabled[$file];
                 }
             } else {
                 unset($config->{$key});
                 unset($config->{$file});
                 $enabled = false;
                 $key = $file . '_enabled';
                 // clear database of unneeded data:
                 unset($config->{$key});
                 $key = $file . '_since';
                 unset($config->{$key});
             }
             // gneral enabled (plugin)
             if (empty($is_enabled)) {
                 $enabled = false;
                 $key = $file . '_enabled';
                 // clear database of unneeded data:
                 unset($config->{$key});
                 $key = $file . '_since';
                 unset($config->{$key});
             }
             if (!empty($is_enabled) && !empty($enabled)) {
                 //if (empty($config->$file)) $config->$file = $file;
                 $key = $file . '_enabled';
                 $config->{$key} = true;
                 $config->{$file} = $enabled;
             }
             if (empty($enabled)) {
                 unset($config->{$file});
             } else {
                 $config->{$file} = $enabled;
             }
         }
         $tmp = (array) $config;
         if (empty($tmp)) {
             $checkempty = true;
         } else {
             $checkempty = false;
         }
         $config->code = JRequest::getVar('adwords_code_' . $status2, '', 'post', 'string', JREQUEST_ALLOWRAW);
         $only_when = JRequest::getVar('opc_tracking_only_when_' . $status2, '');
         $config->only_when = $only_when;
         $donotsave = false;
         if ($checkempty) {
             if (empty($config->code)) {
                 OPCconfig::clearConfig('tracking', $status2, 0);
                 $donotsave = true;
             }
         }
         if (!$donotsave) {
             OPCconfig::store('tracking', $status2, 0, $config);
         }
     }
     $negative_statuses = JRequest::getVar('negative_statuses', array());
     if (is_array($negative_statuses)) {
         OPCconfig::store('tracking_negative', 'negative_statuses', 0, $negative_statuses);
     }
     return;
 }