Example #1
0
 /**
  * Adds the ilike service to user tables;
  * @param unknown_type $post
  * @param unknown_type $userid
  */
 public function addService($post, $userid)
 {
     TuiyoLoader::helper("parameter");
     $table =& TuiyoLoader::table("userplugins", true);
     $table->load(null);
     //blank
     $table->name = "ilike";
     $table->type = "service";
     $table->userid = (int) $userid;
     $table->privacy = '%p00%';
     //get parameters;
     $registry = new JRegistry();
     $postParams = JRequest::getVar('params', array(), 'post', 'array');
     if (count($postParams)) {
         $registry->loadArray($postParams);
         $table->params = $registry->toString();
         //store the username and password and anything else;
     }
     if (!$table->store()) {
         echo $table->getError();
         return false;
         //get the eror;
     }
     return true;
 }
Example #2
0
 function save($data)
 {
     // Get the previous configuration.
     if (is_object($data)) {
         $data = JArrayHelper::fromObject($data);
     }
     $prev = JTheFactoryHelper::getConfig();
     $prev = JArrayHelper::fromObject($prev);
     $data = array_merge($prev, $data);
     $configfile = JTheFactoryAdminHelper::getConfigFile();
     $config = new JRegistry('config');
     $config->loadArray($data);
     jimport('joomla.filesystem.path');
     jimport('joomla.filesystem.file');
     jimport('joomla.client.helper');
     // Get the new FTP credentials.
     $ftp = JClientHelper::getCredentials('ftp', true);
     // Attempt to make the file writeable if using FTP.
     if (!$ftp['enabled'] && JPath::isOwner($configfile) && !JPath::setPermissions($configfile, '0644')) {
         JError::raiseNotice(101, JText::_('FACTORY_SETTINGS_FILE_IS_NOT_WRITABLE'));
     }
     // Attempt to write the configuration file as a PHP class named JConfig.
     $configString = $config->toString('PHP', array('class' => ucfirst(APP_PREFIX) . "Config", 'closingtag' => false));
     if (!JFile::write($configfile, $configString)) {
         JError::raiseWarning(101, JText::_('FACTORY_SETTINGS_FILE_WRITE_FAILED'));
         return false;
     }
     // Attempt to make the file unwriteable if using FTP.
     if (!$ftp['enabled'] && JPath::isOwner($configfile) && !JPath::setPermissions($configfile, '0444')) {
         JError::raiseNotice(101, JText::_('FACTORY_SETTINGS_FILE_IS_NOT_WRITABLE'));
     }
     return true;
 }
Example #3
0
 public function save()
 {
     $task = $this->getTask();
     // get the Application Object
     $app = JFactory::getApplication();
     // get the payment id
     $payment_id = $app->input->getInt('extension_id');
     // if payment id exists
     if ($payment_id) {
         $data = $app->input->getArray($_POST);
         $paymentdata = array();
         $paymentdata['extension_id'] = $payment_id;
         $registry = new JRegistry();
         $registry->loadArray($data);
         $paymentdata['params'] = $registry->toString('JSON');
         try {
             F0FTable::getAnInstance('Payment', 'J2StoreTable')->save($paymentdata);
         } catch (Exception $e) {
             $msg = $e->getMessage();
         }
         switch ($task) {
             case 'apply':
                 parent::apply();
                 break;
             case 'save':
                 parent::save();
                 break;
             case 'savenew':
                 parent::savenew();
                 break;
         }
     }
 }
Example #4
0
 /**
  * TuiyoParameter::saveParams()
  * 
  * @param mixed $postParams
  * @param mixed $key
  * @param string $type
  * @return
  */
 public function saveParams($postParams, $key, $type = "system")
 {
     jimport('joomla.filesystem.file');
     jimport('joomla.client.helper');
     // Set FTP credentials, if given
     JClientHelper::setCredentialsFromRequest('ftp');
     $ftp = JClientHelper::getCredentials('ftp');
     $file = TUIYO_CONFIG . DS . strtolower($key) . ".ini";
     if (JFile::exists($file)) {
         JFile::write($file);
     }
     if (count($postParams)) {
         $registry = new JRegistry();
         $registry->loadArray($postParams);
         $iniTxt = $registry->toString();
         // Try to make the params file writeable
         if (!$ftp['enabled'] && JPath::isOwner($file) && !JPath::setPermissions($file, '0755')) {
             JError::raiseNotice('SOME_ERROR_CODE', _('Could not make the template parameter file writable'));
             return false;
         }
         //Write the file
         $return = JFile::write($file, $iniTxt);
         // Try to make the params file unwriteable
         if (!$ftp['enabled'] && JPath::isOwner($file) && !JPath::setPermissions($file, '0555')) {
             JError::raiseNotice('SOME_ERROR_CODE', _('Could not make the template parameter file unwritable'));
             return false;
         }
         if (!$return) {
             JError::raiseError(TUIYO_SERVER_ERROR, _("Could not save the template parameters"));
             return false;
         }
         return $return;
     }
 }
