public function onCCK_FieldPrepareForm(&$field, $value = '', &$config = array(), $inherit = array(), $return = false)
 {
     if (self::$type != $field->type) {
         return;
     }
     // Prepare
     $app = JFactory::getApplication();
     $form = '';
     $options2 = JCckDev::fromJSON($field->options2);
     $variables = explode('||', $field->options);
     if (count($variables)) {
         foreach ($variables as $k => $name) {
             if ($name) {
                 $request = 'get' . ucfirst($options2['options'][$k]->type ? $options2['options'][$k]->type : '');
                 $value = $app->input->{$request}($name, '');
                 $value = htmlspecialchars($value, ENT_COMPAT, 'UTF-8');
                 $form .= '<input class="inputbox hidden" type="hidden" id="' . $name . '" name="' . $name . '" value="' . $value . '" />';
             }
         }
     }
     $field->form = $form;
     $field->state = 1;
     $field->value = '';
     // Return
     if ($return === true) {
         return $field;
     }
 }
Exemple #2
0
 public static function g_getLive($params, $format = '')
 {
     if ($format != '') {
         return JCckDev::fromJSON($params, $format);
     } else {
         $reg = new JRegistry();
         if ($params) {
             $reg->loadString($params);
         }
         return $reg;
     }
 }
Exemple #3
0
 protected function postSaveHook(CCKModelSite &$model, $validData = array())
 {
     $recordId = $model->getState($this->context . '.id');
     if ($recordId == 10 || $recordId == 500) {
         $db = JFactory::getDbo();
         $params = JCckDatabase::loadResult('SELECT params FROM #__extensions WHERE element = "com_cck"');
         $config = JCckDev::fromJSON($params, 'object');
         $config->multisite = 1;
         $params = $db->escape(JCckDev::toJSON($config));
         JCckDatabase::execute('UPDATE #__extensions SET params = "' . $params . '" WHERE element = "com_cck"');
     }
 }
Exemple #4
0
 public static function applyTypeOptions(&$config)
 {
     $options = JCckDatabase::loadResult('SELECT options_' . $config['client'] . ' FROM #__cck_core_types WHERE name ="' . (string) $config['type'] . '"');
     $options = JCckDev::fromJSON($options);
     if (isset($options['message']) && $options['message'] != '') {
         $config['message'] = $options['message'];
     }
     if (isset($options['data_integrity_excluded'])) {
         $options['data_integrity_excluded'] = explode(',', str_replace(' ', ',', trim($options['data_integrity_excluded'])));
     } else {
         $options['data_integrity_excluded'] = array();
     }
     $config['message_style'] = isset($options['message_style']) ? $options['message_style'] : 'message';
     $config['options'] = $options;
 }
 public function onCCK_FieldPrepareForm(&$field, $value = '', &$config = array(), $inherit = array(), $return = false)
 {
     if (self::$type != $field->type) {
         return;
     }
     self::$path = parent::g_getPath(self::$type . '/');
     parent::g_onCCK_FieldPrepareForm($field, $config);
     // Init
     if (count($inherit)) {
         $id = isset($inherit['id']) && $inherit['id'] != '' ? $inherit['id'] : $field->name;
         $name = isset($inherit['name']) && $inherit['name'] != '' ? $inherit['name'] : $field->name;
     } else {
         $id = $field->name;
         $name = $field->name;
     }
     $value = $value != '' ? $value : $field->defaultvalue;
     // Validate
     $validate = '';
     if ($config['doValidation'] > 1) {
         plgCCK_Field_ValidationRequired::onCCK_Field_ValidationPrepareForm($field, $id, $config);
         $validate = count($field->validate) ? ' validate[' . implode(',', $field->validate) . ']' : '';
     }
     // Prepare
     $options2 = JCckDev::fromJSON($field->options2);
     $opts = self::_getOptionsList($options2, $field, $config);
     $class = 'inputbox select' . $validate . ($field->css ? ' ' . $field->css : '');
     if ($value != '') {
         $class .= ' has-value';
     }
     $attr = 'class="' . $class . '"' . ($field->attributes ? ' ' . $field->attributes : '');
     $form = count($opts) ? JHtml::_('select.genericlist', $opts, $name, $attr, 'value', 'text', $value, $id) : '';
     // Set
     if (!$field->variation) {
         $field->form = $form;
         if ($field->script) {
             parent::g_addScriptDeclaration($field->script);
         }
     } else {
         parent::g_getDisplayVariation($field, $field->variation, $value, $value, $form, $id, $name, '<select', '', '', $config);
     }
     $field->value = $value;
     // Return
     if ($return === true) {
         return $field;
     }
 }
Exemple #6
0
 protected static function _typo($typo, $field, $value, &$config = array())
 {
     $format = $typo->get('format', 'Y-m-d');
     $value = trim($field->value);
     if ($format == -2) {
         $typo = self::_getTimeAgo($value, $typo->get('unit', ''), $typo->get('alt_format', ''), $typo->get('format2', 'Y-m-d'));
     } else {
         $options2 = JCckDev::fromJSON($field->options2);
         if ($format == -1) {
             $format = trim($typo->get('format_custom', @$options2['format']));
         }
         $value = self::_getValueWithFormatStorage($value, @$options2['storage_format']);
         $date_eng = $format ? date($format, $value) : $value;
         $typo = self::_getDateByLang($format, $value, $date_eng);
     }
     return $typo;
 }
Exemple #7
0
 function prepareDisplay()
 {
     $app = JFactory::getApplication();
     $model = $this->getModel();
     $this->form = $this->get('Form');
     $this->item = $this->get('Item');
     $this->option = $app->input->get('option', '');
     $this->state = $this->get('State');
     // Check Errors
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode("\n", $errors));
         return false;
     }
     $this->isNew = @$this->item->id > 0 ? 0 : 1;
     $this->item->published = Helper_Admin::getSelected($this->vName, 'state', $this->item->published, 1);
     $this->item->type = $this->state->get('type', '2,7');
     $this->item->fields = JCck::getConfig_Param('multisite_options', array());
     $this->item->options = $this->item->options ? JCckDev::fromJSON($this->item->options) : array();
     Helper_Admin::addToolbarEdit($this->vName, _C5_TEXT, array('isNew' => $this->isNew, 'folder' => 0, 'checked_out' => $this->item->checked_out));
 }
Exemple #8
0
 public function revert($pk, $type)
 {
     $db = $this->getDbo();
     $table = $this->getTable();
     if (!$pk || !$type) {
         return false;
     }
     $table->load($pk);
     if (JCck::getConfig_Param('version_revert', 1) == 1) {
         Helper_Version::createVersion($type, $table->e_id, JText::sprintf('COM_CCK_VERSION_AUTO_BEFORE_REVERT', $table->e_version));
     }
     $row = JTable::getInstance($type, 'CCK_Table');
     $row->load($table->e_id);
     $core = JCckDev::fromJSON($table->e_core);
     if (isset($row->asset_id) && $row->asset_id && isset($core['rules'])) {
         JCckDatabase::execute('UPDATE #__assets SET rules = "' . $db->escape($core['rules']) . '" WHERE id = ' . (int) $row->asset_id);
     }
     // More
     if ($type == 'search') {
         $clients = array(1 => 'search', 2 => 'filter', 3 => 'list', 4 => 'item', 5 => 'order');
     } else {
         $clients = array(1 => 'admin', 2 => 'site', 3 => 'intro', 4 => 'content');
     }
     foreach ($clients as $i => $client) {
         $name = 'e_more' . $i;
         $this->_revert_more($type, $client, $table->e_id, $table->{$name});
     }
     // Override
     if ($row->version && $row->version != $table->e_version) {
         $core['version'] = ++$row->version;
     }
     $core['checked_out'] = 0;
     $core['checked_out_time'] = '0000-00-00 00:00:00';
     $row->bind($core);
     $row->check();
     $row->store();
     return true;
 }
Exemple #9
0
    public function onCCK_FieldPrepareForm(&$field, $value = '', &$config = array(), $inherit = array(), $return = false)
    {
        if (self::$type != $field->type) {
            return;
        }
        self::$path = parent::g_getPath(self::$type . '/');
        parent::g_onCCK_FieldPrepareForm($field, $config);
        // Init
        if (count($inherit)) {
            $id = isset($inherit['id']) && $inherit['id'] != '' ? $inherit['id'] : $field->name;
            $name = isset($inherit['name']) && $inherit['name'] != '' ? $inherit['name'] : $field->name;
            $inherited = true;
        } else {
            $id = $field->name;
            $name = $field->name;
            $inherited = false;
        }
        $value = $value != '' ? (int) $value : @(int) $config['asset_id'];
        // Validate
        $validate = '';
        // Prepare
        $options2 = JCckDev::fromJSON($field->options2);
        $component = @$options2['extension'] ? $options2['extension'] : 'com_content';
        $section = @$options2['section'] ? $options2['section'] : 'article';
        if ($field->bool) {
            // Default
            $class = 'inputbox select' . $validate . ($field->css ? ' ' . $field->css : '');
            $xml = '
						<form>
							<field
								type="' . self::$type2 . '"
								id="' . $id . '"
								name="' . $name . '"
								label="' . htmlspecialchars($field->label) . '"
								filter="rules"
								component="' . $component . '"
								section="' . $section . '"
								class="' . $class . '"
							/>
							<field
								type="hidden"
								name="asset_id"
								readonly="true"
								class="readonly"
							/>
						</form>
					';
            $form = JForm::getInstance($id, $xml);
            $form->setValue('asset_id', null, $value);
            $form = $form->getInput($name);
            $form = str_replace('<select name="' . $name . '[', '<select class="inputbox" name="' . $name . '[', $form);
        } else {
            // Modal Box
            $app = JFactory::getApplication();
            if (trim($field->selectlabel)) {
                if ($config['doTranslation']) {
                    $field->selectlabel = JText::_('COM_CCK_' . str_replace(' ', '_', trim($field->selectlabel)));
                }
                $buttonlabel = $field->selectlabel;
            } else {
                $buttonlabel = JText::_('COM_CCK_PERMISSIONS');
            }
            $link = 'index.php?option=com_cck&task=box.add&tmpl=component&file=plugins/cck_field/' . self::$type . '/tmpl/form.php' . '&id=' . $id . '&name=' . $name . '&type=' . $value . '&params=' . $component . '||' . $section;
            $class = 'jform_rules_box variation_href';
            if ($app->input->get('option') == 'com_cck' && $app->input->get('view') != 'form') {
                // todo: remove later
                $class .= ' btn';
            }
            $class = 'class="' . $class . '" ';
            $attr = $class;
            $rules = '';
            $form = '<textarea style="display: none;" id="' . $id . '" name="' . $name . '">' . $rules . '</textarea>';
            $form .= '<a href="' . $link . '" ' . $attr . '>' . $buttonlabel . '</a>';
            $field->markup_class .= ' cck_form_wysiwyg_editor_box';
        }
        // Set
        if (!$field->variation) {
            $field->form = $form;
            self::_addScripts($field->bool, array('inherited' => $inherited), $config);
            if ($field->script) {
                parent::g_addScriptDeclaration($field->script);
            }
        } else {
            parent::g_getDisplayVariation($field, $field->variation, $value, $value, $form, $id, $name, '<select', '', '', $config);
        }
        $field->value = $value;
        // Return
        if ($return === true) {
            return $field;
        }
    }
