Ejemplo n.º 1
0
 public function store()
 {
     require_once JPATH_SITE . DS . 'components' . DS . 'com_onepage' . DS . 'helpers' . DS . 'config.php';
     $theme = OPCconfig::get('selected_template');
     jimport('joomla.filesystem.folder');
     jimport('joomla.filesystem.file');
     $theme = JFile::makeSafe($theme);
     $data = JRequest::get('post');
     $config = OPCconfig::buildObject($data[$theme]);
     if (!is_object($config)) {
         $config = new stdClass();
     }
     $prevConfig = OPCconfig::getValue('theme_config', $theme, 0, $config);
     OPCconfig::store('theme_config', $theme, 0, $config);
     $data = OPCconfig::getValue('theme_config', $file, 0, $default, false);
     return '';
 }
Ejemplo n.º 2
0
 function store()
 {
     require_once JPATH_SITE . DS . 'components' . DS . 'com_onepage' . DS . 'helpers' . DS . 'mini.php';
     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 = $this->getPhpExportThemes();
     $data = JRequest::get('post');
     jimport('joomla.filesystem.file');
     $msg = $this->storeGeneral();
     foreach ($files as $file) {
         $file = JFile::makeSafe($file);
         $path = JPATH_SITE . DS . 'components' . DS . 'com_onepage' . DS . 'xmlexport' . DS . 'php' . DS . $file . '.xml';
         $nd = new stdClass();
         //$params = new OPCparameters($nd, $file, $path, 'opctracking');
         $enabled = JRequest::getVar('plugin_' . $file, false);
         if (!$enabled) {
             $data[$file]['enabled'] = false;
         } else {
             $data[$file]['enabled'] = true;
         }
         $config = OPCconfig::buildObject($data[$file]);
         //var_dump($data[$file]); die();
         OPCconfig::store('xmlexport_config', $file, 0, $config);
         /*
         if (false)
         foreach ($data[$file] as $key=>$param)
          {
         		  echo $key.' '.$param; 
         		}
         */
     }
     if (!empty($msg)) {
         return $msg;
     }
     return;
 }
Ejemplo n.º 3
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;
 }