Example #5
0
 /**
  * Method to bind an associative array or object to the JTable instance.This
  * method only binds properties that are publicly accessible and optionally
  * takes an array of properties to ignore when binding.
  *
  * @param   mixed  $src     An associative array or object to bind to the JTable instance.
  * @param   mixed  $ignore  An optional array or space separated list of properties to ignore while binding.
  *
  * @return  boolean  True on success.
  *
  * @link    http://docs.joomla.org/JTable/bind
  * @since   11.1
  * @throws  InvalidArgumentException
  */
 public function bind($src, $ignore = array())
 {
     if (is_object($src)) {
         $src = get_object_vars($src);
     }
     if (isset($src['params']) && is_array($src['params'])) {
         $registry = new JRegistry();
         $registry->loadArray($src['params']);
         $src['params'] = $registry->toString();
     }
     if (isset($src['plugins']) && is_array($src['plugins'])) {
         $registry = new JRegistry();
         $registry->loadArray($src['plugins']);
         $src['plugins'] = $registry->toString();
     }
     if (isset($src['rules']) && is_array($src['rules'])) {
         $rules = array();
         foreach ((array) $src['rules'] as $action => $ids) {
             $rules[$action] = array();
             foreach ($ids as $id => $p) {
                 if ($p !== '') {
                     $rules[$action][$id] = $p == '1' || $p == 'true' ? true : false;
                 }
             }
         }
         $this->setRules(new JAccessRules($rules));
     }
     return parent::bind($src, $ignore);
 }
Example #6
0
 public function wizardstep()
 {
     $wizardstep = (int) $this->input->getInt('wizardstep', 0);
     // Fetch the component parameters
     $db = JFactory::getDbo();
     $sql = $db->getQuery(true)->select($db->qn('params'))->from($db->qn('#__extensions'))->where($db->qn('type') . ' = ' . $db->q('component'))->where($db->qn('element') . ' = ' . $db->q('com_akeebasubs'));
     $db->setQuery($sql);
     $rawparams = $db->loadResult();
     $params = new JRegistry();
     $params->loadString($rawparams, 'JSON');
     // Set the wzardstep parameter to whatever we were told to
     $params->set('wizardstep', $wizardstep);
     // Save the component parameters
     $data = $params->toString('JSON');
     $sql = $db->getQuery(true)->update($db->qn('#__extensions'))->set($db->qn('params') . ' = ' . $db->q($data))->where($db->qn('type') . ' = ' . $db->q('component'))->where($db->qn('element') . ' = ' . $db->q('com_akeebasubs'));
     $db->setQuery($sql);
     $db->execute();
     // Redirect back to the control panel
     $url = '';
     $returnurl = $this->input->getBase64('returnurl', '');
     if (!empty($returnurl)) {
         $url = base64_decode($returnurl);
     }
     if (empty($url)) {
         $url = JURI::base() . 'index.php?option=com_akeebasubs';
     }
     $this->setRedirect($url);
 }
Example #7
0
 function save()
 {
     $config = new JRegistry('config');
     $config_array = array();
     // affichage des boutons
     $config_array['bt_jamendo'] = JRequest::getVar('bt_jamendo', 0, 'post', 'int');
     $config_array['bt_artiste'] = JRequest::getVar('bt_artiste', 0, 'post', 'int');
     $config_array['bt_categories'] = JRequest::getVar('bt_categories', 0, 'post', 'int');
     $config_array['bt_sms'] = JRequest::getVar('bt_sms', 0, 'post', 'int');
     $config_array['bt_stats'] = JRequest::getVar('bt_stats', 0, 'post', 'int');
     $config_array['bt_aide'] = JRequest::getVar('bt_aide', 0, 'post', 'int');
     $config->loadArray($config_array);
     //Fichier de configuration
     $fname = JPATH_BASE . "/components/com_muzeetop/config.php";
     //écriture du fichier
     jimport('joomla.filesystem.file');
     $string = $config->toString('PHP', array('class' => 'JMztOptions'));
     if (JFile::write($fname, &$string)) {
         $msg = JTEXT::_('COM_MUZEETOP_OPTIONS_ENREGISTRE');
     } else {
         $msg = JTEXT::_('COM_MUZEETOP_ERREUR_OPTIONS_ENREGISTRE');
     }
     $link = 'index.php?option=com_muzeetop';
     $this->setRedirect($link, $msg);
 }