Exemple #10
0
        </ul>
        <ul class="spe spe_description">
            <?php 
echo JCckDev::renderForm($cck['core_description'], $this->item->description, $config, array('label' => 'clear', 'selectlabel' => 'Description'));
?>
        </ul>
	</div>
    
	<div class="seblod">
        <div class="legend top left"><?php 
echo JText::_('COM_CCK_OPTIONS');
?>
</div>
        <ul class="adminformlist adminformlist-2cols">
			<?php 
$cfg = JCckDev::fromJSON($this->item->configuration, 'array');
echo JCckDev::renderForm($cck['core_site_name'], @$cfg['sitename'], $config);
echo JCckDev::renderForm($cck['core_site_pagetitles'], @$cfg['sitename_pagetitles'], $config);
echo JCckDev::renderForm($cck['core_site_metadesc'], @$cfg['metadesc'], $config);
echo JCckDev::renderForm($cck['core_site_metakeys'], @$cfg['metakeys'], $config);
echo JCckDev::renderForm($cck['core_site_homepage'], @$cfg['homepage'], $config);
echo JCckDev::renderForm($cck['core_site_language'], @$cfg['language'], $config);
echo JCckDev::renderForm($cck['core_site_offline'], @$cfg['offline'], $config);
echo JCckDev::renderForm($cck['core_site_template_style'], @$cfg['template_style'], $config);
?>
        </ul>
		<?php 
