function copylang() { $err = $this->getlangerr(); $dbj = JFactory::getDBO(); $prefix = $dbj->getPrefix(); // CREATE TABLE recipes_new LIKE production.recipes; INSERT recipes_new SELECT * FROM production.recipes; foreach ($err as $table) { $table = $prefix . $table; $orig = str_replace(VMLANG, 'en_gb', $table); if ($this->tableExists($orig)) { $q = 'create table ' . $table . ' like ' . $orig; $dbj->setQuery($q); $dbj->query(); $err = $dbj->getErrorMsg(); if (!empty($err)) { echo $err; die('err config.php'); } // INSERT INTO recipes_new SELECT * FROM production.recipes; $q = 'insert into ' . $table . ' select * from ' . $orig; $dbj->setQuery($q); $dbj->query(); $err = $dbj->getErrorMsg(); if (!empty($err)) { echo $err; die('err config.php'); } } } require_once JPATH_SITE . DS . 'components' . DS . 'com_onepage' . DS . 'helpers' . DS . 'mini.php'; OPCmini::clearTableExistsCache(); }
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 ''; }