Example #8
0
/**
 * Disables the unsupported eAccelerator caching method, replacing it with the
 * "file" caching method.
 *
 * @return  void
 *
 * @since   3.2
 */
function admin_postinstall_eaccelerator_action()
{
    $prev = new JConfig();
    $prev = JArrayHelper::fromObject($prev);
    $data = array('cacheHandler' => 'file');
    $data = array_merge($prev, $data);
    $config = new JRegistry('config');
    $config->loadArray($data);
    jimport('joomla.filesystem.path');
    jimport('joomla.filesystem.file');
    // Set the configuration file path.
    $file = JPATH_CONFIGURATION . '/configuration.php';
    // Get the new FTP credentials.
    $ftp = JClientHelper::getCredentials('ftp', true);
    // Attempt to make the file writeable if using FTP.
    if (!$ftp['enabled'] && JPath::isOwner($file) && !JPath::setPermissions($file, '0644')) {
        JError::raiseNotice('SOME_ERROR_CODE', JText::_('COM_CONFIG_ERROR_CONFIGURATION_PHP_NOTWRITABLE'));
    }
    // Attempt to write the configuration file as a PHP class named JConfig.
    $configuration = $config->toString('PHP', array('class' => 'JConfig', 'closingtag' => false));
    if (!JFile::write($file, $configuration)) {
        JFactory::getApplication()->enqueueMessage(JText::_('COM_CONFIG_ERROR_WRITE_FAILED'), 'error');
        return;
    }
    // Attempt to make the file unwriteable if using FTP.
    if (!$ftp['enabled'] && JPath::isOwner($file) && !JPath::setPermissions($file, '0444')) {
        JError::raiseNotice('SOME_ERROR_CODE', JText::_('COM_CONFIG_ERROR_CONFIGURATION_PHP_NOTUNWRITABLE'));
    }
}
Example #9
0
 function saveDetails()
 {
     jimport('joomla.filesystem.file');
     $option = JRequest::getVar('option', '', '', 'cmd');
     $post = JRequest::get('post');
     $basepath = JPATH_ADMINISTRATOR . '/components/com_jsecure';
     $configFile = $basepath . '/params.php';
     $xml = $basepath . '/com_jsecure.xml';
     require_once $configFile;
     // Read the ini file
     if (JFile::exists($configFile)) {
         $content = JFile::read($configFile);
     } else {
         $content = null;
     }
     $config = new JRegistry('JSecureConfig');
     $config_array = array();
     $config_array['publish'] = JRequest::getVar('publish', 0, 'post', 'int');
     $config_array['enableMasterPassword'] = JRequest::getVar('enableMasterPassword', 0, 'post', 'int');
     $config_array['master_password'] = JRequest::getVar('master_password', '', 'post', 'string');
     $config_array['passkeytype'] = JRequest::getVar('passkeytype', 'url', 'post', 'string');
     $config_array['key'] = JRequest::getVar('key', '', 'post', 'string');
     $config_array['options'] = JRequest::getVar('options', 0, 'post', 'string');
     $config_array['custom_path'] = JRequest::getVar('custom_path', '', 'post', 'string');
     $config_array['sendemail'] = JRequest::getVar('sendemail', 0, 'post', 'string');
     $config_array['sendemaildetails'] = JRequest::getVar('sendemaildetails', '3', 'post', 'string');
     $config_array['emailid'] = JRequest::getVar('emailid', '', 'post', 'string');
     $config_array['emailsubject'] = JRequest::getVar('emailsubject', '', 'post', 'string');
     $config_array['iptype'] = JRequest::getVar('iptype', 0, 'post', 'int');
     $config_array['iplist'] = JRequest::getVar('iplist', '', 'post', 'string');
     $config_array['mpsendemail'] = JRequest::getVar('mpsendemail', 0, 'post', 'int');
     $config_array['mpemailsubject'] = JRequest::getVar('mpemailsubject', '', 'post', 'string');
     $config_array['mpemailid'] = JRequest::getVar('mpemailid', '', 'post', 'string');
     $oldValue = new JSecureConfig();
     if ($config_array['key'] == '') {
         $config_array['key'] = $oldValue->key;
     } else {
         $keyvalue = $config_array['key'];
         $config_array['key'] = md5(base64_encode($config_array['key']));
     }
     if ($config_array['master_password'] == '') {
         $config_array['master_password'] = $oldValue->master_password;
     } else {
         $masterkeyvalue = $config_array['master_password'];
         $config_array['master_password'] = md5(base64_encode($config_array['master_password']));
     }
     $modifiedFieldName = $this->checkModifiedFieldName($config_array, $oldValue, $JSecureCommon, $keyvalue, $masterkeyvalue);
     $config->loadArray($config_array);
     $fname = JPATH_COMPONENT_ADMINISTRATOR . DS . 'params.php';
     if (JFile::write($fname, $config->toString('PHP', 'JSecureConfig', array('class' => 'JSecureConfig')))) {
         $msg = JText::_('The Configuration Details have been updated');
     } else {
         $msg = JText::_('ERRORCONFIGFILE');
     }
     $JSecureConfig = new JSecureConfig();
     if ($JSecureConfig->mpsendemail != '0') {
         $result = $this->sendmail($JSecureConfig, $modifiedFieldName);
     }
     return true;
 }
 public function install($adapter)
 {
     /** @var $plugin JTableExtension */
     $plugin = JTable::getInstance('extension');
     if (!$plugin->load(array('type' => 'plugin', 'folder' => 'system', 'element' => 'communitybuilder'))) {
         return false;
     }
     /** @var $legacy JTableExtension */
     $legacy = JTable::getInstance('extension');
     if ($legacy->load(array('type' => 'plugin', 'folder' => 'system', 'element' => 'cbcoreredirect'))) {
         $pluginParams = new JRegistry();
         $pluginParams->loadString($plugin->get('params'));
         $legacyParams = new JRegistry();
         $legacyParams->loadString($legacy->get('params'));
         $pluginParams->set('rewrite_urls', $legacyParams->get('rewrite_urls', 1));
         $pluginParams->set('itemids', $legacyParams->get('itemids', 1));
         $plugin->set('params', $pluginParams->toString());
         $installer = new JInstaller();
         try {
             $installer->uninstall('plugin', $legacy->get('extension_id'));
         } catch (RuntimeException $e) {
         }
     }
     $plugin->set('enabled', 1);
     return $plugin->store();
 }