if (!$this->isNew) {
    ?>
			<img id="toggle_acl" src="components/com_cck/assets/images/24/icon-24-acl.png" border="0" alt="" style="float: right; margin: 9px 9px 0px 0px; cursor: pointer;" />
		<?php 
Exemple #11
0
			<th width="25%" class="center hidden-phone nowrap" colspan="4"><?php 
echo JText::_('COM_CCK_FIELDS');
?>
</th>
		</tr>
	</thead>
    <tbody>
	<?php 
$named = '';
foreach ($this->items as $i => $item) {
    $checkedOut = !($item->checked_out == $userId || $item->checked_out == 0);
    $canCheckin = $user->authorise('core.manage', 'com_checkin') || $item->checked_out == $userId || $item->checked_out == 0;
    $canChange = $user->authorise('core.edit.state', CCK_COM) && $canCheckin;
    $canEdit = $user->authorise('core.edit', CCK_COM);
    $canEditOwn = '';
    $more = JCckDev::fromJSON($item->e_more);
    $link = JRoute::_('index.php?option=' . $this->option . '&task=' . $this->vName . '.edit&id=' . $item->id);
    if ($canEdit) {
        $goBackToVersion = '<a href="javascript:void(0);" onclick="Joomla.submitbutton(\'versions.revert\',\'cb' . $i . '\');">' . '<img class="img-action" src="components/' . CCK_COM . '/assets/images/24/icon-24-versions-revert.png" border="0" alt="" title="' . $title2 . '" /></a>';
    } else {
        $goBackToVersion = '-';
    }
    ?>
		<tr class="row<?php 
    echo $i % 2;
    ?>
" height="64px;">
			<td class="center hidden-phone"><?php 
    Helper_Display::quickSlideTo('pagination-bottom', $i + 1);
    ?>
</td>
<?php

/**
* @version 			SEBLOD 3.x Core ~ $Id: edit_template.php sebastienheraud $
* @package			SEBLOD (App Builder & CCK) // SEBLOD nano (Form Builder)
* @url				http://www.seblod.com
* @editor			Octopoos - www.octopoos.com
* @copyright		Copyright (C) 2013 SEBLOD. All Rights Reserved.
* @license 			GNU General Public License version 2 or later; see _LICENSE.php
**/
defined('_JEXEC') or die;
if (is_object($this->style)) {
    $this->style->params = JCckDev::fromJSON($this->style->params);
}
?>

<div class="<?php 
echo $this->css['wrapper'];
?>
">
	<div class="seblod">
        <div class="legend top left"><?php 
echo JText::_('COM_CCK_RENDERING') . '<span class="mini">(' . JText::_('COM_CCK_FOR_VIEW_' . $this->item->client) . ')</span>';
?>
</div>
        <ul class="adminformlist adminformlist-2cols">
            <?php 
echo JCckDev::renderForm($cck['core_template'], $this->style->template, $config);
echo '<input type="hidden" name="template2" value="' . $this->style->template . '" />';
$style_title = strlen($this->style->title) > 32 ? substr($this->style->title, 0, 32) . '...' : $this->style->title;
echo '<li><label>' . JText::_('COM_CCK_STYLE') . '</label><span class="variation_value adminformlist-maxwidth" title="' . $this->style->title . '">' . $style_title . '</span>' . '<input class="inputbox" type="hidden" id="template_' . $this->item->client . '" name="template_' . $this->item->client . '" value="' . $this->style->id . '" /></li>';
 public function onCCK_FieldPrepareStore(&$field, $value = '', &$config = array(), $inherit = array(), $return = false)
 {
     if (self::$type != $field->type) {
         return;
     }
     // Init
     if (count($inherit)) {
         $name = isset($inherit['name']) && $inherit['name'] != '' ? $inherit['name'] : $field->name;
         $xk = isset($inherit['xk']) ? $inherit['xk'] : -1;
         $value = isset($inherit['post']) ? $inherit['post'][$name . '_hidden'] : @$config['post'][$name . '_hidden'];
     } else {
         $name = $field->name;
         $xk = -1;
         $value = @$config['post'][$name . '_hidden'];
     }
     if (is_array($value)) {
         $value = trim($value[$xk]);
     }
     $options2 = JCckDev::fromJSON($field->options2);
     $options2['storage_format'] = isset($options2['storage_format']) ? $options2['storage_format'] : '0';
     $value = $options2['storage_format'] == '0' ? $value : strtotime($value);
     // Validate
     parent::g_onCCK_FieldPrepareStore_Validation($field, $name, $value, $config);
     // Set or Return
     if ($return === true) {
         return $value;
     }
     $field->value = $value;
     parent::g_onCCK_FieldPrepareStore($field, $name, $value, $config);
 }
 public static function getPluginOptions($folder, $prefix = '', $selectlabel = false, $selectnone = false, $language = false, $excluded = array(), $file = '')
 {
     $base = JPATH_SITE . '/plugins/' . $prefix . $folder;
     $options = array();
     $options2 = array();
     $lang = JFactory::getLanguage();
     if ($selectlabel !== false) {
         $selectlabel = is_string($selectlabel) ? $selectlabel : JText::_('COM_CCK_ALL_TYPES_SL');
         $options[] = JHtml::_('select.option', '', $selectlabel, 'value', 'text');
     }
     if ($selectnone !== false) {
         $options[] = JHtml::_('select.option', '', JText::_('COM_CCK_NONE'), 'value', 'text');
     }
     $where2 = '';
     if (count($excluded)) {
         $where2 = ' AND element NOT IN ("' . implode('","', $excluded) . '")';
     }
     $query = 'SELECT name AS text, element AS value, params' . ' FROM #__extensions' . ' WHERE folder = "' . $prefix . $folder . '" AND enabled = 1' . $where2 . ' ORDER BY text';
     $plugins = JCckDatabase::loadObjectList($query);
     foreach ($plugins as $plugin) {
         if (!is_file($base . '/' . $plugin->value . '/' . $plugin->value . '.php') || $file && !is_file($base . '/' . $plugin->value . '/' . $file)) {
             continue;
         }
         if ($language) {
             $lang->load('plg_' . $prefix . $folder . '_' . $plugin->value, JPATH_ADMINISTRATOR, null, false, true);
         }
         $plugin->text = JText::_('plg_' . $prefix . $folder . '_' . $plugin->value . '_LABEL');
         $params = JCckDev::fromJSON($plugin->params);
         $group = JText::_($params['group']);
         $groups[$group][$group . '_' . $plugin->text] = $plugin;
     }
     if (!isset($groups)) {
         return $options;
     }
     ksort($groups);
     foreach ($groups as $k => $v) {
         if ($k != 'CORE') {
             if ($k == '-') {
                 $options = array_merge($options, $v);
             } elseif (strpos($k, '#') !== false) {
                 if ($k == '#') {
                     $options2[] = JHtml::_('select.option', '<OPTGROUP>', $k . ' Core');
                     $options2 = array_merge($options2, $v);
                     $options2[] = JHtml::_('select.option', '</OPTGROUP>', '');
                 } else {
                     $options2[] = JHtml::_('select.option', '<OPTGROUP>', $k);
                     ksort($v);
                     $options2 = array_merge($options2, $v);
                     $options2[] = JHtml::_('select.option', '</OPTGROUP>', '');
                 }
             } else {
                 $options[] = JHtml::_('select.option', '<OPTGROUP>', $k);
                 ksort($v);
                 $options = array_merge($options, $v);
                 $options[] = JHtml::_('select.option', '</OPTGROUP>', '');
             }
         }
     }
     if (count($options2)) {
         $options = array_merge($options, $options2);
     }
     return $options;
 }
Exemple #15
0
 public function onCCK_FieldPrepareForm(&$field, $value = '', &$config = array(), $inherit = array(), $return = false)
 {
     if (self::$type != $field->type) {
         return;
     }
     self::$path = parent::g_getPath(self::$type . '/');
     parent::g_onCCK_FieldPrepareForm($field, $config);
     // Init
     if (count($inherit)) {
         $id = isset($inherit['id']) && $inherit['id'] != '' ? $inherit['id'] : $field->name;
         $name = isset($inherit['name']) && $inherit['name'] != '' ? $inherit['name'] : $field->name;
     } else {
         $id = $field->name;
         $name = $field->name;
     }
     $value = $value != '' ? $value : $field->defaultvalue;
     $value = $value != ' ' ? $value : '';
     $value = htmlspecialchars($value);
     // Preview Video
     $options2 = JCckDev::fromJSON($field->options2);
     $preview = isset($options2['video_preview']) ? $options2['video_preview'] : '0';
     $width = isset($options2['video_width']) ? $options2['video_width'] : '300';
     $height = isset($options2['video_height']) ? $options2['video_height'] : '300';
     $video = '';
     if ($preview == 1) {
         $v_int = preg_match('/\\?v=.*/i', $value, $v_value);
         if ($v_int > 0) {
             $v_tag = str_replace('?v=', '', $v_value[0]);
         } else {
             $v_tag = $value;
         }
         if (isset($v_tag) && $v_tag != '') {
             if ($field->bool2 == 0) {
                 $video .= '<iframe width="' . $width . '" height="' . $height . '" ';
                 $video .= 'frameborder="0" allowfullscreen src="';
                 $video .= 'http://www.youtube.com/embed/' . $v_tag;
                 $video .= '" ></iframe>';
             } else {
                 $video .= '<object width="' . $width . '" height="' . $height . '">';
                 $video .= '<param value="' . $value . '" name="movie"><param value="transparent" name="wmode">';
                 $video .= '<embed width="' . $width . '" height="' . $height . '" wmode="transparent" type="application/x-shockwave-flash" src="';
                 $video .= 'http://www.youtube.com/v/' . $v_tag;
                 $video .= '"></object>';
             }
             $video .= '<div class="clear"></div>';
         }
     }
     // Validate
     $validate = '';
     if ($config['doValidation'] > 1) {
         plgCCK_Field_ValidationRequired::onCCK_Field_ValidationPrepareForm($field, $id, $config);
         parent::g_onCCK_FieldPrepareForm_Validation($field, $id, $config, array('minSize' => true));
         $validate = count($field->validate) ? ' validate[' . implode(',', $field->validate) . ']' : '';
     }
     // Prepare
     $class = 'inputbox text' . $validate . ($field->css ? ' ' . $field->css : '');
     $maxlen = $field->maxlength > 0 ? ' maxlength="' . $field->maxlength . '"' : '';
     $attr = 'class="' . $class . '" size="' . $field->size . '"' . $maxlen . ($field->attributes ? ' ' . $field->attributes : '');
     $form = $video . '<input type="text" id="' . $id . '" name="' . $name . '" value="' . $value . '" ' . $attr . ' />';
     // Set
     if (!$field->variation) {
         $field->form = $form;
         if ($field->script) {
             parent::g_addScriptDeclaration($field->script);
         }
     } else {
         parent::g_getDisplayVariation($field, $field->variation, $value, $value, $form, $id, $name, '<input', '', '', $config);
     }
     $field->value = $value;
     // Return
     if ($return === true) {
         return $field;
     }
 }
Exemple #16
0
 public static function getValueFromOptions($field, $value, $config = array())
 {
     // Init
     $options2 = JCckDev::fromJSON($field->options2);
     $divider = '';
     $lang_code = '';
     $value2 = '';
     // Prepare
     self::_languageDetection($lang_code, $value2, $options2);
     if ($field->bool3) {
         $divider = $field->divider != '' ? $field->divider : ',';
     }
     $options_2 = self::_getOptionsList($options2, $field->bool2, $lang_code);
     $field->options = $field->options ? $field->options . '||' . $options_2 : $options_2;
     return parent::getValueFromOptions($field, $value, $config);
 }
Exemple #17
0
 public function onCCK_FieldPrepareStore(&$field, $value = '', &$config = array(), $inherit = array(), $return = false)
 {
     if (self::$type != $field->type) {
         return;
     }
     // Init
     $app = JFactory::getApplication();
     $options2 = JCckDev::fromJSON($field->options2);
     if (count($inherit)) {
         $name = isset($inherit['name']) && $inherit['name'] != '' ? $inherit['name'] : $field->name;
         $xk = isset($inherit['xk']) ? $inherit['xk'] : -1;
         $xi = isset($inherit['xi']) ? $inherit['xi'] : -1;
         $parent = isset($inherit['parent']) ? $inherit['parent'] : '';
         $array_x = isset($inherit['array_x']) ? $inherit['array_x'] : 0;
         $itemPath = isset($inherit['post']) ? $inherit['post'][$name . '_hidden'] : @$config['post'][$name . '_hidden'];
         $deleteBox = isset($inherit['post']) ? @$inherit['post'][$name . '_delete'] : @$config['post'][$name . '_delete'];
         $imageTitle = isset($inherit['post']) ? @$inherit['post'][$name . '_title'] : @$config['post'][$name . '_title'];
         $imageDesc = isset($inherit['post']) ? @$inherit['post'][$name . '_description'] : @$config['post'][$name . '_description'];
         $imageCustomDir = isset($inherit['post']) ? @$inherit['post'][$name . '_path'] : @$config['post'][$name . '_path'];
     } else {
         $name = $field->name;
         $xk = -1;
         $xi = -1;
         $parent = '';
         $array_x = 0;
         $itemPath = @$config['post'][$name . '_hidden'];
         $deleteBox = @$config['post'][$name . '_delete'];
         $imageTitle = @$config['post'][$name . '_title'];
         $imageDesc = @$config['post'][$name . '_description'];
         $imageCustomDir = @$config['post'][$name . '_path'];
     }
     // Prepare
     $legal_ext = isset($options2['media_extensions']) ? $options2['media_extensions'] : 'custom';
     if ($legal_ext == 'custom') {
         $legal_ext = $options2['legal_extensions'];
     } else {
         $legal_ext = JCck::getConfig_Param('media_' . $legal_ext . '_extensions');
         if (!$legal_ext) {
             $legal_ext = $options2['legal_extensions'];
         }
     }
     $legal_ext = explode(',', $legal_ext);
     $userfile = $array_x ? JRequest::getVar($parent, NULL, 'files', 'array') : JRequest::getVar($name, NULL, 'files', 'array');
     if (is_array($userfile['name'])) {
         if ($array_x) {
             $userfile_name = $userfile['name'][$xk][$name];
             $userfile_type = $userfile['type'][$xk][$name];
             $userfile_tmp_name = $userfile['tmp_name'][$xk][$name];
             $userfile_error = $userfile['error'][$xk][$name];
             $userfile_size = $userfile['size'][$xk][$name];
             $userfile = null;
             $userfile = array();
             $userfile['name'] = $userfile_name;
             $userfile['type'] = $userfile_type;
             $userfile['tmp_name'] = $userfile_tmp_name;
             $userfile['error'] = $userfile_error;
             $userfile['size'] = $userfile_size;
         } else {
             $userfile_name = $userfile['name'][$xk];
             $userfile_type = $userfile['type'][$xk];
             $userfile_tmp_name = $userfile['tmp_name'][$xk];
             $userfile_error = $userfile['error'][$xk];
             $userfile_size = $userfile['size'][$xk];
             $userfile = null;
             $userfile = array();
             $userfile['name'] = $userfile_name;
             $userfile['type'] = $userfile_type;
             $userfile['tmp_name'] = $userfile_tmp_name;
             $userfile['error'] = $userfile_error;
             $userfile['size'] = $userfile_size;
             if (is_array($itemPath)) {
                 $itemPath = trim($itemPath[$xk]);
             }
             if (is_array($imageTitle)) {
                 $imageTitle = trim($imageTitle[$xk]);
             }
             if (is_array($imageDesc)) {
                 $imageDesc = trim($imageDesc[$xk]);
             }
             if (is_array($imageCustomDir)) {
                 $imageCustomDir = trim($imageCustomDir[$xk]);
             }
             if (is_array($deleteBox)) {
                 $deleteBox = $deleteBox[$xk];
             }
         }
     }
     if ($deleteBox == 1) {
         $title = strrpos($itemPath, '/') ? substr($itemPath, strrpos($itemPath, '/') + 1) : $itemPath;
         if (self::_checkPath($config['pk'], $options2, $itemPath, $legal_ext)) {
             if ($itemPath != $field->defaultvalue) {
                 if ($options2['path_user']) {
                     $user_folder = substr($itemPath, 0, strrpos($itemPath, '/'));
                     if ($options2['path_content']) {
                         $user_folder = substr($user_folder, 0, strrpos($user_folder, '/'));
                     }
                     $user_folder = substr($user_folder, strrpos($user_folder, '/') + 1) . '/';
                 } else {
                     $user_folder = '';
                 }
                 $content_folder = $options2['path_content'] ? $config['pk'] . '/' : '';
                 for ($i = 1; $i < 11; $i++) {
                     if (JFile::exists(JPATH_SITE . '/' . $options2['path'] . $user_folder . $content_folder . '_thumb' . $i . '/' . $title)) {
                         JFile::delete(JPATH_SITE . '/' . $options2['path'] . $user_folder . $content_folder . '_thumb' . $i . '/' . $title);
                     }
                 }
                 if (JFile::exists(JPATH_SITE . '/' . $options2['path'] . $user_folder . $content_folder . $title)) {
                     JFile::delete(JPATH_SITE . '/' . $options2['path'] . $user_folder . $content_folder . $title);
                 }
             }
             $itemPath = '';
         }
     }
     $file_path = '';
     $process = false;
     switch (@$options2['size_unit']) {
         case '0':
             $unit_prod = 1;
             break;
         case '1':
             $unit_prod = 1000;
             break;
         case '2':
             $unit_prod = 1000000;
             break;
         default:
             $unit_prod = 1;
             break;
     }
     $maxsize = floatval($options2['max_size']) * $unit_prod;
     $filename = JFile::stripExt($userfile['name']);
     $userfile['name'] = str_replace($filename, JCckDev::toSafeSTRING($filename, JCck::getConfig_Param('media_characters', '-'), JCck::getConfig_Param('media_case', 0)), $userfile['name']);
     if (!$maxsize || $maxsize && $userfile['size'] < $maxsize) {
         if ($userfile && $userfile['name'] && $userfile['tmp_name']) {
             $ImageCustomName = $userfile['name'];
             $ImageCustomPath = '';
             if (@$options2['custom_path']) {
                 if (strrpos($imageCustomDir, '.') === false) {
                     $ImageCustomPath = $imageCustomDir == '' ? substr($itemPath, 0, strrpos($itemPath, '/') + 1) : ($imageCustomDir[strlen($imageCustomDir) - 1] == '/' ? $imageCustomDir : $imageCustomDir . '/');
                 } else {
                     $ImageCustomPath = substr($itemPath, 0, strrpos($itemPath, '/') + 1);
                 }
             }
             if (count($legal_ext)) {
                 $old_legal = strrpos($userfile['name'], '.') ? substr($userfile['name'], strrpos($userfile['name'], '.') + 1) : '';
                 $legal = $ImageCustomName == $userfile['name'] ? $old_legal : substr($ImageCustomName, strrpos($ImageCustomName, '.') + 1);
                 if ($old_legal && array_search($old_legal, $legal_ext) === false) {
                     JFactory::getApplication()->enqueueMessage($ImageCustomName . ' - ' . JText::_('COM_CCK_ERROR_LEGAL_EXTENSIONS'), 'notice');
                     $field->error = true;
                 } else {
                     if (trim($legal) != trim($old_legal)) {
                         $ImageCustomName .= '.' . trim($old_legal);
                     }
                 }
             }
             $file_path = $ImageCustomPath ? $ImageCustomPath : $options2['path'];
             $current_user = JFactory::getUser();
             $current_user_id = $current_user->id;
             if (strpos($file_path, '/' . $current_user_id . '/') === false) {
                 $file_path .= $options2['path_user'] && $current_user_id ? $current_user_id . '/' : '';
             }
             if (strpos($file_path, '/' . $config['pk'] . '/') === false) {
                 $file_path .= $options2['path_content'] && $config['pk'] > 0 ? $config['pk'] . '/' : '';
             }
             $value = $file_path . $ImageCustomName;
             $process = true;
         } else {
             if ($deleteBox == 1) {
                 $imageTitle = '';
                 $imageDesc = '';
             }
             if ($imageCustomDir != '' && strrpos($imageCustomDir, '.') > 0 && JFile::exists(JPATH_SITE . '/' . $imageCustomDir)) {
                 if (count($legal_ext)) {
                     $legal = strrpos($imageCustomDir, '.') ? substr($imageCustomDir, strrpos($imageCustomDir, '.') + 1) : '';
                     if ($legal && array_search($legal, $legal_ext) === false) {
                         JFactory::getApplication()->enqueueMessage($imageCustomDir . ' - ' . JText::_('COM_CCK_ERROR_LEGAL_EXTENSIONS'), 'notice');
                         $field->error = true;
                     }
                 }
                 $value = $imageCustomDir;
             } else {
                 if ($userfile['name']) {
                     JFactory::getApplication()->enqueueMessage(JText::_('COM_CCK_ERROR_INVALID_FILE'), "error");
                     $field->error = true;
                 }
                 if ($options2['path'] == $itemPath) {
                     $value = '';
                 } else {
                     if ($xk != -1 && !$array_x) {
                         $value = $itemPath == $options2['path'] ? '' : $itemPath;
                     } else {
                         $value = $itemPath;
                     }
                 }
             }
         }
     } else {
         JFactory::getApplication()->enqueueMessage($userfile['name'] . ' - ' . JText::_('COM_CCK_ERROR_MAX_SIZE'), 'notice');
         $field->error = true;
     }
     // Validate
     parent::g_onCCK_FieldPrepareStore_Validation($field, $name, $value, $config);
     if (isset($field->error) && $field->error === true) {
         return;
     }
     $imageTitle = $imageTitle ? addcslashes($imageTitle, '"') : '';
     $imageDesc = $imageDesc ? addcslashes($imageDesc, '"') : '';
     // Add Process
     if ($process === true) {
         $content_folder = $options2['path_content'] ? $options2['path_content'] : 0;
         $process_params = array('field_name' => $name, 'true_name' => $field->name, 'array_x' => $array_x, 'parent_name' => $parent, 'field_type' => $field->type, 'file_path' => $file_path, 'file_name' => $ImageCustomName, 'tmp_name' => $userfile['tmp_name'], 'xi' => $xi, 'content_folder' => $content_folder, 'options2' => $options2, 'storage' => $field->storage, 'storage_field' => $field->storage_field, 'storage_field2' => $field->storage_field2 ? $field->storage_field2 : $field->name, 'storage_table' => $field->storage_table, 'file_title' => $imageTitle, 'file_descr' => $imageDesc);
         parent::g_addProcess('afterStore', self::$type, $config, $process_params);
     }
     $value = !$options2['multivalue_mode'] || $imageTitle == '' && $imageDesc == '' ? $value : '{"image_location":"' . $value . '","image_title":"' . $imageTitle . '","image_description":"' . $imageDesc . '"}';
     if ($return === true) {
         return $value;
     }
     $field->value = $value;
     parent::g_onCCK_FieldPrepareStore($field, $name, $value, $config);
 }
Exemple #18
0
        }
        $dispatcher->trigger('onCCK_FieldPrepareStore', array(&$field, $value, &$config));
        if (!$id && $field->live && ($field->variation == 'hidden' || $field->variation == 'hidden_auto' || $field->variation == 'disabled' || $field->variation == 'value')) {
            if (!in_array($field->name, $config['options']['data_integrity_excluded'])) {
                $hash = JApplication::getHash($value);
                $hashed = $session->get('cck_hash_live_' . $field->name);
                $session->clear('cck_hash_live_' . $field->name);
                if ($hash != $hashed) {
                    $config['validate'] = 'error';
                    $integrity[] = $field->name;
                }
            }
        }
        if ($field->storages != '') {
            // More storages
            $storages = JCckDev::fromJSON($field->storages, 'object');
        }
    }
}
// Merge
if (count($config['fields'])) {
    $fields = array_merge($fields, $config['fields']);
    // Test: a loop may be faster.
    $config['fields'] = NULL;
    unset($config['fields']);
}
// Stage (..and the next stage is..)
if ($stages > 1 && $stage) {
    if (!$config['validate']) {
        $stage++;
    }
Exemple #19
0
 public static function getTemplateStyle($vName, $selected, $default = '', $null = '')
 {
     $style = null;
     if ($selected != $null) {
         $style = JCckDatabase::loadObject('SELECT id, title, template, params FROM #__template_styles WHERE id=' . (int) $selected);
     }
     if (!$style) {
         $style = JCckDatabase::loadObject('SELECT id, title, template, params FROM #__template_styles WHERE template="' . (string) $default . '" ORDER BY id');
     }
     if (!$style) {
         return $style;
     }
     $lang = JFactory::getLanguage();
     $values = JCckDev::fromJSON($style->params);
     $style->xml = JPath::clean(JPATH_SITE . '/templates/' . $style->template . '/templateDetails.xml');
     $lang->load('tpl_' . $style->template . '.sys', JPATH_SITE, null, false, true);
     $lang->load('tpl_' . $style->template, JPATH_SITE, null, false, true);
     $style->positions = array();
     if (file_exists($style->xml)) {
         $xml = simplexml_load_file($style->xml);
         if (isset($xml->positions[0])) {
             foreach ($xml->positions[0] as $position) {
                 $toggle = true;
                 if (isset($position->attributes()->toggle) && (string) $position->attributes()->toggle) {
                     $idx = (string) $position->attributes()->toggle;
                     $val = isset($values[$idx]) ? $values[$idx] : 0;
                     if (isset($position->attributes()->toggle_value)) {
                         $value = (string) $position->attributes()->toggle_value;
                         if (strpos($value, ',') !== false) {
                             $values = explode(',', $value);
                             if (count($values)) {
                                 $toggle2 = false;
                                 foreach ($values as $v) {
                                     if ($val == $v) {
                                         $toggle2 = true;
                                     }
                                 }
                                 if (!$toggle2) {
                                     $toggle = false;
                                 }
                             }
                         } else {
                             if ($val != $value) {
                                 $toggle = false;
                             }
                         }
                     } else {
                         if (!$val) {
                             $toggle = false;
                         }
                     }
                 }
                 if ($toggle) {
                     $pos = (string) $position;
                     $key = 'TPL_' . $style->template . '_POSITION_' . $pos;
                     $label = $lang->hasKey($key) ? JText::_('TPL_' . $style->template . '_POSITION_' . $pos) : $pos;
                     $style->positions[] = JHtml::_('select.option', $pos, $label);
                 }
             }
         }
     }
     return $style;
 }
Exemple #20
0
 protected function _initValues($value)
 {
     $values = JCckDev::fromJSON($value);
     return $values;
 }
 protected function _core($data, &$config = array(), $pk = 0, $params = array())
 {
     $app = JFactory::getApplication();
     $parameters = JComponentHelper::getParams('com_users');
     $data['params'] = isset($data['params']) ? JCckDev::fromJSON($data['params']) : array();
     //Fix
     if (!$config['id']) {
         $config['id'] = parent::g_onCCK_Storage_LocationPrepareStore();
     }
     if ($app->isSite()) {
         // Site
         // Init
         $table = self::_getTable_fromSite($pk);
         $isNew = $pk > 0 ? false : true;
         self::_initTable_fromSite($table, $data, $config);
         if ($isNew) {
             $activation = $parameters->get('useractivation');
             if ($activation == 1 || $activation == 2) {
                 $data['activation'] = JApplication::getHash(JUserHelper::genRandomPassword());
                 $data['block'] = 1;
                 $config['registration_activation'] = $data['activation'];
             }
         }
         // Prepare
         $table->bind($data);
         JPluginHelper::importPlugin('user');
         self::_completeTable_fromSite($table, $data, $config, $parameters);
         // Store
         if (!$table->save()) {
             $app->enqueueMessage(JText::sprintf('COM_CCK_REGISTRATION_SAVE_FAILED', $table->getError()), 'error');
             $config['error'] = true;
             return;
         }
         if ($isNew) {
             self::_sendMails($table, $activation, $params['auto_email'], $parameters->get('mail_to_admin'), $parameters->get('sendpassword', 1));
         }
         self::$pk = $table->{self::$key};
         if (!$config['pk']) {
             $config['pk'] = self::$pk;
         }
     } else {
         // Admin
         // Init
         $table = self::_getTable($pk);
         $isNew = $pk > 0 ? false : true;
         self::_initTable($table, $data, $config);
         // Check Error
         if (self::$error === true) {
             return false;
         }
         // Prepare
         if (is_array($data)) {
             $table->bind($data);
         }
         self::_completeTable($table, $data, $config, $parameters);
         // Store
         $table->save();
         self::$pk = $table->{self::$key};
         if (!$config['pk']) {
             $config['pk'] = self::$pk;
         }
     }
     $config['author'] = $table->id;
     parent::g_onCCK_Storage_LocationStore($data, self::$table, self::$pk, $config, $params);
 }
Exemple #22
0
<?php

/**
* @version 			SEBLOD 3.x Core ~ $Id: edit_configuration.php sebastienheraud $
* @package			SEBLOD (App Builder & CCK) // SEBLOD nano (Form Builder)
* @url				http://www.seblod.com
* @editor			Octopoos - www.octopoos.com
* @copyright		Copyright (C) 2009 - 2016 SEBLOD. All Rights Reserved.
* @license 			GNU General Public License version 2 or later; see _LICENSE.php
**/
defined('_JEXEC') or die;
$P = 'options_' . $this->item->client;
$options = JCckDev::fromJSON($this->item->{$P});
?>

<div class="<?php 
echo $this->css['wrapper'];
?>
">
	<?php 
if ($this->item->master == 'content') {
    ?>
	<div class="seblod">
        <div class="legend top left"><?php 
    echo JText::_('COM_CCK_CONFIG') . '<span class="mini">(' . JText::_('COM_CCK_FOR_VIEW_' . $this->item->client) . ')</span>';
    ?>
</div>
        <ul class="adminformlist adminformlist-2cols">
            <?php 
    echo JCckDev::renderForm($cck['core_title'], @$options['title'], $config);
    echo JCckDev::renderForm($cck['core_typo'], @$options['typo'], $config);
Exemple #23
0
 public function onCCK_FieldPrepareContent(&$field, $value = '', &$config = array())
 {
     if (self::$type != $field->type) {
         return;
     }
     parent::g_onCCK_FieldPrepareContent($field, $config);
     $app = JFactory::getApplication();
     $user = JFactory::getUser();
     $access = implode(',', $user->getAuthorisedViewLevels());
     $text = '';
     if ($field->extended && $field->extended != @$config['type']) {
         $options2 = JCckDev::fromJSON($field->options2);
         $name = $field->storage_field2 ? $field->storage_field2 : $field->storage_field;
         $value = array();
         if (@$options2['child_language']) {
             $language = $options2['child_language'] == '-1' ? JFactory::getLanguage()->getTag() : $options2['child_language'];
             $language = ' AND a.language = "' . $language . '"';
         } else {
             $language = '';
         }
         $location = @$options2['child_location'] ? $options2['child_location'] : 'joomla_article';
         $order = @$options2['child_orderby'] ? ' ORDER BY a.' . $options2['child_orderby'] . ' ' . $options2['child_orderby_direction'] : ' ORDER BY a.title ASC';
         $limit = @$options2['child_limit'] ? ' LIMIT ' . $options2['child_limit'] : '';
         switch ($field->bool2) {
             case 2:
                 $properties = array('table', 'access', 'custom', 'status');
                 $properties = JCck::callFunc('plgCCK_Storage_Location' . $location, 'getStaticProperties', $properties);
                 $and = $properties['status'] ? ' AND a.' . $properties['status'] . ' = 1' : '';
                 $and .= $properties['access'] ? ' AND a.' . $properties['access'] . ' IN (' . $access . ')' : '';
                 $items = JCckDatabase::loadObjectList('SELECT a.id as pk, a.' . $properties['custom'] . ' FROM ' . $properties['table'] . ' AS a LEFT JOIN #__cck_store_join_' . $name . ' AS b on b.id = a.id' . ' WHERE b.id2 = ' . (int) $config['pk'] . $and . $language . $order . $limit);
                 if (count($items)) {
                     foreach ($items as $item) {
                         $text .= JHtml::_('content.prepare', $item->{$properties}['custom']);
                         $value[] = $item->pk;
                     }
                 }
                 break;
             case 1:
                 $properties = array('table', 'access', 'status');
                 $properties = JCck::callFunc('plgCCK_Storage_Location' . $location, 'getStaticProperties', $properties);
                 $and = $properties['status'] ? ' AND a.' . $properties['status'] . ' = 1' : '';
                 $and .= $properties['access'] ? ' AND a.' . $properties['access'] . ' IN (' . $access . ')' : '';
                 $items = JCckDatabase::loadObjectList('SELECT a.id as pk, a.title FROM ' . $properties['table'] . ' AS a LEFT JOIN #__cck_store_join_' . $name . ' AS b ON b.id = a.id' . ' WHERE b.id2 = ' . (int) $config['pk'] . $and . $language . $order . $limit);
                 if (count($items)) {
                     foreach ($items as $item) {
                         $text .= ', ' . $item->title;
                         $value[] = $item->pk;
                     }
                 }
                 if ($text) {
                     $text = substr($text, 2);
                 }
                 break;
             default:
                 $options2 = new JRegistry();
                 $options2->loadString($field->options2);
                 $options3_json = $options2->get('child_link_options');
                 $options3 = new JRegistry();
                 $options3->loadString($options3_json);
                 // todo >> href
                 $properties = array('table', 'access', 'status', 'to_route');
                 $properties = JCck::callFunc('plgCCK_Storage_Location' . $location, 'getStaticProperties', $properties);
                 $and = $properties['status'] ? ' AND a.' . $properties['status'] . ' = 1' : '';
                 $and .= $properties['access'] ? ' AND a.' . $properties['access'] . ' IN (' . $access . ')' : '';
                 $items = JCckDatabase::loadObjectList('SELECT ' . $properties['to_route'] . ' FROM ' . $properties['table'] . ' AS a LEFT JOIN #__cck_store_join_' . $name . ' AS b ON b.id = a.id' . ' WHERE b.id2 = ' . (int) $config['pk'] . $and . $language . $order . $limit);
                 if (count($items)) {
                     $sef = JFactory::getConfig()->get('sef') ? $options3->get('sef', 2) : 0;
                     JCck::callFunc_Array('plgCCK_Storage_Location' . $location, 'setRoutes', array(&$items, $sef, $options3->get('itemid', $app->input->getInt('Itemid', 0))));
                     foreach ($items as $item) {
                         $text .= ', ' . '<a href="' . $item->link . '">' . $item->title . '</a>';
                         $value[] = $item->pk;
                     }
                     if ($text) {
                         $text = substr($text, 2);
                     }
                 }
                 break;
         }
         $field->divider = ',';
         $value = implode($field->divider, $value);
     } else {
         if ($value) {
             switch ($field->bool) {
                 case 2:
                     $text = JCckDatabase::loadResult('SELECT a.introtext FROM ' . self::$table . ' AS a WHERE a.id = ' . (int) $value . ' AND a.state = 1 AND a.access IN (' . $access . ')');
                     $text = JHtml::_('content.prepare', $text);
                     break;
                 case 1:
                     $text = JCckDatabase::loadResult('SELECT a.title FROM ' . self::$table . ' AS a WHERE a.id = ' . (int) $value . ' AND a.state = 1 AND a.access IN (' . $access . ')');
                     break;
                 default:
                     require_once JPATH_SITE . '/plugins/cck_storage_location/' . self::$type . '/' . self::$type . '.php';
                     $item = JCckDatabase::loadObject('SELECT a.id, a.title, a.alias, a.catid, a.language FROM ' . self::$table . ' AS a WHERE a.id = ' . (int) $value . ' AND a.state = 1 AND a.access IN (' . $access . ')');
                     if (is_object($item)) {
                         $options2 = new JRegistry();
                         $options2->loadString($field->options2);
                         $options3_json = $options2->get('parent_link_options');
                         $options3 = new JRegistry();
                         $options3->loadString($options3_json);
                         $field2 = (object) array('link' => 'content', 'link_options' => $options3_json, 'id' => $field->name, 'name' => $field->name, 'text' => htmlspecialchars($item->title), 'value' => '');
                         JCckPluginLink::g_setLink($field2, $config);
                         $field2->link = plgCCK_Storage_LocationJoomla_Article::getRoute($item, $options3->get('sef', 2), $options3->get('itemid', $app->input->getInt('Itemid', 0)));
                         JCckPluginLink::g_setHtml($field2, 'text');
                         $text = $field2->html;
                         $field->link = $field2->link;
                         $field->html = $field2->html;
                     }
                     break;
             }
         }
     }
     $field->value = $value;
     $field->text = $text;
     $field->typo_target = 'text';
 }
Exemple #24
0
 public function onCCK_FieldPrepareForm(&$field, $value = '', &$config = array(), $inherit = array(), $return = false)
 {
     if (self::$type != $field->type) {
         return;
     }
     self::$path = parent::g_getPath(self::$type . '/');
     parent::g_onCCK_FieldPrepareForm($field, $config);
     // Init
     if (count($inherit)) {
         $id = isset($inherit['id']) && $inherit['id'] != '' ? $inherit['id'] : $field->name;
         $name = isset($inherit['name']) && $inherit['name'] != '' ? $inherit['name'] : $field->name;
     } else {
         $id = $field->name;
         $name = $field->name;
     }
     $value = $value != '' ? $value : $field->defaultvalue;
     $value = $value != ' ' ? $value : '';
     $value = JCckDev::fromJSON($value);
     $value['text'] = htmlspecialchars(@$value['text'], ENT_QUOTES);
     $preview = '';
     // Validate
     $validate = '';
     if ($config['doValidation'] > 1) {
         plgCCK_Field_ValidationRequired::onCCK_Field_ValidationPrepareForm($field, $id, $config);
         parent::g_onCCK_FieldPrepareForm_Validation($field, $id, $config, array('minSize' => true));
         $validate = count($field->validate) ? ' validate[' . implode(',', $field->validate) . ']' : '';
     }
     // Prepare
     $class = 'inputbox text' . $validate . ($field->css ? ' ' . $field->css : '');
     $class2 = 'inputbox text';
     $maxlen = $field->maxlength > 0 ? ' maxlength="' . $field->maxlength . '"' : '';
     $attr = 'class="' . $class . '" size="' . $field->size . '"' . $maxlen . ($field->attributes ? ' ' . $field->attributes : '');
     $attr2 = 'class="' . $class2 . '" size="' . $field->size . '"' . $maxlen;
     $options2 = JCckDev::fromJSON($field->options2);
     if ($config['doTranslation']) {
         $link_label = trim(@$options2['link_label']) ? JText::_('COM_CCK_' . str_replace(' ', '_', trim(@$options2['link_label']))) : '';
         $text_label = trim(@$options2['text_label']) ? JText::_('COM_CCK_' . str_replace(' ', '_', trim(@$options2['text_label']))) : '';
     } else {
         $link_label = @$options2['link_label'] != '' ? trim($options2['link_label']) : '';
         $text_label = @$options2['text_label'] != '' ? $options2['text_label'] : '';
     }
     if (strpos($name, '[]') !== false) {
         //FieldX
         $nameH = substr($name, 0, -2);
         $nameLink = $name;
         $nameText = $nameH . '_text[]';
         $nameClass = $nameH . '_class[]';
         $nameTarget = $nameH . '_target[]';
     } elseif ($name[strlen($name) - 1] == ']') {
         //GroupX
         $nameH = substr($name, 0, -1);
         $nameLink = $name;
         $nameText = $nameH . '_text]';
         $nameClass = $nameH . '_class]';
         $nameTarget = $nameH . '_target]';
     } else {
         //Default
         $nameH = $name;
         $nameLink = $name;
         $nameText = $nameH . '_text';
         $nameClass = $nameH . '_class';
         $nameTarget = $nameH . '_target';
     }
     $form = self::_addInput($id, $nameLink, $attr, $link_label, @$value['link'], 'link');
     if ($field->bool2 == 1) {
         $form .= self::_addInput($id . '_text', $nameText, $attr2, $text_label, @$value['text'], 'text');
     }
     if ($field->bool3 == 1) {
         $form .= self::_addInput($id . '_class', $nameClass, $attr2, JText::_('COM_CCK_CLASS'), @$value['class'], 'class');
     }
     if ($field->bool4 == 1) {
         $form .= self::_addSelect($id . '_target', JText::_('COM_CCK_TARGET'), 'target', 'core_options_target', @$value['target'], array('storage_field' => $nameTarget));
     }
     if ($field->bool5 == 1 && $config['pk'] && @$value['link'] != '') {
         $p_link = @$value['link'];
         $p_text = @$value['text'] ? @$value['text'] : $p_link;
         $p_link = strpos($p_link, 'index.php') === 0 ? $p_link : (strpos($p_link, 'http://') === false && strpos($p_link, 'https://') === false ? 'http://' . $p_link : $p_link);
         $preview = '<a href="' . $p_link . '" class="cck_preview" target="_blank">' . $p_text . '</a>';
         $preview = self::_addPreview($id . '_preview', JText::_('COM_CCK_PREVIEW'), $preview, 'preview');
     }
     // Set
     if (!$field->variation) {
         $field->form = $form . $preview;
         if ($field->script) {
             parent::g_addScriptDeclaration($field->script);
         }
     } else {
         parent::g_getDisplayVariation($field, $field->variation, $value, $value, $form, $id, $name, '<input', '', '', $config);
     }
     $field->value = $value;
     // Return
     if ($return === true) {
         return $field;
     }
 }
Exemple #25
0
 public function onCCK_FieldPrepareForm(&$field, $value = '', &$config = array(), $inherit = array(), $return = false)
 {
     if (self::$type != $field->type) {
         return;
     }
     self::$path = parent::g_getPath(self::$type . '/');
     parent::g_onCCK_FieldPrepareForm($field, $config);
     // Init
     if (count($inherit)) {
         $id = isset($inherit['id']) && $inherit['id'] != '' ? $inherit['id'] : $field->name;
         $name = isset($inherit['name']) && $inherit['name'] != '' ? $inherit['name'] : $field->name;
         $inherited = true;
     } else {
         $id = $field->name;
         $name = $field->name;
         $inherited = false;
     }
     $value = $value != '' ? htmlspecialchars($value, ENT_COMPAT, 'UTF-8') : @$field->defaultvalue;
     $value = $value != ' ' ? $value : '';
     // Validate
     $validate = '';
     if ($config['doValidation'] > 1) {
         plgCCK_Field_ValidationRequired::onCCK_Field_ValidationPrepareForm($field, $id, $config);
         $validate = count($field->validate) ? ' validate[' . implode(',', $field->validate) . ']' : '';
     }
     // Prepare
     $app = JFactory::getApplication();
     $options2 = JCckDev::fromJSON($field->options2);
     $user = JFactory::getUser();
     if ($config['pk'] && @$options2['import'] && $field->storage_location) {
         if (!JCckDatabase::loadResult('SELECT pk FROM #__cck_core WHERE pk=' . (int) $config['pk'] . ' AND storage_location="' . (string) $field->storage_location . '"')) {
             $properties = array('custom', 'table');
             $properties = JCck::callFunc('plgCCK_Storage_Location' . $field->storage_location, 'getStaticProperties', $properties);
             $custom = $options2['import'] == 2 ? 'fulltext' : $properties['custom'];
             $value = $config['storages'][$properties['table']]->{$custom};
         }
     }
     if (!$user->id && $this->params->get('guest_access', 0) == 0) {
         $form = '';
     } else {
         $width = @$options2['width'] ? str_replace('px', '', $options2['width']) : '100%';
         $height = @$options2['height'] ? str_replace('px', '', $options2['height']) : '280';
         $asset = $config['asset_id'] > 0 ? $config['asset_id'] : $config['asset'];
         if ($app->input->get('option') == 'com_cck' && $app->input->get('view') == 'form' && $config['client'] == '') {
             $field->bool = 1;
         }
         if ($field->bool) {
             // Default
             $buttons = array('pagebreak', 'readmore');
             $editor = JFactory::getEditor(@$options2['editor'] ? $options2['editor'] : null);
             $form = '<div>' . $editor->display($name, $value, $width, $height, '60', '20', $buttons, $id, $asset) . '</div>';
         } else {
             // Modal Box
             if (trim($field->selectlabel)) {
                 if ($config['doTranslation']) {
                     $field->selectlabel = JText::_('COM_CCK_' . str_replace(' ', '_', trim($field->selectlabel)));
                 }
                 $buttonlabel = $field->selectlabel;
             } else {
                 $buttonlabel = JText::_('COM_CCK_EDITOR');
             }
             $e_type = @$options2['editor'] != '' ? '&type=' . $options2['editor'] : '';
             $link = 'index.php?option=com_cck&task=box.add&tmpl=component&file=plugins/cck_field/' . self::$type . '/tmpl/form.php' . '&id=' . $id . '&name=' . $name . $e_type . '&params=' . urlencode(urlencode($width)) . '||' . $height . '||' . $asset;
             $app = JFactory::getApplication();
             $class = 'wysiwyg_editor_box variation_href';
             $component = $app->input->get('option');
             if ($component == 'com_cck' && $app->input->get('view') != 'form' || $component == 'com_cck_ecommerce' || $component == 'com_cck_toolbox' || $component == 'com_cck_webservices') {
                 // todo: remove later
                 $class .= ' btn';
             }
             $class = 'class="' . $class . '" ';
             $attr = $class;
             $form = '<textarea style="display: none;" id="' . $id . '" name="' . $name . '">' . $value . '</textarea>';
             $form .= '<a href="' . $link . '" ' . $attr . '>' . $buttonlabel . '</a>';
             $field->markup_class .= ' cck_form_wysiwyg_editor_box';
         }
     }
     // Set
     if (!$field->variation) {
         $field->form = $form;
         self::_addScripts($field->bool, array('height' => @$height, 'inherited' => $inherited), $config);
     } else {
         $hidden = '<textarea class="inputbox" style="display: none;" id="' . $id . '" name="' . $name . '" />' . $value . '</textarea>';
         parent::g_getDisplayVariation($field, $field->variation, $value, $value, $form, $id, $name, '<textarea', $hidden, '', $config);
     }
     $field->value = $value;
     // Return
     if ($return === true) {
         return $field;
     }
 }
Exemple #26
0
<?php

/**
* @version 			SEBLOD 3.x Core
* @package			SEBLOD (App Builder & CCK) // SEBLOD nano (Form Builder)
* @url				http://www.seblod.com
* @editor			Octopoos - www.octopoos.com
* @copyright		Copyright (C) 2013 SEBLOD. All Rights Reserved.
* @license 			GNU General Public License version 2 or later; see _LICENSE.php
**/
defined('_JEXEC') or die;
$options2 = JCckDev::fromJSON($this->item->options2);
?>

<div class="seblod">
    <?php 
echo JCckDev::renderLegend(JText::_('COM_CCK_CONSTRUCTION'), JText::_('PLG_CCK_FIELD_' . $this->item->type . '_DESC'));
?>
    <ul class="adminformlist adminformlist-2cols">
        <?php 
echo JCckDev::renderForm('core_label', $this->item->label, $config);
echo JCckDev::renderForm('core_defaultvalue', $this->item->defaultvalue, $config);
echo JCckDev::renderForm('core_dev_text', @$options2['extension'], $config, array('label' => 'Extension', 'storage_field' => 'json[options2][extension]'));
echo JCckDev::renderForm('core_dev_text', @$options2['view'], $config, array('label' => 'View', 'storage_field' => 'json[options2][view]'));
echo JCckDev::renderSpacer(JText::_('COM_CCK_STORAGE'), JText::_('COM_CCK_STORAGE_DESC'));
echo JCckDev::getForm('core_storage', $this->item->storage, $config);
?>
    </ul>
</div>
Exemple #27
0
    public function onCCK_FieldPrepareForm(&$field, $value = '', &$config = array(), $inherit = array(), $return = false)
    {
        if (self::$type != $field->type) {
            return;
        }
        self::$path = parent::g_getPath(self::$type . '/');
        parent::g_onCCK_FieldPrepareForm($field, $config);
        if (is_file(JPATH_LIBRARIES . '/joomla/html/html/category.php')) {
            require_once JPATH_LIBRARIES . '/joomla/html/html/category.php';
        }
        // Init
        if (count($inherit)) {
            $id = isset($inherit['id']) && $inherit['id'] != '' ? $inherit['id'] : $field->name;
            $name = isset($inherit['name']) && $inherit['name'] != '' ? $inherit['name'] : $field->name;
        } else {
            $id = $field->name;
            $name = $field->name;
        }
        $app = JFactory::getApplication();
        $value = $value != '' ? $value : $field->defaultvalue;
        $value = $value != ' ' ? $value : '';
        // Validate
        $validate = '';
        if ($config['doValidation'] > 1) {
            plgCCK_Field_ValidationRequired::onCCK_Field_ValidationPrepareForm($field, $id, $config);
            $validate = count($field->validate) ? ' validate[' . implode(',', $field->validate) . ']' : '';
        }
        // Prepare
        if (parent::g_isStaticVariation($field, $field->variation, true)) {
            $form = '';
            $field->text = '';
            parent::g_getDisplayVariation($field, $field->variation, $value, $field->text, $form, $id, $name, '<select', '', '', $config);
        } elseif ($field->variation == 'value') {
            $form = '';
            $field->text = JCckDatabase::loadResult('SELECT title FROM #__categories WHERE id = ' . (int) $value);
            parent::g_getDisplayVariation($field, $field->variation, $value, $field->text, $form, $id, $name, '<select', '', '', $config);
        } else {
            $opt = '';
            $options2 = JCckDev::fromJSON($field->options2);
            if (trim($field->selectlabel)) {
                if ($config['doTranslation']) {
                    $field->selectlabel = JText::_('COM_CCK_' . str_replace(' ', '_', trim($field->selectlabel)));
                }
                $opt = '<option value="' . ($field->storage_field == 'parent_id' ? 1 : '') . '">' . '- ' . $field->selectlabel . ' -' . '</option>';
            }
            if ($config['client'] == 'search') {
                $opt .= '<option value="">' . '- ' . JText::_('COM_CCK_ALL_CATEGORIES') . ' -' . '</option>';
            }
            $multiple = $field->bool3 == 1 ? 'multiple="multiple"' : '';
            $size = $field->rows ? $field->rows : 1;
            $extension = $app->input->getString('extension', @$options2['extension']);
            $extension = $extension ? $extension : 'com_content';
            $class = 'inputbox select' . $validate . ($field->css ? ' ' . $field->css : '');
            $xml = '
						<form>
							<field
								type="' . self::$type2 . '"
								name="' . $name . '"
								id="' . $id . '"
								label="' . htmlspecialchars($field->label) . '"
								extension="' . $extension . '"
								' . $multiple . '
								class="' . $class . '"
								size="' . $size . '"
							>' . $opt . '</field>
						</form>
					';
            $form = JForm::getInstance($id, $xml);
            if ($config['client'] == 'admin' || $config['client'] == 'site' || $config['client'] == 'search') {
                if ($config['pk']) {
                    $form->setFieldAttribute($name, 'action', 'core.edit');
                    $form->setFieldAttribute($name, 'action', 'core.edit.own');
                } else {
                    $form->setFieldAttribute($name, 'action', 'core.create');
                }
            }
            $form = $form->getInput($name, '', $value);
            if ($field->attributes) {
                $form = str_replace('<select', '<select ' . $field->attributes, $form);
            }
            // Set
            if (!$field->variation) {
                $field->form = $form;
                if ($field->script) {
                    parent::g_addScriptDeclaration($field->script);
                }
            } else {
                $field->text = JCckDatabase::loadResult('SELECT title FROM #__categories WHERE id = ' . (int) $value);
                parent::g_getDisplayVariation($field, $field->variation, $value, $field->text, $form, $id, $name, '<select', '', '', $config);
            }
        }
        $field->value = $value;
        // Return
        if ($return === true) {
            return $field;
        }
    }
    public function onCCK_FieldPrepareForm(&$field, $value = '', &$config = array(), $inherit = array(), $return = false)
    {
        if (self::$type != $field->type) {
            return;
        }
        self::$path = parent::g_getPath(self::$type . '/');
        parent::g_onCCK_FieldPrepareForm($field, $config);
        // Init
        if (count($inherit)) {
            $id = isset($inherit['id']) && $inherit['id'] != '' ? $inherit['id'] : $field->name;
            $name = isset($inherit['name']) && $inherit['name'] != '' ? $inherit['name'] : $field->name;
        } else {
            $id = $field->name;
            $name = $field->name;
        }
        $value = $value != '' ? $value : $field->defaultvalue;
        $value = $value != ' ' ? $value : '';
        // Validate
        $validate = '';
        if ($config['doValidation'] > 1) {
            plgCCK_Field_ValidationRequired::onCCK_Field_ValidationPrepareForm($field, $id, $config);
            $validate = count($field->validate) ? ' validate[' . implode(',', $field->validate) . ']' : '';
        }
        $options2 = JCckDev::fromJSON($field->options2);
        $options2['extension'] = $options2['extension'] ? $options2['extension'] : 'com_content';
        $options2['view'] = $options2['view'] ? $options2['view'] : 'article';
        // Prepare
        $class = 'inputbox select' . $validate . ($field->css ? ' ' . $field->css : '');
        $xml = '
						<form>
							<field
								type="' . self::$type2 . '"
								name="' . $name . '"
								id="' . $id . '"
								label="' . htmlspecialchars($field->label) . '"
								class="' . $class . '"
								extension="' . $options2['extension'] . '"
								view="' . $options2['view'] . '"
								useglobal="true"
							>
							<option value="">JOPTION_USE_DEFAULT</option>
						</field>
						</form>
					';
        $form = JForm::getInstance($id, $xml);
        $form = $form->getInput($name, '', $value);
        // Set
        if (!$field->variation) {
            $field->form = $form;
            if ($field->script) {
                parent::g_addScriptDeclaration($field->script);
            }
        } else {
            parent::g_getDisplayVariation($field, $field->variation, $value, $value, $form, $id, $name, '<select', '', '', $config);
        }
        $field->value = $value;
        // Return
        if ($return === true) {
            return $field;
        }
    }
 public function download()
 {
     $app = JFactory::getApplication();
     $id = $app->input->getInt('id', 0);
     $fieldname = $app->input->getString('file', '');
     $collection = $app->input->getString('collection', '');
     $xi = $app->input->getString('xi', 0);
     $client = $app->input->getString('client', 'content');
     $restricted = '';
     $user = JFactory::getUser();
     if (!$id) {
         $file = $fieldname;
         $path = JPATH_ROOT . '/' . $file;
         $paths = JCck::getConfig_Param('media_paths', '');
         if ($paths != '') {
             $allowed = false;
             $paths = strtr($paths, array("\r\n" => '<br />', "\r" => '<br />', "\n" => '<br />'));
             $paths = explode('<br />', $paths);
             if (count($paths)) {
                 $paths[] = 'tmp/';
                 foreach ($paths as $p) {
                     if (strpos($path, JPATH_ROOT . '/' . $p) !== false) {
                         $allowed = true;
                         break;
                     }
                 }
             }
             if (!$allowed) {
                 $this->setRedirect(JUri::root(), JText::_('COM_CCK_ALERT_FILE_NOT_AUTH'), "error");
                 return;
             }
         } elseif (strpos($path, JPATH_ROOT . '/tmp/') === false) {
             $this->setRedirect(JUri::base(), JText::_('COM_CCK_ALERT_FILE_NOT_AUTH'), "error");
             return;
         }
     } else {
         $field = JCckDatabase::loadObject('SELECT a.* FROM #__cck_core_fields AS a WHERE a.name="' . ($collection != '' ? $collection : $fieldname) . '"');
         //#
         $query = 'SELECT a.pk, a.author_id, a.cck as type, b.' . $field->storage_field . ' as value FROM #__cck_core AS a LEFT JOIN ' . $field->storage_table . ' AS b on b.id = a.pk WHERE a.id =' . (int) $id;
         $core = JCckDatabase::loadObject($query);
         switch ($field->storage) {
             //todo: call plugins!
             case 'custom':
                 if ($collection != '') {
                     $regex = CCK_Content::getRegex_Group($fieldname, $collection, $xi);
                     preg_match($regex, $core->value, $matches);
                     $value = $matches[1];
                 } else {
                     $regex = CCK_Content::getRegex_Field($fieldname);
                     preg_match($regex, $core->value, $matches);
                     $value = $matches[1];
                 }
                 break;
             case 'standard':
             default:
                 $value = $core->value;
                 break;
         }
         // Access
         // $current	=	JSite::getMenu()->getActive()->id;
         $clients = JCckDatabase::loadObjectList('SELECT a.fieldid, a.client, a.access, a.restriction, a.restriction_options FROM #__cck_core_type_field AS a LEFT JOIN #__cck_core_types AS b ON b.id = a.typeid' . ' WHERE a.fieldid = ' . (int) $field->id . ' AND b.name="' . (string) $core->type . '"', 'client');
         $access = isset($clients[$client]->access) ? (int) $clients[$client]->access : 0;
         $autorised = $user->getAuthorisedViewLevels();
         $restricted = isset($clients[$client]->restriction) ? $clients[$client]->restriction : '';
         if (!($access > 0 && array_search($access, $autorised) !== false)) {
             $this->setRedirect('index.php', JText::_('COM_CCK_ALERT_FILE_NOT_AUTH'), "error");
             return;
         }
         JPluginHelper::importPlugin('cck_field');
         $dispatcher = JDispatcher::getInstance();
         $config = array('client' => $client, 'id' => id, 'pk' => $core->pk, 'pkb' => 0);
         $field = JCckDatabase::loadObject('SELECT a.* FROM #__cck_core_fields AS a WHERE a.name="' . $fieldname . '"');
         //#
         if ($restricted) {
             JPluginHelper::importPlugin('cck_field_restriction');
             $field->restriction = $restricted;
             $field->restriction_options = $clients[$client]->restriction_options;
             $allowed = JCck::callFunc_Array('plgCCK_Field_Restriction' . $restricted, 'onCCK_Field_RestrictionPrepareContent', array(&$field, &$config));
             if ($allowed !== true) {
                 $this->setRedirect('index.php', JText::_('COM_CCK_ALERT_FILE_NOT_AUTH'), "error");
                 return;
             }
         }
         $dispatcher->trigger('onCCK_FieldPrepareContent', array(&$field, $value, &$config));
         // Path Folder
         if ($collection != '') {
             $group_x = JCckDatabase::loadObject('SELECT a.options2 FROM #__cck_core_fields AS a WHERE a.name="' . $fieldname . '"');
             $f_opt2 = JCckDev::fromJSON($group_x->options2);
         } else {
             $f_opt2 = JCckDev::fromJSON($field->options2);
         }
         $file = '';
         if (isset($f_opt2['storage_format']) && $f_opt2['storage_format']) {
             $file .= $f_opt2['path'];
             $file .= isset($f_opt2['path_user']) && $f_opt2['path_user'] ? $core->author_id . '/' : '';
             $file .= isset($f_opt2['path_content']) && $f_opt2['path_content'] ? $core->pk . '/' : '';
         }
         $file .= $field->value;
     }
     $path = JPATH_ROOT . '/' . $file;
     if (is_file($path) && $file) {
         $size = filesize($path);
         $ext = strtolower(substr(strrchr($path, '.'), 1));
         if ($ext == 'php' || $file == '.htaccess') {
             return;
         }
         $name = substr($path, strrpos($path, '/') + 1, strrpos($path, '.'));
         if ($path) {
             set_time_limit(0);
             @ob_end_clean();
             include JPATH_ROOT . '/components/com_cck/download.php';
         }
     } else {
         $this->setRedirect('index.php', JText::_('COM_CCK_ALERT_FILE_DOESNT_EXIST'), 'error');
     }
 }
Exemple #30
0
 public function onCCK_FieldPrepareStore(&$field, $value = '', &$config = array(), $inherit = array(), $return = false)
 {
     if (self::$type != $field->type) {
         return;
     }
     // Init
     if (count($inherit)) {
         $name = isset($inherit['name']) && $inherit['name'] != '' ? $inherit['name'] : $field->name;
     } else {
         $name = $field->name;
     }
     $options2 = JCckDev::fromJSON($field->options2);
     $siteName = JFactory::getConfig()->get('sitename');
     $valid = 0;
     $send = isset($options2['send']) && $field->state != 'disabled' ? $options2['send'] : 0;
     $send_field = isset($options2['send_field']) && strlen($options2['send_field']) > 0 ? $options2['send_field'] : 0;
     $isNew = $config['pk'] ? 0 : 1;
     $sender = 0;
     switch ($send) {
         case 0:
             $sender = 0;
             break;
         case 1:
             if (!$config['pk']) {
                 $sender = 1;
             }
             break;
         case 2:
             if ($config['pk']) {
                 $sender = 1;
             }
             break;
         case 3:
             $sender = 1;
             break;
     }
     $subject = isset($options2['subject']) && $options2['subject'] ? $options2['subject'] : $siteName . '::' . JText::_('COM_CCK_EMAIL_GENERIC_SUBJECT');
     $message = isset($options2['message']) && $options2['message'] ? htmlspecialchars_decode($options2['message']) : JText::sprintf('COM_CCK_EMAIL_GENERIC_MESSAGE', $siteName);
     $message = strlen($options2['message']) > 0 ? htmlspecialchars_decode($options2['message']) : JText::sprintf('COM_CCK_EMAIL_GENERIC_MESSAGE', $siteName);
     $new_message = strlen($options2['message_field']) > 0 ? $options2['message_field'] : '';
     $dest = array();
     $from = isset($options2['from']) ? $options2['from'] : 0;
     $from_param = isset($options2['from_param']) ? $options2['from_param'] : '';
     $from_name = isset($options2['from_name']) ? $options2['from_name'] : 0;
     $from_name_param = isset($options2['from_name_param']) ? $options2['from_name_param'] : '';
     $cc = isset($options2['cc']) ? $options2['cc'] : 0;
     $cc_param = isset($options2['cc_param']) ? $options2['cc_param'] : '';
     $bcc = isset($options2['bcc']) ? $options2['bcc'] : 0;
     $bcc_param = isset($options2['bcc_param']) ? $options2['bcc_param'] : '';
     $moredest = isset($options2['to_field']) ? $options2['to_field'] : '';
     $send_attach = isset($options2['send_attachment_field']) && strlen($options2['send_attachment_field']) > 0 ? $options2['send_attachment_field'] : 1;
     $moreattach = isset($options2['attachment_field']) && strlen($options2['attachment_field']) > 0 ? $options2['attachment_field'] : '';
     // Prepare
     if ($options2['to'] != '') {
         $to = self::_split($options2['to']);
         $dest = array_merge($dest, $to);
         $valid = 1;
     }
     if ($moredest) {
         $valid = 1;
     }
     if ($options2['to_admin'] != '') {
         $to_admin = count($options2['to_admin']) ? implode(',', $options2['to_admin']) : $options2['to_admin'];
         if (strpos($to_admin, ',') !== false) {
             $recips = explode(',', $to_admin);
             foreach ($recips as $recip) {
                 $recip_mail = JCckDatabase::loadResult('SELECT email FROM #__users WHERE block=0 AND id=' . $recip);
                 if ($recip_mail) {
                     $dest[] = $recip_mail;
                     $valid = 1;
                 }
             }
         } else {
             $recip_mail = JCckDatabase::loadResult('SELECT email FROM #__users WHERE block=0 AND id=' . $to_admin);
             if ($recip_mail) {
                 $dest[] = $recip_mail;
                 $valid = 1;
             }
         }
     }
     if ($value) {
         // if () TODO check multiple
         $m_value = self::_split($value);
         $m_value_size = count($m_value);
         if ($m_value_size > 1) {
             for ($i = 0; $i < $m_value_size; $i++) {
                 $dest[] = $m_value[$i];
             }
         } else {
             $dest[] = $value;
         }
         $valid = 1;
     }
     // Validate
     parent::g_onCCK_FieldPrepareStore_Validation($field, $name, $value, $config);
     // Add Process
     if (($sender || $send_field) && $valid) {
         parent::g_addProcess('afterStore', self::$type, $config, array('isNew' => $isNew, 'sender' => $sender, 'send_field' => $send_field, 'name' => $name, 'valid' => $valid, 'subject' => $subject, 'message' => $message, 'new_message' => $new_message, 'dest' => $dest, 'from' => $from, 'from_param' => $from_param, 'from_name' => $from_name, 'from_name_param' => $from_name_param, 'cc' => $cc, 'cc_param' => $cc_param, 'bcc' => $bcc, 'bcc_param' => $bcc_param, 'moredest' => $moredest, 'send_attach' => $send_attach, 'moreattach' => $moreattach, 'format' => @(string) $options2['format']));
     }
     // Set or Return
     if ($return === true) {
         return $value;
     }
     $field->value = $value;
     parent::g_onCCK_FieldPrepareStore($field, $name, $value, $config);
 }