Example #11
0
	public function bind($array, $ignore = '')
	{
		if (is_object($array))
		{
			$array = get_object_vars($array);
		}

		if (isset($array['params']) && !is_string($array['params']))
		{
			if ($array['params'] instanceof JRegistry)
			{
				$registry = $array['params'];
			}
			elseif (is_array($array['params']))
			{
				$registry = new JRegistry;
				$registry->loadArray($array['params']);
			}
			else
			{
				$registry = new JRegistry;
			}
			// TODO: convert to J!2.5: (string) $registry
			$array['params'] = $registry->toString();
		}

		return parent::bind($array, $ignore);
	}
Example #12
0
 function render($position = "")
 {
     global $gantry;
     $output = '';
     $renderer = $gantry->document->loadRenderer('module');
     $options = array('style' => "raw");
     $params = array();
     $group_params = $gantry->getParams($this->_feature_prefix . "-" . $this->_feature_name, true);
     $group_params_reg = new JRegistry();
     foreach ($group_params as $param_name => $param_value) {
         $group_params_reg->set($param_name, $param_value['value']);
     }
     if ($position == $this->get('mainmenu-position')) {
         $params = $gantry->getParams($this->_feature_prefix . "-" . $this->_feature_name . "-mainmenu", true);
         $module = JModuleHelper::getModule('mod_menu', '_z_empty');
         $reg = new JRegistry();
         foreach ($params as $param_name => $param_value) {
             $reg->set($param_name, $param_value['value']);
         }
         $reg->merge($group_params_reg);
         $module->params = $reg->toString();
         $output .= $renderer->render($module, $options);
     }
     return $output;
 }
Example #13
0
 /**
  * Add hashtag to an activity
  * @param $tag
  * @param $activityId
  */
 public function addActivityHashtag($tag, $activityId)
 {
     $tag = trim($tag);
     if ($tag[0] != '#') {
         $tag = "#" . $tag;
     }
     $db = JFactory::getDBO();
     $query = 'SELECT id FROM ' . $db->quoteName('#__community_hashtag') . ' WHERE ' . $db->quoteName('tag') . ' LIKE ' . $db->quote(strtolower($tag));
     $db->setQuery($query);
     $id = $db->loadResult();
     if ($id) {
         $hashtagTable = JTable::getInstance('Hashtag', 'CTable');
         $hashtagTable->load($id);
         $hashtagTable->tag = $tag;
         $params = new JRegistry($hashtagTable->params);
         $tempParam = array_unique(array_merge($params->get('activity_id'), array($activityId)));
         $params->set('activity_id', $tempParam);
         $hashtagTable->params = $params->toString();
         $hashtagTable->store();
     } else {
         $hashtagTable = JTable::getInstance('Hashtag', 'CTable');
         $params = new JRegistry();
         $hashtagTable->tag = $tag;
         $params->set('activity_id', array($activityId));
         $hashtagTable->params = $params->toString();
         $hashtagTable->store();
     }
 }
Example #14
0
 public function install($parent)
 {
     // init vars
     $installer = $parent->getParent();
     $extensions = $this->getAdditionalExtensions($installer);
     // install additional extensions
     foreach ($extensions as $extension) {
         if (!$extension->preInstall() || !$extension->install()) {
             // rollback on installation errors
             $installer->abort(JText::_('Component') . ' ' . JText::_('Install') . ': ' . JText::_('Error'), 'component');
             foreach ($extensions as $extension) {
                 if ($extension->status) {
                     $extension->abort();
                 }
             }
             break;
         }
         if ($extension->type == 'plugin') {
             $extension->enable();
         }
     }
     // display table
     if ($extensions) {
         self::displayAdditionalExtensions($extensions);
     }
     // update tinymce
     $db = JFactory::getDBO();
     $db->setQuery("SELECT e.params FROM #__extensions AS e WHERE e.name='plg_editors_tinymce'");
     $data = new JRegistry($db->loadResult());
     $data->set('extended_elements', $data->get('extended_elements') . ',@[data-lightbox],@[data-spotlight]');
     $db->setQuery("UPDATE #__extensions AS e SET e.params='" . $data->toString() . "' WHERE e.name='plg_editors_tinymce'");
     $db->query();
 }
Example #15
0
 function apply()
 {
     $app = JFactory::getApplication();
     $configs = JRequest::get('POST');
     $model = JFBCFactory::config();
     JPluginHelper::importPlugin('socialprofiles');
     $profilePlugins = $app->triggerEvent('socialProfilesGetPlugins');
     foreach ($profilePlugins as $plugin) {
         $pluginName = $plugin->getName();
         $settings = new JRegistry();
         $search = "profiles_" . $pluginName . "_";
         $stdFields = JRequest::getVar('profiles_' . $pluginName);
         $settings->loadArray($stdFields);
         foreach ($configs as $key => $value) {
             $pos = strpos($key, $search);
             if ($pos === 0) {
                 $key = str_replace($search, "", $key);
                 if (strpos($key, "field_map") != false) {
                     $key = str_replace("_field_map", ".", $key);
                     $settings->set('field_map.' . $key, $value);
                 }
             }
         }
         $model->update("profile_" . $pluginName, $settings->toString());
     }
     JFBCFactory::log(JText::_('COM_JFBCONNECT_MSG_SETTINGS_UPDATED'));
     $this->display();
 }
 /**
  * Method to save the form data.
  *
  * @param   array  $data  The form data.
  *
  * @return  boolean  True on success, False on error.
  *
  * @since   12.2
  */
 public function save($data)
 {
     /*
     $params = array_map(array($this, '_restructData'), $data['params']['name'], $data['params']['price'], $data['params']['count']);
     $registry = new JRegistry($params);
     $data['params'] = $registry->toString();
     */
     if (isset($data['item_image_data'])) {
         $image_data = array_map(function ($src, $desc = '') {
             if ($src && $desc) {
                 return ['src' => $src, 'desc' => $desc];
             } else {
                 return null;
             }
         }, $data['item_image_data']['src'], $data['item_image_data']['desc']);
         array_walk($image_data, function ($value, $key) {
             unset($image_data[$key]);
         });
         $registry = new JRegistry($image_data);
         $data['item_image_data'] = $registry->toString();
     }
     $techs = array_map(array($this, '_restructTechData'), $data['techs']['name'], $data['techs']['value'], $data['techs']['show_short']);
     $registry = new JRegistry($techs);
     $data['techs'] = $registry->toString();
     if (isset($data['alias']) && empty($data['alias'])) {
         /** @noinspection PhpUndefinedClassInspection */
         $data['alias'] = ru_RULocalise::transliterate($data['item_name']);
         $data['alias'] = preg_replace('#\\W#', '-', $data['alias']);
         $data['alias'] = preg_replace('#[-]+#', '-', $data['alias']);
     }
     return parent::save($data);
 }
Example #17
0
 function display($tpl = null)
 {
     jimport('joomla.html.pane');
     $pane = JPane::getInstance('Tabs');
     $this->assignRef('pane', $pane);
     $model = $this->getModel();
     $numOfK2Items = $model->countK2Items();
     $this->assignRef('numOfK2Items', $numOfK2Items);
     $numOfVmProducts = $model->countVmProducts();
     $this->assignRef('numOfVmProducts', $numOfVmProducts);
     $numOfK2martProducts = $model->countK2martProducts();
     $this->assignRef('numOfK2martProducts', $numOfK2martProducts);
     $module = JModuleHelper::getModule('mod_k2mart');
     $params = new JRegistry();
     $params->loadString($module->params);
     $params->set('modLogo', "0");
     $params->set('modCSSStyling', "1");
     $module->params = $params->toString();
     $charts = JModuleHelper::renderModule($module);
     $this->assignRef('charts', $charts);
     $document = JFactory::getDocument();
     $document->addCustomTag('<!--[if lte IE 7]><link href="' . JURI::base() . 'components/com_k2mart/css/style_ie7.css" rel="stylesheet" type="text/css" /><![endif]-->');
     $this->loadHelper('html');
     K2martHTMLHelper::title('K2MART_DASHBOARD');
     K2martHTMLHelper::toolbar();
     K2martHTMLHelper::subMenu();
     parent::display($tpl);
 }
Example #18
0
 /**
  * Store setting into database, in this case, use params field of plans table
  * @param PlanOsMembership $row
  * @param Boolean $isNew true if create new plan, false if edit
  */
 function onAfterSaveSubscriptionPlan($row, $data, $isNew)
 {
     // $row of table osmembership_plans
     $params = new JRegistry($row->params);
     $params->set('acymailing_list_ids', implode(',', $data['acymailing_list_ids']));
     $row->params = $params->toString();
     $row->store();
 }
Example #19
0
 function bind($array)
 {
     if (is_array($array['params'])) {
         $params = new JRegistry($array['params'], true);
         $array['params'] = $params->toString();
     }
     return parent::bind($array);
 }
Example #20
0
 /**
  * Store setting into database
  * @param PlanOsMembership $row
  * @param Boolean $isNew true if create new plan, false if edit
  */
 function onAfterSaveSubscriptionPlan($row, $data, $isNew)
 {
     $params = new JRegistry($row->params);
     $params->set('joomla_group_ids', implode(',', $data['joomla_group_ids']));
     $params->set('subscription_expired_joomla_group_ids', implode(',', $data['subscription_expired_joomla_group_ids']));
     $params->set('joomla_expried_group_ids', implode(',', $data['joomla_expried_group_ids']));
     $row->params = $params->toString();
     $row->store();
 }
Example #21
0
 /**
  * Overloaded bind function to pre-process the params.
  *
  * @param	array		Named array
  * @return	null|string	null is operation was satisfactory, otherwise returns an error
  * @see JTable:bind
  * @since 1.5
  */
 public function bind($array, $ignore = '')
 {
     if (isset($array['params']) && is_array($array['params'])) {
         $registry = new JRegistry();
         $registry->loadArray($array['params']);
         $array['params'] = $registry->toString();
     }
     return parent::bind($array, $ignore);
 }
Example #22
0
 function bind($array, $ignore = '')
 {
     if (key_exists('plugins', $array) && is_array($array['plugins'])) {
         $registry = new JRegistry();
         $registry->loadArray($array['plugins']);
         $array['plugins'] = $registry->toString();
     }
     return parent::bind($array, $ignore);
 }
Example #23
0
 /**
  * Overloaded bind function
  *
  * @acces public
  * @param array $hash named array
  * @return null|string  null is operation was satisfactory, otherwise returns an error
  * @see JTable:bind
  * @since 1.5
  */
 function bind($array, $ignore = '')
 {
     if (key_exists('settings', $array) && is_array($array['settings'])) {
         $registry = new JRegistry();
         $registry->loadArray($array['settings']);
         $array['settings'] = $registry->toString();
     }
     //print_r($array);exit;
     return parent::bind($array, $ignore);
 }
Example #24
0
 /**
  * Bind method
  *
  * @access public
  * @subpackage Yireo
  * @param array $array
  * @param string $ignore
  * @return null
  * @see JTable:bind
  */
 public function bind($array, $ignore = '')
 {
     // Convert the actions array to a flat string
     if (key_exists('actions', $array) && is_array($array['actions'])) {
         $registry = new JRegistry();
         $registry->loadArray($array['actions']);
         $array['actions'] = $registry->toString();
     }
     return parent::bind($array, $ignore);
 }
 /**
  * Overloaded bind function
  *
  * @acces public
  * @param array $hash named array
  * @return null|string	null is operation was satisfactory, otherwise returns an error
  * @see JTable:bind
  * @since 1.5
  */
 function bind($array, $ignore = '')
 {
     if (key_exists('params', $array) && is_array($array['params'])) {
         $registry = new JRegistry();
         $registry->loadArray($array['params']);
         $array['params'] = $registry->toString('ini');
         $array['params'] = ereg_replace('"', '', $array['params']);
     }
     return parent::bind($array, $ignore);
 }
Example #26
0
	public static function save($path)
	{
		$result = array();
		
		if(empty($path)){
			return self::error(JText::_('T3_TM_UNKNOWN_THEME'));
		}
		
		$theme = JFactory::getApplication()->input->getCmd('theme');
		$from = JFactory::getApplication()->input->getCmd('from');
		if (!$theme) {
		   return self::error(JText::_('T3_TM_INVALID_DATA_TO_SAVE'));
		}

		$file = $path . '/less/themes/' . $theme . '/variables-custom.less';

		if(!class_exists('JRegistryFormatLESS')){
			T3::import('format/less');
		}
		$variables = new JRegistry();
		$variables->loadObject($_POST);
		
		$data = $variables->toString('LESS');
		$type = 'new';
		if (JFile::exists($file)) {
			$type = 'overwrite';
		} else {

			if(JFolder::exists($path . '/less/themes/' . $from)){
				if(@JFolder::copy($path . '/less/themes/' . $from, $path . '/less/themes/' . $theme) != true){
					return self::error(JText::_('T3_TM_NOT_FOUND'));
				}
			} else if($from == 'base') {
				$dummydata = "";
				@JFile::write($path . '/less/themes/' . $theme . '/template.less', $dummydata);
				@JFile::write($path . '/less/themes/' . $theme . '/variables.less', $dummydata);
				@JFile::write($path . '/less/themes/' . $theme . '/template-responsive.less', $dummydata);
			}
		}
		
		$return = @JFile::write($file, $data);

		if (!$return) {
			return self::error(JText::_('T3_TM_OPERATION_FAILED'));
		} else {
			$result['success'] = JText::sprintf('T3_TM_SAVE_SUCCESSFULLY', $theme);
			$result['theme'] = $theme;
			$result['type'] = $type;
		}

		//LessHelper::compileForTemplate(T3_TEMPLATE_PATH, $theme);
		T3::import ('core/less');
		T3Less::compileAll($theme);
		return self::response($result);
	}
 /**
  * Used for creating stylesheets dynamically, based on template configuration.
  * @param name of the .php file used for generating CSS output
  */
 public function cacheStyleSheet($generator)
 {
     if (JFolder::exists(JMF_TPL_PATH . DIRECTORY_SEPARATOR . 'cache') == false) {
         if (!JFolder::create(JMF_TPL_PATH . DIRECTORY_SEPARATOR . 'cache')) {
             if (JDEBUG) {
                 throw new Exception(JText::_('PLG_SYSTEM_JMFRAMEWORK_CACHE_FOLDER_NOT_ACCESSIBLE'));
             } else {
                 return false;
             }
         }
     }
     $tplParamsHash = md5($this->params->toString());
     // file name
     $css = current(explode('.', $generator)) . '_' . $tplParamsHash . '.css';
     // CSS path
     //$cssPath = JPATH_ROOT.DIRECTORY_SEPARATOR.'cache'.DIRECTORY_SEPARATOR.'tpl-'.$this->template.DIRECTORY_SEPARATOR.$css;
     $cssPath = JMF_TPL_PATH . DIRECTORY_SEPARATOR . 'cache' . DIRECTORY_SEPARATOR . $css;
     // CSS URL
     //$cssURL = JURI::base().'cache/tpl-'.$this->template.'/'.$css;
     $cssURL = JMF_TPL_URL . '/cache/' . $css;
     // CSS generator
     $cssGenerator = JMF_TPL_PATH . DIRECTORY_SEPARATOR . 'css' . DIRECTORY_SEPARATOR . $generator;
     if (!JFile::exists($cssGenerator)) {
         if (JDEBUG) {
             throw new Exception(JText::sprintf('PLG_SYSTEM_JMFRAMEWORK_MISSING_CSS_GENERATOR', $generator));
         } else {
             return false;
         }
     }
     if (!JFile::exists($cssPath) || $this->params->get('devmode', false) == true) {
         if (JFile::exists($cssPath)) {
             JFile::delete($cssPath);
         }
         // if there's nothing in cache, let's cache the css.
         ob_start();
         // PHP file which uses template parameters to generate CSS content
         include $cssGenerator;
         $cssContent = ob_get_contents();
         ob_end_clean();
         if ($cssContent) {
             if (!JFile::write($cssPath, $cssContent)) {
                 if (JDEBUG) {
                     throw new Exception(JText::_('PLG_SYSTEM_JMFRAMEWORK_CACHE_FOLDER_NOT_ACCESSIBLE'));
                 } else {
                     return false;
                 }
             }
         }
     }
     // if CSS exists return its URL
     if (JFile::exists($cssPath)) {
         return $cssURL;
     }
     return false;
 }
Example #28
0
 function _SaveField()
 {
     /*
      * @var $field JTheFactoryFieldsTable;
      * @var $field_type FactoryFieldTypes;
      * @var $model JTheFactoryModelFields;
      * */
     $id = JRequest::getInt('id');
     $cat_filter = JRequest::getVar('parent', array(), '', 'array');
     $field = JTable::getInstance('FieldsTable', 'JTheFactory');
     $model = JModel::getInstance('Fields', 'JTheFactoryModel');
     $cfg = CustomFieldsFactory::getConfig();
     $field->bind(JRequest::get());
     $paramobj = new JRegistry(JRequest::getVar('params', ''));
     $field->params = $paramobj->toString('INI');
     $field->own_table = $cfg['tables'][$field->page];
     if ($field->id) {
         //some fields do not change
         /* @var $db JDatabase */
         $db = JFactory::getDbo();
         $db->setQuery("select * from " . $field->getTableName() . " where " . $field->getKeyName() . "='" . $field->id . "'");
         $f = $db->loadObject();
         $field->db_name = $f->db_name;
         $field->page = $f->page;
         $field->own_table = $f->own_table;
     }
     $errors = $field->check();
     if (count($errors)) {
         $message = JText::_("FACTORY_ERROR_SAVING_FIELDBR");
         $message .= join("<br>", $errors);
         $app = JFactory::getApplication();
         $app->redirect("index.php?option=" . APP_EXTENSION . "&task=fields.edit&id={$id}", $message);
         return;
     }
     if (!$field->store()) {
         $message = JText::_("FACTORY_ERROR_SAVING_FIELDBR");
         $app = JFactory::getApplication();
         $app->redirect("index.php?option=" . APP_EXTENSION . "&task=fields.edit&id={$id}", $message);
         return;
     }
     $field_type = CustomFieldsFactory::getFieldType($field->ftype);
     if ($field_type->has_options) {
         $field_options = JRequest::getVar('field_option');
         if (count($field_options)) {
             foreach ($field_options as $opt) {
                 $field->store_option($opt);
             }
         }
     }
     if ($field->categoryfilter && $cfg['has_category'][$field->page]) {
         $model->setAssignedCats($field, $cat_filter);
     }
     return $field;
 }
Example #29
0
 public function bind($array, $ignore = '')
 {
     if (key_exists('params', $array)) {
         if (is_array($array['params'])) {
             $registry = new JRegistry();
             $registry->loadArray($array['params']);
             $array['attribs'] = $registry->toString();
         }
     }
     return parent::bind($array, $ignore);
 }
Example #30
0
 function saveAdminForm()
 {
     $data = JRequest::get('post', JREQUEST_ALLOWHTML);
     unset($data['option']);
     unset($data['task']);
     unset($data['classname']);
     unset($data['id']);
     $config = new JRegistry($data);
     $params = $config->toString('INI');
     $model = JModel::getInstance('Gateways', 'JTheFactoryModel');
     $model->saveGatewayParams($this->name, $params);
 }