Example #1
0
 public static function addScript($url, $type = "text/javascript", $defer = false, $async = false)
 {
     $app = JFactory::getApplication();
     if (!isset($app->cck_document)) {
         $app->cck_document = array();
     }
     // Make sure to have only one inclusion of special external scripts
     if (strpos($url, 'http') !== false) {
         if (strpos($url, '//maps.googleapis.com/maps/api/js?') !== false) {
             if (isset(self::$_urls['google_maps'])) {
                 $cur = self::$_urls['google_maps'];
                 $vars2 = JCckDevHelper::getUrlVars($url);
                 if (!$vars2->def('libraries')) {
                     return;
                 }
                 $vars = JCckDevHelper::getUrlVars($cur);
                 $libraries = array();
                 $libraries[$vars->get('libraries')] = '';
                 $libraries[$vars2->get('libraries')] = '';
                 $libraries = array_keys($libraries);
                 $url = str_replace('libraries=' . $vars2->get('libraries'), 'libraries=' . implode(',', $libraries), $url);
                 unset($app->cck_document['scripts'][$cur]);
             }
             self::$_urls['google_maps'] = $url;
         }
     }
     $app->cck_document['scripts'][$url]['mime'] = $type;
     $app->cck_document['scripts'][$url]['defer'] = $defer;
     $app->cck_document['scripts'][$url]['async'] = $async;
 }
Example #2
0
 public static function onCCK_Storage_LocationAfterRender(&$buffer, &$data, $uri = array())
 {
     $app = JFactory::getApplication();
     if ($uri['layout']) {
         return;
     }
     if ($uri['view'] == 'featured') {
         $data['return_view'] = 'featured';
         $tag = '&return=featured';
     } else {
         $data['return_view'] = '';
         $tag = '';
     }
     $class = JCck::on('3.4') ? ' class="hasTooltip"' : '';
     $data['doIntegration'] = false;
     $data['multilanguage'] = $data['options']->get('multilanguage', 0);
     if ($data['multilanguage']) {
         $data['search'] = '#<a' . $class . ' href="(.*)index.php\\?option=com_content&amp;task=article.edit' . $tag . '&amp;id=([0-9]*)" (.*)>#U';
     } else {
         $data['search'] = '#<a' . $class . ' href="(.*)index.php\\?option=com_content&amp;task=article.edit' . $tag . '&amp;id=([0-9]*)"#';
     }
     $data['search_alt'] = '#<a href = "javascript://" onclick="listItemTask\\(\'cb([0-9]*)\', \'articles.archive\'\\)">(.*)</a>#sU';
     if (JCckDevHelper::hasLanguageAssociations() && $data['multilanguage']) {
         $query = 'SELECT a.pk, a.cck, b.key, c.language FROM #__cck_core AS a' . ' LEFT JOIN #__associations AS b ON ( b.id = a.pk AND context = "com_content.item" )' . ' LEFT JOIN #__content AS c ON c.id = a.pk' . ' WHERE storage_location="joomla_article"';
         $list_assoc = JCckDatabase::loadObjectListArray('SELECT a.id, a.key, b.language FROM #__associations AS a LEFT JOIN #__content AS b ON ( b.id = a.id AND a.context = "com_content.item" )', 'key', 'language');
     } else {
         $query = 'SELECT pk, cck FROM #__cck_core WHERE storage_location="joomla_article"';
         $list_assoc = array();
     }
     $list = JCckDatabase::loadObjectList($query, 'pk');
     $buffer = JCckDevIntegration::rewriteBuffer($buffer, $data, $list, $list_assoc);
 }
Example #3
0
 public function createThumb($image, $tnumber, $twidth, $theight, $tformat, $quality = 100)
 {
     if (!($twidth && trim($twidth) != '' && is_numeric($twidth)) && !($theight && trim($theight) != '' && is_numeric($theight))) {
         return false;
     }
     $path = $this->_pathinfo['dirname'];
     $resImage = $this->_resource;
     // Calcul Thumb Size
     $values = $this->_prepareDimensions($this->_width, $this->_height, $twidth, $theight, $tformat);
     list($thumbX, $thumbY, $newX, $newY, $thumbWidth, $thumbHeight, $newWidth, $newHeight) = $values;
     // Add transparence for PNG
     $thumbImage = imageCreateTrueColor($thumbWidth, $thumbHeight);
     if ($this->_extension == 'png') {
         imagealphablending($thumbImage, false);
     }
     // Generate thumb ressource
     imagecopyresampled($thumbImage, $resImage, $thumbX, $thumbY, $newX, $newY, $thumbWidth, $thumbHeight, $newWidth, $newHeight);
     // Set Folder
     // $file_path ='';
     if ($tnumber == 0) {
         $thumbLocation = $path . '/' . $this->_pathinfo['basename'];
     } else {
         JCckDevHelper::createFolder($path . '/_thumb' . $tnumber);
         $thumbLocation = $path . '/_thumb' . $tnumber . '/' . $this->_pathinfo['basename'];
     }
     // Create image
     $this->_generateThumb($this->_extension, $thumbImage, $thumbLocation, $quality);
     return true;
 }
Example #4
0
 public function onCCK_FieldConstruct($type, &$data = array())
 {
     if (self::$type != $type) {
         return;
     }
     if ($data['json']['options2']['path'][strlen($data['json']['options2']['path']) - 1] != '/') {
         $data['json']['options2']['path'] .= '/';
     }
     $data['json']['options2']['path'] = trim($data['json']['options2']['path']);
     JCckDevHelper::createFolder(JPATH_SITE . '/' . $data['json']['options2']['path']);
     parent::g_onCCK_FieldConstruct($data);
 }
 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) . ']' : '';
     }
     // Prepare
     $assoc = JCckDevHelper::hasLanguageAssociations();
     $form = '';
     if ($assoc && $config['pk']) {
         if (isset($config['base']->location) && $config['base']->location) {
             $location = $config['base']->location;
         } else {
             $location = JCckdatabase::loadResult('SELECT storage_location FROM #__cck_core_types WHERE name = "' . $config['type'] . '"');
         }
         if (is_file(JPATH_SITE . '/plugins/cck_storage_location/' . $location . '/classes/helper.php')) {
             require_once JPATH_SITE . '/plugins/cck_storage_location/' . $location . '/classes/helper.php';
             $form = JCck::callFunc_Array('plgCCK_Storage_Location' . $location . '_Helper', 'getAssociationsForm', array($id, $name, $config));
         }
     }
     // Set
     if (!$field->variation) {
         $field->form = $form;
         if ($field->script) {
             parent::g_addScriptDeclaration($field->script);
         }
     } else {
         //
     }
     $field->value = $value;
     // Return
     if ($return === true) {
         return $field;
     }
 }
Example #6
0
 public function export_variation()
 {
     $app = JFactory::getApplication();
     $model = $this->getModel();
     $name = $app->input->getString('variation', '');
     $folder = $app->input->getString('folder', '');
     if ($file = $model->prepareExport_Variation($name, $folder)) {
         $file = JCckDevHelper::getRelativePath($file, false);
         $this->setRedirect(JUri::base() . 'index.php?option=com_cck&task=download&file=' . $file);
     } else {
         $this->setRedirect('index.php?option=com_cck&view=variations');
     }
 }
Example #7
0
function CckParseRoute($segments)
{
    $app = JFactory::getApplication();
    $count = count($segments);
    $menu = $app->getMenu();
    $menuItem = $menu->getActive();
    $vars = array();
    if ($segments[0] == 'form') {
        $menu->setActive($app->input->getInt('Itemid', 0));
        $vars['option'] = 'com_cck';
        $vars['view'] = 'form';
        $vars['layout'] = 'edit';
        $vars['type'] = $segments[1];
    } else {
        $legacy = 0;
        // check later
        if (!($menuItem->query['option'] == 'com_cck' && $menuItem->query['view'] == 'list')) {
            $legacy = 0;
        }
        if (!$legacy) {
            if (isset($menuItem->query['search'])) {
                $params = JCckDevHelper::getRouteParams($menuItem->query['search']);
            }
            if (isset($params['location']) && $params['location'] && is_file(JPATH_SITE . '/plugins/cck_storage_location/' . $params['location'] . '/' . $params['location'] . '.php')) {
                require_once JPATH_SITE . '/plugins/cck_storage_location/' . $params['location'] . '/' . $params['location'] . '.php';
                JCck::callFunc_Array('plgCCK_Storage_Location' . $params['location'], 'parseRoute', array(&$vars, $segments, $count, $params));
            } else {
                $legacy = 1;
            }
        }
        if ($legacy) {
            if ($count == 2) {
                $vars['option'] = 'com_content';
                $vars['view'] = 'article';
                $vars['catid'] = $segments[0];
                $vars['id'] = $segments[1];
            } elseif ($count == 1) {
                $vars['option'] = 'com_content';
                @(list($id, $alias) = explode(':', $segments[0], 2));
                $category = JCategories::getInstance('Content')->get($id);
                if ($category && $category->id == $id && $category->alias == $alias) {
                    $vars['view'] = 'categories';
                } else {
                    $vars['view'] = 'article';
                }
                $vars['id'] = $segments[0];
            }
        }
    }
    return $vars;
}
Example #8
0
 protected function prepareTable2(&$table, &$data)
 {
     if (is_array($data['elements'])) {
         $data['elements'] = implode(',', $data['elements']);
     } else {
         $data['elements'] = '';
     }
     if (!$data['jform']['id'] && !$data['jform']['rules']) {
         $data['jform']['rules'] = array('core.create' => array(), 'core.delete' => array(), 'core.delete.own' => array(), 'core.edit' => array(), 'core.edit.state' => array(), 'core.edit.own' => array());
     }
     if ($data['jform']['rules']) {
         if (!is_array($data['jform']['rules'])) {
             $data['jform']['rules'] = json_decode($data['jform']['rules']);
         }
         $rules = new JAccessRules(JCckDevHelper::getRules($data['jform']['rules']));
         $table->setRules($rules);
     }
 }
Example #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;
     } else {
         $id = $field->name;
         $name = $field->name;
     }
     $value = $field->defaultvalue;
     // Prepare
     $value = JCckDevHelper::replaceLive($value);
     if ($field->bool8) {
         $field->bool8 = $config['doTranslation'];
     }
     if ($field->bool8) {
         $value = trim(preg_replace('/[^A-Za-z0-9_ ]/', '', strip_tags($value)));
         if ($value) {
             $value = JText::_('COM_CCK_' . str_replace(' ', '_', $value));
         }
     }
     $form = htmlspecialchars_decode($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, '', '', '', $config);
     }
     $field->value = $value;
     // Return
     if ($return === true) {
         return $field;
     }
 }
Example #10
0
 public function export()
 {
     $app = JFactory::getApplication();
     $model = $this->getModel();
     $recordId = $app->input->getInt('id', 0);
     $elements = $app->input->getString('elements', '');
     $elements = array_flip(explode(',', $elements));
     $dependencies = array();
     $menu = $app->input->getInt('dep_menu', 0);
     $options = $app->input->get('options', array(), 'array');
     if ($app->input->getInt('dep_categories', 0)) {
         $dependencies['categories'] = 1;
     }
     if ($menu) {
         $dependencies['menu'] = $menu;
     }
     if ($file = $model->prepareExport($recordId, $elements, $dependencies, $options)) {
         $file = JCckDevHelper::getRelativePath($file, false);
         $this->setRedirect(JUri::base() . 'index.php?option=com_cck&task=download&file=' . $file);
     } else {
         $this->setRedirect(_C0_LINK, JText::_('JERROR_AN_ERROR_HAS_OCCURRED'), 'error');
     }
 }
Example #11
0
 protected function prepareTable2(&$table, &$data)
 {
     if (!$data['jform']['id'] && !$data['jform']['rules']) {
         $data['jform']['rules'] = array('core.create' => array(), 'core.create.max.parent' => array('8' => "0"), 'core.create.max.parent.author' => array('8' => "0"), 'core.create.max.author' => array('8' => "0"), 'core.delete' => array(), 'core.delete.own' => array(), 'core.edit' => array(), 'core.edit.own' => array());
     }
     if ($data['jform']['rules']) {
         if (!is_array($data['jform']['rules'])) {
             $data['jform']['rules'] = json_decode($data['jform']['rules']);
         }
         jimport('cck.joomla.access.access');
         $rules = new CCKRules(JCckDevHelper::getRules($data['jform']['rules']), 'com_cck', 'form');
         $table->setRules($rules);
     }
 }
 public static function getRouteByStorage(&$storage, $sef, $itemId, $config = array(), $lang_tag = '')
 {
     if (isset($storage[self::$table]->_route) && !$lang_tag) {
         return JRoute::_($storage[self::$table]->_route);
     }
     if ($sef) {
         if ($sef == '0' || $sef == '1') {
             $path = '&catid=' . $storage[self::$table]->catid;
         } elseif ($sef[0] == '4') {
             $path = '&catid=' . (isset($storage[self::$table]->category_alias) ? $storage[self::$table]->category_alias : $storage[self::$table]->catid);
         } elseif ($sef[0] == '3') {
             $path = '&typeid=' . $config['type'];
         } else {
             $path = '';
         }
         if (is_object($storage[self::$table])) {
             $storage[self::$table]->_route = self::_getRoute($sef, $itemId, $storage[self::$table]->slug, $path);
         }
         // Multilanguage Associations
         if (JCckDevHelper::hasLanguageAssociations()) {
             $app = JFactory::getApplication();
             $pk = $storage[self::$table]->id;
             if ($app->input->get('view') == 'article' && $app->input->get('id') == $storage[self::$table]->id && !count(self::$routes)) {
                 JLoader::register('MenusHelper', JPATH_ADMINISTRATOR . '/components/com_menus/helpers/menus.php');
                 $assoc_c = JLanguageAssociations::getAssociations('com_content', '#__content', 'com_content.item', $pk);
                 $assoc_m = MenusHelper::getAssociations($itemId);
                 $languages = JLanguageHelper::getLanguages();
                 $lang_code = JFactory::getLanguage()->getTag();
                 foreach ($languages as $l) {
                     if ($lang_code == $l->lang_code) {
                         self::$routes[$l->lang_code] = $storage[self::$table]->_route;
                     } else {
                         $itemId2 = isset($assoc_m[$l->lang_code]) ? $assoc_m[$l->lang_code] : 0;
                         $pk2 = isset($assoc_c[$l->lang_code]) ? (int) $assoc_c[$l->lang_code]->id : 0;
                         self::$routes[$l->lang_code] = '';
                         if ($pk2 && $itemId2) {
                             self::$routes[$l->lang_code] = self::getRoute($pk2, $sef, $itemId2, $config, $l->sef);
                         }
                     }
                 }
             }
         }
     } else {
         require_once JPATH_SITE . '/components/com_content/helpers/route.php';
         $storage[self::$table]->_route = ContentHelperRoute::getArticleRoute($storage[self::$table]->slug, $storage[self::$table]->catid, $storage[self::$table]->language);
     }
     return JRoute::_($storage[self::$table]->_route);
 }
Example #13
0
 protected function _core($data, &$config = array(), $pk = 0)
 {
     if (!$config['id']) {
         $isNew = true;
         $config['id'] = parent::g_onCCK_Storage_LocationPrepareStore();
     } else {
         $isNew = false;
     }
     // Init
     $table = self::_getTable($pk);
     $isNew = $pk > 0 ? false : true;
     if (isset($table->tags)) {
         $tags = $table->tags;
         unset($table->tags);
     } else {
         $tags = null;
     }
     if (isset($data['tags'])) {
         if (!empty($data['tags']) && $data['tags'][0] != '') {
             $table->newTags = $data['tags'];
         }
         unset($data['tags']);
     }
     self::_initTable($table, $data, $config);
     // Check Error
     if (self::$error === true) {
         return false;
     }
     // Prepare
     if (is_array($data)) {
         $table->bind($data);
     }
     if ($isNew && !isset($data['rules'])) {
         $data['rules'] = array('core.create' => array(), 'core.delete' => array(), 'core.edit' => array(), 'core.edit.state' => array(), 'core.edit.own' => array());
     }
     if (isset($data['rules']) && $data['rules']) {
         if (!is_array($data['rules'])) {
             $data['rules'] = json_decode($data['rules']);
         }
         $rules = new JAccessRules(JCckDevHelper::getRules($data['rules']));
         $table->setRules($rules);
     }
     $table->check();
     self::_completeTable($table, $data, $config);
     // Store
     $dispatcher = JDispatcher::getInstance();
     JPluginHelper::importPlugin('content');
     $dispatcher->trigger('onContentBeforeSave', array(self::$context, &$table, $isNew));
     if ($isNew === true && parent::g_isMax($table->{self::$author}, $table->{self::$parent}, $config)) {
         return;
     }
     if (!$table->store()) {
         JFactory::getApplication()->enqueueMessage($table->getError(), 'error');
         if ($isNew) {
             parent::g_onCCK_Storage_LocationRollback($config['id']);
         }
         return false;
     }
     // Checkin
     parent::g_checkIn($table);
     self::$pk = $table->{self::$key};
     if (!$config['pk']) {
         $config['pk'] = self::$pk;
     }
     $config['author'] = $table->{self::$author};
     $config['parent'] = $table->{self::$parent};
     parent::g_onCCK_Storage_LocationStore($data, self::$table, self::$pk, $config);
     $dispatcher->trigger('onContentAfterSave', array(self::$context, &$table, $isNew));
     // Associations
     // todo
 }
Example #14
0
 public function process()
 {
     // JSession::checkToken() or jexit( JText::_( 'JINVALID_TOKEN' ) );
     if (!is_file(JPATH_ADMINISTRATOR . '/components/com_cck_toolbox/models/cck_toolbox.php')) {
         $this->setRedirect($this->_getReturnPage(), JText::_('JERROR_AN_ERROR_HAS_OCCURRED'), 'error');
         return;
     }
     $app = JFactory::getApplication();
     $ids = $app->input->get('cid', array(), 'array');
     $task_id = $app->input->getInt('tid', 0);
     jimport('joomla.utilities.arrayhelper');
     JArrayHelper::toInteger($ids);
     require_once JPATH_ADMINISTRATOR . '/components/com_cck_toolbox/models/cck_toolbox.php';
     $model = JModelLegacy::getInstance('CCK_Toolbox', 'CCK_ToolboxModel');
     $params = JComponentHelper::getParams('com_cck_toolbox');
     $output = 1;
     // $params->get( 'output', 0 );
     if ($file = $model->prepareProcess($params, $task_id, $ids)) {
         if ($output > 0) {
             $this->setRedirect($this->_getReturnPage(), JText::_('COM_CCK_SUCCESSFULLY_PROCESSED'), 'message');
         } else {
             $file = JCckDevHelper::getRelativePath($file, false);
             $this->setRedirect(JUri::base() . 'index.php?option=com_cck&task=download&file=' . $file);
         }
     } else {
         $this->setRedirect($this->_getReturnPage(), JText::_('JERROR_AN_ERROR_HAS_OCCURRED'), 'error');
     }
 }
Example #15
0
 public static function getRouteByStorage(&$storage, $sef, $itemId, $config = array())
 {
     if (isset($storage[self::$table]->_route)) {
         return JRoute::_($storage[self::$table]->_route);
     }
     if ($sef) {
         if ($sef == '0' || $sef == '1') {
             $path = '&catid=' . $storage[self::$table]->catid;
         } elseif ($sef[0] == '4') {
             $path = '&catid=' . (isset($storage[self::$table]->parent_alias) ? $storage[self::$table]->parent_alias : $storage[self::$table]->parent_id);
         } elseif ($sef[0] == '3') {
             $path = '&typeid=' . $config['type'];
         } else {
             $path = '';
         }
         if (is_object($storage[self::$table])) {
             $storage[self::$table]->_route = self::_getRoute($sef, $itemId, $storage[self::$table]->slug, $path);
         }
         // Multilanguage Associations
         if (JCckDevHelper::hasLanguageAssociations()) {
             // TODO (mod_cck_lang...)
         }
     } else {
         require_once JPATH_SITE . '/components/com_content/helpers/route.php';
         $storage[self::$table]->_route = ContentHelperRoute::getCategoryRoute($storage[self::$table]->id);
     }
     return JRoute::_($storage[self::$table]->_route);
 }
Example #16
0
 public function parse(&$segments)
 {
     $app = JFactory::getApplication();
     $count = count($segments);
     $menu = $app->getMenu();
     $menuItem = $menu->getActive();
     $vars = array();
     if ($segments[0] == 'form') {
         $menu->setActive($app->input->getInt('Itemid', 0));
         $vars['option'] = 'com_cck';
         $vars['view'] = 'form';
         $vars['layout'] = 'edit';
         $vars['type'] = @$segments[1];
     } else {
         $legacy = 0;
         // check later
         if (!($menuItem->query['option'] == 'com_cck' && $menuItem->query['view'] == 'list')) {
             $legacy = 0;
         }
         if (!$legacy) {
             if (isset($menuItem->query['search'])) {
                 $params = JCckDevHelper::getRouteParams($menuItem->query['search']);
                 if ($params['doSEF'][0] == '4' || $params['doSEF'][0] == '5') {
                     if ($count == 1) {
                         if (isset($params['location']) && $params['location'] && is_file(JPATH_SITE . '/plugins/cck_storage_location/' . $params['location'] . '/' . $params['location'] . '.php')) {
                             require_once JPATH_SITE . '/plugins/cck_storage_location/' . $params['location'] . '/' . $params['location'] . '.php';
                             $target = $params['doSEF'][0] == '5' ? 'author_object' : 'parent_object';
                             $properties = array($target);
                             $properties = JCck::callFunc('plgCCK_Storage_Location' . $params['location'], 'getStaticProperties', $properties);
                             if ($properties[$target] != '') {
                                 $params['doSEF'][0] = '2';
                                 $params['location'] = $properties[$target];
                             }
                         }
                     }
                 }
             }
             if (isset($params['location']) && $params['location'] && is_file(JPATH_SITE . '/plugins/cck_storage_location/' . $params['location'] . '/' . $params['location'] . '.php')) {
                 require_once JPATH_SITE . '/plugins/cck_storage_location/' . $params['location'] . '/' . $params['location'] . '.php';
                 JCck::callFunc_Array('plgCCK_Storage_Location' . $params['location'], 'parseRoute', array(&$vars, $segments, $count, $params));
             } else {
                 $legacy = 1;
             }
         }
         if ($legacy) {
             if ($count == 2) {
                 $vars['option'] = 'com_content';
                 $vars['view'] = 'article';
                 $vars['catid'] = $segments[0];
                 $vars['id'] = $segments[1];
             } elseif ($count == 1) {
                 $vars['option'] = 'com_content';
                 $idArray = explode(':', $segments[0], 2);
                 $id = (int) $idArray[0];
                 $alias = (string) @$idArray[1];
                 $category = JCategories::getInstance('Content')->get($id);
                 if ($category && $category->id == $id && $category->alias == $alias) {
                     $vars['view'] = 'categories';
                 } else {
                     $vars['view'] = 'article';
                 }
                 $vars['id'] = $segments[0];
             }
         }
     }
     return $vars;
 }
Example #17
0
                }
            }
        }
    }
}
$show_more = $params->get('show_more', 1);
$show_link_more = $params->get('show_link_more', 0);
$show_more_class = $params->get('link_more_class', '');
$show_more_class = $show_more_class ? ' class="' . $show_more_class . '"' : '';
$show_more_text = $params->get('link_more_text', '');
if ($show_more_text == '') {
    $show_more_text = JText::_('MOD_CCK_LIST_VIEW_ALL');
} elseif (JCck::getConfig_Param('language_jtext', 0)) {
    $show_more_text = JText::_('COM_CCK_' . str_replace(' ', '_', trim($show_more_text)));
}
$show_more_link = '';
if (($show_more == 1 || $show_more == 2 && $total || $show_more == 3 && $total_items > $preconfig['limit2']) && $show_link_more) {
    $show_more_link = 'index.php?Itemid=' . $show_link_more;
    $show_more_link = JRoute::_($show_more_link);
    $show_more_vars = $params->get('link_more_variables', '');
    if ($show_more_vars) {
        $show_more_vars = JCckDevHelper::replaceLive($show_more_vars);
        if ($show_more_vars != '') {
            $show_more_link .= strpos($show_more_link, '?') !== false ? '&' . $show_more_vars : '?' . $show_more_vars;
        }
    }
}
$raw_rendering = $params->get('raw_rendering', 0);
$moduleclass_sfx = htmlspecialchars($params->get('moduleclass_sfx'));
$class_sfx = $params->get('force_moduleclass_sfx', 0) == 1 ? $moduleclass_sfx : '';
require JModuleHelper::getLayoutPath('mod_cck_list', $params->get('layout', 'default'));
Example #18
0
/**
* @version 			SEBLOD 3.x Core ~ $Id: mod_cck_form.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;
$show = $params->get('url_show', '');
$hide = $params->get('url_hide', '');
if ($show && JCckDevHelper::matchUrlVars($show) === false) {
    return;
}
if ($hide && JCckDevHelper::matchUrlVars($hide) !== false) {
    return;
}
$app = JFactory::getApplication();
$data = '';
$uniqId = 'm' . $module->id;
$formId = 'seblod_form_' . $uniqId;
if (!defined('JPATH_LIBRARIES_CCK')) {
    define('JPATH_LIBRARIES_CCK', JPATH_SITE . '/libraries/cck');
}
if (!defined('JROOT_MEDIA_CCK')) {
    define('JROOT_MEDIA_CCK', JURI::root(true) . '/media/cck');
}
JCck::loadjQuery();
JFactory::getLanguage()->load('com_cck_default', JPATH_SITE);
require_once JPATH_SITE . '/components/com_cck/helpers/helper_include.php';
Example #19
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 . '/');
     $field->label2 = trim(@$field->label2);
     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 = $field->label;
     $field->label = '';
     // Prepare
     $pre_task = '';
     $options2 = JCckDev::fromJSON($field->options2);
     $task = isset($options2['task']) && $options2['task'] ? $options2['task'] : 'save';
     $task_auto = isset($options2['task_auto']) && $options2['task_auto'] == '0' ? 0 : 1;
     $task_id = isset($options2['task_id']) && $options2['task_id'] ? $options2['task_id'] : 0;
     if (JFactory::getApplication()->isAdmin()) {
         $task = $config['client'] == 'admin' ? 'form.' . $task : 'list.' . $task;
     }
     if ($task_id) {
         $pre_task = htmlspecialchars('jQuery("#' . $config['formId'] . '").append(\'<input type="hidden" name="tid" value="' . $task_id . '">\');');
     }
     $class = 'button btn' . ($field->css ? ' ' . $field->css : '');
     if ($task == 'cancel') {
         $click = ' onclick="JCck.Core.submitForm(\'' . $task . '\', document.getElementById(\'seblod_form\'));"';
     } else {
         if ($task == 'export' || $task == 'process' || $task == 'list.export' || $task == 'list.process') {
             $click = $pre_task . $config['submit'] . '(\'' . $task . '\');return false;';
             if ($field->variation != 'toolbar_button') {
                 parent::g_addProcess('beforeRenderForm', self::$type, $config, array('name' => $field->name, 'task' => $task, 'task_auto' => $task_auto, 'task_id' => $task_id));
             }
             if (!$task_auto) {
                 $click = 'if (document.' . $config['formId'] . '.boxchecked.value==0){alert(\'' . JText::_('JLIB_HTML_PLEASE_MAKE_A_SELECTION_FROM_THE_LIST') . '\');}else{' . $click . '}';
             }
             $click = isset($config['submit']) ? ' onclick="' . $click . '"' : '';
         } elseif ($task == 'save2redirect') {
             $custom = '';
             if (isset($options2['custom']) && $options2['custom']) {
                 $custom = JCckDevHelper::replaceLive($options2['custom']);
                 $custom = $custom ? '&' . $custom : '';
             }
             if ($config['client'] == 'search') {
                 $pre_task = htmlspecialchars('jQuery("#' . $config['formId'] . '").attr(\'action\', \'' . JRoute::_('index.php?Itemid=' . $options2['itemid'] . $custom) . '\');');
             } else {
                 $pre_task = htmlspecialchars('jQuery("#' . $config['formId'] . ' input[name=\'config[url]\']").val(\'' . JRoute::_('index.php?Itemid=' . $options2['itemid'] . $custom) . '\');');
             }
             $click = isset($config['submit']) ? ' onclick="' . $pre_task . $config['submit'] . '(\'' . $task . '\');return false;"' : '';
         } else {
             $click = isset($config['submit']) ? ' onclick="' . $pre_task . $config['submit'] . '(\'' . $task . '\');return false;"' : '';
         }
     }
     if ($field->attributes && strpos($field->attributes, 'onclick="') !== false) {
         $matches = array();
         $search = '#onclick\\=\\"([a-zA-Z0-9_\\(\\)\\\'\\;\\.]*)"#';
         preg_match($search, $field->attributes, $matches);
         if (count($matches) && $matches[0]) {
             if ($matches[0] == $field->attributes) {
                 $field->attributes = substr(trim($field->attributes), 0, -1);
                 $click = ' ' . $field->attributes . '"';
                 $field->attributes = '';
             } else {
                 $click = ' onclick="' . $matches[1] . '"';
                 $field->attributes = trim(str_replace($matches[0], '', $field->attributes));
             }
         }
     }
     $attr = 'class="' . $class . '"' . $click . ($field->attributes ? ' ' . $field->attributes : '');
     if ($field->bool) {
         $label = $value;
         if (JCck::on()) {
             if ($field->bool6 == 3) {
                 $label = '<span class="icon-' . $options2['icon'] . '"></span>';
                 $attr .= ' title="' . $value . '"';
             } elseif ($field->bool6 == 2) {
                 $label = $value . "\n" . '<span class="icon-' . $options2['icon'] . '"></span>';
             } elseif ($field->bool6 == 1) {
                 $label = '<span class="icon-' . $options2['icon'] . '"></span>' . "\n" . $value;
             }
         }
         $type = $field->bool7 == 1 ? 'submit' : 'button';
         $form = '<button type="' . $type . '" id="' . $id . '" name="' . $name . '" ' . $attr . '>' . $label . '</button>';
         $tag = 'button';
     } else {
         $form = '<input type="submit" id="' . $id . '" name="' . $name . '" value="' . $value . '" ' . $attr . ' />';
         $tag = 'input';
     }
     if ($field->bool2 == 1) {
         $alt = $field->bool3 ? ' ' . JText::_('COM_CCK_OR') . ' ' : "\n";
         if ($config['client'] == 'search') {
             $onclick = 'onclick="jQuery(\'#' . $config['formId'] . '\').clearForm();"';
             $form .= $alt . '<a href="javascript: void(0);" ' . $onclick . ' title="' . JText::_('COM_CCK_RESET') . '">' . JText::_('COM_CCK_RESET') . '</a>';
         } else {
             $onclick = 'onclick="JCck.Core.submitForm(\'cancel\', document.getElementById(\'seblod_form\'));"';
             $form .= $alt . '<a href="javascript: void(0);" ' . $onclick . ' title="' . JText::_('COM_CCK_CANCEL') . '">' . JText::_('COM_CCK_CANCEL') . '</a>';
         }
     } elseif ($field->bool2 == 2) {
         $alt = $field->bool3 ? ' ' . JText::_('COM_CCK_OR') . ' ' : "\n";
         $field2 = (object) array('link' => $options2['alt_link'], 'link_options' => $options2['alt_link_options'], 'id' => $id, 'name' => $name, 'text' => htmlspecialchars($options2['alt_link_text']), 'value' => '');
         JCckPluginLink::g_setLink($field2, $config);
         JCckPluginLink::g_setHtml($field2, 'text');
         $form .= $alt . $field2->html;
     }
     // Set
     if (!$field->variation) {
         $field->form = $form;
         if ($field->script) {
             parent::g_addScriptDeclaration($field->script);
         }
     } else {
         if ($field->variation == 'toolbar_button') {
             $field->form = '';
             $icon = isset($options2['icon']) && $options2['icon'] ? 'icon-' . $options2['icon'] : '';
             $onclick = $pre_task . 'JCck.Core.submit(\'' . $task . '\')';
             if (!$task_auto) {
                 $onclick = 'if (document.' . $config['formId'] . '.boxchecked.value==0){alert(\'' . JText::_('JLIB_HTML_PLEASE_MAKE_A_SELECTION_FROM_THE_LIST') . '\');}else{' . $onclick . '}';
             }
             $html = '<button class="btn btn-small' . ($field->css ? ' ' . $field->css : '') . '" onclick="' . $onclick . '" href="#"><i class="' . $icon . '"></i> ' . $value . '</button>';
             parent::g_addProcess('beforeRenderForm', self::$type, $config, array('name' => $field->name, 'button' => array('html' => $html, 'icon' => @$options2['icon']), 'pre_task' => $pre_task, 'task' => $task, 'task_auto' => $task_auto, 'task_id' => $task_id));
         } else {
             parent::g_getDisplayVariation($field, $field->variation, $value, $value, $form, $id, $name, '<' . $tag, ' ', '', $config);
         }
     }
     $field->value = '';
     // Return
     if ($return === true) {
         return $field;
     }
 }
Example #20
0
 public static function onCCK_StoragePrepareSearch(&$field, $match, $value, $name, $name2, $target, $fields = array(), &$config = array())
 {
     $sql = '';
     switch ($match) {
         case 'exact':
             $sql = $target . ' = ' . JCckDatabase::quote($value);
             break;
         case 'empty':
             $sql = $target . ' = ""';
             break;
         case 'alpha':
             $sql = $target . ' LIKE ' . JCckDatabase::quote(JCckDatabase::escape($value, true) . '%', false);
             break;
         case 'zeta':
             /* Zeta is not the last letter of Greek alphabet but.. this won't be an issue here. */
             $sql = $target . ' LIKE ' . JCckDatabase::quote('%' . JCckDatabase::escape($value, true), false);
             break;
         case 'any':
             $separator = $field->match_value ? $field->match_value : ' ';
             $values = explode($separator, $value);
             if (count($values)) {
                 $fragments = array();
                 foreach ($values as $v) {
                     if (strlen($v) > 0) {
                         $fragments[] = $target . ' LIKE ' . JCckDatabase::quote('%' . JCckDatabase::escape($v, true) . '%', false);
                     }
                 }
                 if (count($fragments)) {
                     $sql = '((' . implode(') OR (', $fragments) . '))';
                 }
             }
             break;
         case 'any_exact':
             $separator = $field->match_value ? $field->match_value : ' ';
             $values = explode($separator, $value);
             if (count($values)) {
                 $fragments = array();
                 $var_type = $field->match_options ? $field->match_options->get('var_type', 1) : 1;
                 if (!$var_type) {
                     foreach ($values as $v) {
                         if (strlen($v) > 0) {
                             $fragments[] = $v;
                         }
                     }
                 } else {
                     foreach ($values as $v) {
                         if (strlen($v) > 0) {
                             $fragments[] = JCckDatabase::quote($v);
                         }
                     }
                 }
                 if (count($fragments)) {
                     $sql = $target . ' IN (' . implode(',', $fragments) . ')';
                 }
             }
             break;
         case 'each':
         case 'each_exact':
             $separator = $field->match_value ? $field->match_value : ' ';
             $values = explode($separator, $value);
             if (count($values)) {
                 $fragments = array();
                 if ($match == 'each_exact') {
                     foreach ($values as $v) {
                         if (strlen($v) > 0) {
                             $fragments[] = $target . ' = ' . JCckDatabase::quote($v) . ' OR ' . $target . ' LIKE ' . JCckDatabase::quote(JCckDatabase::escape($v, true) . $separator . '%', false) . ' OR ' . $target . ' LIKE ' . JCckDatabase::quote('%' . $separator . JCckDatabase::escape($v, true) . $separator . '%', false) . ' OR ' . $target . ' LIKE ' . JCckDatabase::quote('%' . $separator . JCckDatabase::escape($v, true), false);
                         }
                     }
                 } else {
                     foreach ($values as $v) {
                         if (strlen($v) > 0) {
                             $fragments[] = $target . ' LIKE ' . JCckDatabase::quote('%' . JCckDatabase::escape($v, true) . '%', false);
                         }
                     }
                 }
                 if (count($fragments)) {
                     $sql = '((' . implode(') AND (', $fragments) . '))';
                 }
             }
             break;
         case 'date_past_only':
             $sql = $target . ' < ' . JCckDatabase::quote($value);
             break;
         case 'date_past':
             $sql = $target . ' <= ' . JCckDatabase::quote($value);
             break;
         case 'date_future':
             $sql = $target . ' >= ' . JCckDatabase::quote($value);
             break;
         case 'date_future_only':
             $sql = $target . ' > ' . JCckDatabase::quote($value);
             break;
         case 'nested_exact':
             $table = $field->match_options ? $field->match_options->get('table', $field->storage_table) : $field->storage_table;
             $column = 'id';
             $values = JCckDevHelper::getBranch($table, $value);
             if ($column != 'id') {
                 if (count($values)) {
                     $fragments = array();
                     foreach ($values as $v) {
                         if ($v != '') {
                             $fragments[] = JCckDatabase::quote($v);
                         }
                     }
                     if (count($fragments)) {
                         $sql = $target . ' IN (' . implode(',', $fragments) . ')';
                     }
                 }
             } else {
                 if (count($values)) {
                     $sql = $target . ' IN (' . implode(',', $values) . ')';
                 }
             }
             break;
         case 'num_higher':
             $sql = $target . ' >= ' . JCckDatabase::quote($value);
             break;
         case 'num_higher_only':
             $sql = $target . ' > ' . JCckDatabase::quote($value);
             break;
         case 'num_lower':
             $sql = $target . ' <= ' . JCckDatabase::quote($value);
             break;
         case 'num_lower_only':
             $sql = $target . ' < ' . JCckDatabase::quote($value);
             break;
         case 'not_alpha':
             $sql = $target . ' NOT LIKE ' . JCckDatabase::quote(JCckDatabase::escape($value, true) . '%', false);
             break;
         case 'not_any_exact':
             $separator = $field->match_value ? $field->match_value : ' ';
             $values = explode($separator, $value);
             if (count($values)) {
                 $fragments = array();
                 foreach ($values as $v) {
                     if (strlen($v) > 0) {
                         $fragments[] = JCckDatabase::quote($v);
                     }
                 }
                 if (count($fragments)) {
                     $sql = $target . ' NOT IN (' . implode(',', $fragments) . ')';
                 }
             }
             break;
         case 'not_zeta':
             /* Zeta is not the last letter of Greek alphabet but.. this won't be an issue here. */
             $sql = $target . ' NOT LIKE ' . JCckDatabase::quote('%' . JCckDatabase::escape($value, true), false);
             break;
         case 'not_empty':
             $sql = $target . ' != ""';
             break;
         case 'not_equal':
             $sql = $target . ' != ' . JCckDatabase::quote($value);
             break;
         case 'not_like':
             $sql = $target . ' NOT LIKE ' . JCckDatabase::quote('%' . JCckDatabase::escape($value, true) . '%', false);
             break;
         case 'not_null':
             $sql = $target . ' != "0"';
             break;
         case 'is_null':
             $sql = $target . ' IS NULL';
             break;
         case 'is_not_null':
             $sql = $target . ' IS NOT NULL';
             break;
         case 'radius_higher':
         case 'radius_lower':
             $t = explode('.', $target);
             $f_lat = $field->match_options->get('fieldname1', '');
             $f_lng = $field->match_options->get('fieldname2', '');
             $f_rad = $field->match_options->get('fieldname3', '');
             $lat = isset($fields[$f_lat]) ? $fields[$f_lat]->value : '';
             $lng = isset($fields[$f_lng]) ? $fields[$f_lng]->value : '';
             $s_lat = isset($fields[$f_lat]->storage_field) && $fields[$f_lat]->storage_field ? $fields[$f_lat]->storage_field : $f_lat;
             $s_lng = isset($fields[$f_lng]->storage_field) && $fields[$f_lng]->storage_field ? $fields[$f_lng]->storage_field : $f_lng;
             if ($lat != '' && $lng != '') {
                 $alias = 'distance';
                 $mod = $field->match_options->get('var_unit', '1') ? '' : '*1.609344';
                 $radius = isset($fields[$f_rad]) ? $fields[$f_rad]->value : '';
                 $sign = $match == 'radius_higher' ? '>' : '<';
                 $config['query_parts']['select'][] = '(((acos(sin((' . (double) $lat . '*pi()/180)) * sin((' . $t[0] . '.' . $s_lat . '*pi()/180))+cos((' . (double) $lat . '*pi()/180)) * cos((' . $t[0] . '.' . $s_lat . '*pi()/180)) * cos(((' . (double) $lng . '- ' . $t[0] . '.' . $s_lng . ')*pi()/180))))*180/pi())*60*1.1515' . $mod . ') AS ' . $alias;
                 if ((int) $radius > 0) {
                     $config['query_parts']['having'][] = $alias . ' ' . $sign . ' ' . $radius;
                     $sql = '()';
                     // todo
                 } else {
                     $lat = number_format($lat, 8);
                     $lng = number_format($lng, 8);
                     $sql = '(' . $t[0] . '.' . $s_lat . ' = ' . JCckDatabase::quote($lat) . ' AND ' . $t[0] . '.' . $s_lng . ' = ' . JCckDatabase::quote($lng) . ')';
                 }
             } else {
                 $sql = '()';
                 // todo
             }
             break;
         case 'none':
             return;
             break;
         default:
             $sql = $target . ' LIKE ' . JCckDatabase::quote('%' . JCckDatabase::escape($value, true) . '%', false);
             break;
     }
     return $sql;
 }
Example #21
0
            } else {
                //FieldX
                $search = '::' . $true_name . '|' . $x2k . '|' . $parent_name . '::' . '{"image_location":"' . $old_path . $file_name . '","image_title":"' . $file_title . '","image_description":"' . $file_descr . '"}' . '::/' . $true_name . '|' . $x2k . '|' . $parent_name . '::';
                $replace = '::' . $true_name . '|' . $x2k . '|' . $parent_name . '::' . '{"image_location":"' . $file_location . '","image_title":"' . $file_title . '","image_description":"' . $file_descr . '"}' . '::/' . $true_name . '|' . $x2k . '|' . $parent_name . '::';
            }
        } else {
            $search_v = '{"image_location":"' . $old_path . $file_name . '","image_title":"' . $file_title . '","image_description":"' . $file_descr . '"}';
            $replace_v = '{"image_location":"' . $file_location . '","image_title":"' . $file_title . '","image_description":"' . $file_descr . '"}';
        }
    }
    $doSave = 1;
} else {
    $file_location = $file_path . $file_name;
    $location = JPATH_SITE . '/' . $file_path . $file_name;
}
JCckDevHelper::createFolder(JPATH_SITE . '/' . $file_path, $permissions);
if (JFile::upload($tmp_name, $location)) {
    $thumb_count = 11;
    $image = new JCckDevImage($location);
    $src_w = $image->getWidth();
    $src_h = $image->getHeight();
    $value = $file_location;
    $fields[$name]->value = $value;
    $options['thumb0_process'] = $options['image_process'];
    $options['thumb0_width'] = $options['image_width'];
    $options['thumb0_height'] = $options['image_height'];
    for ($i = 0; $i < $thumb_count; $i++) {
        $format_name = 'thumb' . $i . '_process';
        $width_name = 'thumb' . $i . '_width';
        $height_name = 'thumb' . $i . '_height';
        if ($i == 0 && $src_w == $options[$width_name] && $src_h == $optixons[$height_name]) {
Example #22
0
 public static function getForms($url = '', &$type = '', $grouping = '')
 {
     $app = JFactory::getApplication();
     $items = array();
     if (is_object($url)) {
         $option = $url->get('option', '');
         $view = $url->get('view', '');
     } elseif ($url != 'none') {
         $option = $app->input->get('option', '');
         $view = $app->input->get('view', '');
     } else {
         $option = '';
     }
     $in = '';
     $where = '';
     if ($option) {
         $where = 'WHERE a.component = "' . $option . '"';
         if ($view) {
             $where .= ' AND ( a.view = "' . $view . '" OR a.view = "" )';
         }
     }
     $locations = JCckDatabase::loadObjectList('SELECT a.name, a.vars FROM #__cck_core_objects AS a ' . $where);
     if (count($locations)) {
         $state = true;
         foreach ($locations as $location) {
             if ($location->vars) {
                 $state = JCckDevHelper::matchUrlVars($location->vars, $url);
             }
             if ($state !== false) {
                 $in .= '"' . $location->name . '",';
             }
         }
     }
     if ($in) {
         $type = substr($in, 1, -2);
         $in .= '""';
         if ($grouping == 'folder') {
             $call = 'loadObjectListArray';
             $index = 'folder_id';
             $order_by = ' ORDER BY folder ASC, title ASC';
         } else {
             $call = 'loadObjectList';
             $index = NULL;
             $order_by = ' ORDER BY title';
         }
         $items = JCckDatabase::$call('SELECT a.id, a.title, a.name, a.description, b.id as folder_id, b.title as folder, b.app as folder_app, b.icon_path as folder_icon' . ' FROM #__cck_core_types AS a' . ' LEFT JOIN #__cck_core_folders AS b ON b.id = a.folder' . ' WHERE a.published = 1 AND a.location != "none" AND a.location != "site"' . ' AND a.storage_location IN (' . $in . ')' . $order_by, $index);
     }
     return $items;
 }
 public function export()
 {
     $app = JFactory::getApplication();
     $type = $app->input->getString('extension', 'plugin');
     $model = $this->getModel();
     if ($type == 'languages') {
         $lang_tag = $app->input->getString('lang_tag', 'en-GB');
         if ($file = $model->prepareLanguages($lang_tag)) {
             $file = JCckDevHelper::getRelativePath($file, false);
             $this->setRedirect(JUri::base() . 'index.php?option=com_cck&task=download&file=' . $file);
         }
     } else {
         $id = $app->input->getInt('extension_id', 0);
         if ($file = $model->prepareExport($id)) {
             $file = JCckDevHelper::getRelativePath($file, false);
             $this->setRedirect(JUri::base() . 'index.php?option=com_cck&task=download&file=' . $file);
         } else {
             switch ($type) {
                 case 'plugin':
                 default:
                     $link = 'index.php?option=com_' . $type . 's&view=' . $type . '&layout=edit&extension_id=' . $id;
                     break;
             }
             $this->setRedirect($link, 'Plugin not found. Try to download it manually.', 'notice');
         }
     }
 }
Example #24
0
        } else {
            if ($field->live) {
                $dispatcher->trigger('onCCK_Field_LivePrepareForm', array(&$field, &$value, &$config));
                if (!($field->variation == 'hidden_auto' || $field->variation == 'hidden_isfilled')) {
                    JCckDevHelper::secureField($field, $value);
                }
            } else {
                $value = isset($lives[$name]) ? $lives[$name] : $field->live_value;
            }
        }
    }
    $field->value = $value;
    if ($field->variation == 'hidden_isfilled') {
        if ($value != '') {
            $field->variation = 'hidden';
            JCckDevHelper::secureField($field, $value);
        } else {
            $field->variation = '';
        }
    }
    $dispatcher->trigger('onCCK_FieldPrepareForm', array(&$field, $value, &$config, array()));
    $position = $field->position;
    $positions[$position][] = $field->name;
    // Was it the last one?
    if ($config['error']) {
        break;
    }
}
// Merge
if (count($config['fields'])) {
    $fields = array_merge($fields, $config['fields']);
Example #25
0
 protected function prepareDisplay($preconfig)
 {
     $app = JFactory::getApplication();
     $config = JFactory::getConfig();
     $this->option = $app->input->get('option', '');
     $this->state = $this->get('State');
     $option = $this->option;
     $params = $app->getParams();
     $view = $this->getName();
     $limitstart = $this->state->get('limitstart');
     $live = urldecode($params->get('live'));
     $variation = $params->get('variation');
     if ($params->get('show_list', '') != '') {
         $preconfig['show_list'] = (int) $params->get('show_list');
     }
     $preconfig['search2'] = $params->get('search2');
     $preconfig['show_form'] = $params->get('show_form', '');
     $preconfig['auto_redirect'] = $params->get('auto_redirect', '');
     $preconfig['auto_redirect_vars'] = $params->get('auto_redirect_vars', '');
     $preconfig['limit2'] = $params->get('limit2', 0);
     $preconfig['limitend'] = $params->get('pagination2', '');
     $preconfig['ordering'] = $params->get('ordering', '');
     $preconfig['ordering2'] = $params->get('ordering2', '');
     // Page
     $menus = $app->getMenu();
     $menu = $menus->getActive();
     $home = isset($menu->home) && $menu->home ? true : false;
     if (is_object($menu)) {
         $menu_params = new JRegistry();
         $menu_params->loadString($menu->params);
         if (!$menu_params->get('page_title')) {
             $params->set('page_title', $menu->title);
         }
     } else {
         $params->set('page_title', 'List');
     }
     $title = $params->get('page_title');
     if (empty($title)) {
         $title = $config->get('sitename');
     } elseif ($config->get('sitename_pagetitles', 0) == 1) {
         $title = JText::sprintf('JPAGETITLE', $config->get('sitename'), $title);
     } elseif ($config->get('sitename_pagetitles', 0) == 2) {
         $title = JText::sprintf('JPAGETITLE', $title, $config->get('sitename'));
     }
     $config = NULL;
     $this->document->setTitle($title);
     if ($params->get('menu-meta_description')) {
         $this->document->setDescription($params->get('menu-meta_description'));
     }
     if ($params->get('menu-meta_keywords')) {
         $this->document->setMetadata('keywords', $params->get('menu-meta_keywords'));
     }
     if ($params->get('robots')) {
         $this->document->setMetadata('robots', $params->get('robots'));
     }
     $this->pageclass_sfx = htmlspecialchars($params->get('pageclass_sfx'));
     $this->raw_rendering = $params->get('raw_rendering', 0);
     // Pagination
     $pagination = $params->get('show_pagination');
     // Prepare
     jimport('cck.base.list.list');
     include JPATH_LIBRARIES_CCK . '/base/list/list_inc.php';
     $pagination = $this->getModel()->_getPagination($total_items);
     // Set
     if (!is_object(@$options)) {
         $options = new JRegistry();
     }
     $this->show_form = $preconfig['show_form'];
     $this->show_list_title = $params->get('show_list_title');
     if ($this->show_list_title == '') {
         $this->show_list_title = $options->get('show_list_title', '1');
         $this->tag_list_title = $options->get('tag_list_title', 'h2');
         $this->class_list_title = $options->get('class_list_title');
     } elseif ($this->show_list_title) {
         $this->tag_list_title = $params->get('tag_list_title', 'h2');
         $this->class_list_title = $params->get('class_list_title');
     }
     if ($params->get('display_list_title', '') == '1') {
         $this->title = $params->get('title_list_title', '');
     } elseif ($params->get('display_list_title', '') == '0') {
         $this->title = $menu->title;
     } else {
         $this->title = @$search->title;
     }
     $this->show_list_desc = $params->get('show_list_desc');
     if ($this->show_list_desc == '') {
         $this->show_list_desc = $options->get('show_list_desc', '1');
         $this->description = @$search->description;
     } elseif ($this->show_list_desc) {
         $this->description = $params->get('list_desc', @$search->description);
     } else {
         $this->description = '';
     }
     if (!$total_items && !$options->get('show_list_desc_no_result', '1')) {
         $this->show_list_desc = 0;
         $this->description = '';
     }
     if ($this->description != '') {
         $this->description = str_replace('[title]', $menu->title, $this->description);
         $this->description = str_replace('[note]', $menu->note, $this->description);
         $this->description = str_replace('$cck->get', '$cck-&gt;get', $this->description);
         $this->description = JCckDevHelper::replaceLive($this->description);
         if (strpos($this->description, '$cck-&gt;get') !== false) {
             $matches = '';
             $regex = '#\\$cck\\-\\&gt;get([a-zA-Z0-9_]*)\\( ?\'([a-zA-Z0-9_]*)\' ?\\)(;)?#';
             preg_match_all($regex, $this->description, $matches);
             if (count($matches[1])) {
                 foreach ($matches[1] as $k => $v) {
                     $fieldname = $matches[2][$k];
                     $target = strtolower($v);
                     if (count(@$doc->list)) {
                         $this->description = str_replace($matches[0][$k], current($doc->list)->fields[$fieldname]->{$target}, $this->description);
                     } else {
                         $this->description = str_replace($matches[0][$k], '', $this->description);
                     }
                 }
             }
         }
     }
     $this->show_items_number = $params->get('show_items_number');
     if ($this->show_items_number == '') {
         $this->show_items_number = $options->get('show_items_number', 0);
         $this->label_items_number = $options->get('label_items_number', 'Results');
         $this->class_items_number = $options->get('class_items_number', 'total');
     } elseif ($this->show_items_number) {
         $this->label_items_number = $params->get('show_items_number_label', 'Results');
         $this->class_items_number = $params->get('class_items_number', 'total');
     }
     $this->show_pages_number = $params->get('show_pages_number', $options->get('show_pages_number', 1));
     $this->show_pagination = $params->get('show_pagination');
     $this->class_pagination = $params->get('class_pagination', 'pagination');
     if ($this->show_pagination == '') {
         $this->show_pagination = $options->get('show_pagination', 0);
         $this->class_pagination = $options->get('class_pagination', 'pagination');
         $this->callback_pagination = $options->get('callback_pagination', '');
     } else {
         $this->callback_pagination = '';
     }
     if ($app->input->get('tmpl') == 'raw') {
         $params->set('show_page_heading', 0);
     }
     $this->config =& $config;
     $this->data =& $data;
     $this->form =& $form;
     $this->home =& $home;
     $this->items =& $items;
     $this->limitend = $config['limitend'];
     $this->pagination =& $pagination;
     $this->params =& $params;
     $this->search =& $search;
     $this->total =& $total_items;
 }
Example #26
0
$layer = $app->input->getCmd('quicklayout', 'icon');
$lang = JFactory::getLanguage();
$market = 'http://www.seblod.com/download.html?tmpl=component';
$opts = 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=685,height=600';
$quickadd = $app->input->getInt('quickadd', 0);
$type = '';
$variables = base64_decode($app->input->getBase64('variables'));
$return = base64_decode($app->input->getBase64('return'));
$user = JFactory::getUser();
if ($quickadd) {
    $legacy = 0;
    $url = 'none';
    $items = $layer == 'list' ? JCckDevIntegration::getForms($url, $type, 'folder') : JCckDevIntegration::getForms($url, $type);
} else {
    $legacy = 2;
    $url = JCckDevHelper::getUrlVars($return);
    $layer = JCck::getConfig_Param('integration_layout', 'icon');
    $items = $layer == 'list' ? JCckDevIntegration::getForms($url, $type, 'folder') : JCckDevIntegration::getForms($url, $type);
    if (strpos($type, ',') === false) {
        $options = JCckDatabase::loadResult('SELECT a.options FROM #__cck_core_objects AS a WHERE a.name = "' . $type . '"');
        $options = new JRegistry($options);
        $legacy = $options->get('add_alt', 2);
    }
}
if ($legacy == 1) {
    $legend = JText::sprintf('LIB_CCK_INTEGRATION_MODAL_BOX_LEGEND', '<a id="standard-content" href="javascript:void(0);" style="color:#808080">' . JString::strtolower(JText::_('LIB_CCK_INTEGRATION_CLICK_HERE')) . '</a>', '<span style="color:#808080">' . JString::strtolower(JText::_('LIB_CCK_INTEGRATION_SELECT_A_FORM')) . '</span>');
    $legend2 = '';
} elseif ($legacy == 2) {
    $legend = JText::_('LIB_CCK_INTEGRATION_SELECT_A_FORM');
    $legend2 = JText::sprintf('LIB_CCK_INTEGRATION_MODAL_BOX_LEGEND2', '<a id="standard-content" href="javascript:void(0);" style="color:#808080">' . JString::strtolower(JText::_('LIB_CCK_INTEGRATION_CLICK_HERE')) . '</a>');
} else {
Example #27
0
 public static function rewriteBuffer($buffer, $data, $list, $list_assoc = array())
 {
     $app = JFactory::getApplication();
     $class = JCck::on('3.4') ? ' class="hasTooltip"' : '';
     $idx = 0;
     $idx2 = 2;
     $idx3 = 3;
     $items = array();
     $list2 = array();
     $multilanguage = 0;
     if (JCckDevHelper::hasLanguageAssociations()) {
         $multilanguage = isset($data['multilanguage']) && $data['multilanguage'] ? 1 : 0;
     }
     $pks = '';
     $return = $data['return_view'] ? '&return_o=' . $data['return_option'] . '&return_v=' . $data['return_view'] : '&return_o=' . $data['return_option'];
     preg_match_all($data['search'], $buffer, $matches);
     if (strpos($data['search'], '>') !== false) {
         $isComplete = true;
         $markup_end = '';
     } else {
         $isComplete = false;
         $markup_end = '>';
     }
     $opt_default_type = $data['options']->get('default_type', '');
     $opt_edit_alt = $data['options']->get('edit_alt', 1);
     if (count($matches[$idx2])) {
         if ($data['options']->get('edit', 0) == 1) {
             $i = 0;
             foreach ($matches[$idx2] as $k => $m) {
                 $type = @$list[$m]->cck;
                 $type = $type ? '&type=' . $type : '&type=' . $opt_default_type;
                 $search = $matches[$idx][$k];
                 $list2[$m] = array('link' => 'index.php?option=com_cck&amp;view=form' . $return . $type . '&id=' . $m . $data['replace_end']);
                 $replace = '<a' . $class . ' href="' . $list2[$m]['link'];
                 if ($isComplete) {
                     $replace .= ' ' . $matches[$idx3][$k] . '>';
                 }
                 $buffer = str_replace($search, $replace, $buffer);
                 $items[$i] = $matches[$idx][$k];
                 $i++;
             }
         } else {
             $i = 0;
             foreach ($matches[$idx2] as $k => $m) {
                 if (isset($list[$m]->cck)) {
                     $type = $list[$m]->cck;
                     $type = $type ? '&type=' . $type : '&type=' . $opt_default_type;
                     $search = $matches[$idx][$k];
                     $list2[$m] = array('link' => 'index.php?option=com_cck&amp;view=form' . $return . $type . '&id=' . $m . $data['replace_end']);
                     $replace = '<a' . $class . ' href="' . $list2[$m]['link'];
                     if ($isComplete) {
                         $replace .= ' ' . $matches[$idx3][$k] . '>';
                     }
                     $buffer = str_replace($search, $replace, $buffer);
                     $items[$i] = $matches[$idx][$k];
                     $i++;
                 }
             }
         }
     }
     if (JCck::on()) {
         if ($data['search_alt']) {
             $search = $data['search_alt'];
             preg_match_all($search, $buffer, $matches2);
             if (count($matches2[0])) {
                 if ($multilanguage) {
                     $languages = JLanguageHelper::getLanguages('lang_code');
                 }
                 foreach ($matches2[0] as $k => $m) {
                     $pk = $matches[$idx2][$k];
                     $pre = '';
                     $row = $matches2[0][$k];
                     $search = '';
                     $t_add = '';
                     $t_edit = '';
                     if (isset($matches[$idx][$k])) {
                         if ($opt_edit_alt) {
                             if (isset($list2[$pk])) {
                                 $text = '<span class="icon-pencil"></span> ' . JText::_('JTOOLBAR_EDIT') . ' (' . JText::_('LIB_CCK_LEGACY') . ')';
                                 $pre = $matches[$idx][$k] . $markup_end . $text . '</a></li>';
                             } else {
                                 $link = 'index.php?option=com_cck&amp;view=form' . $return . '&type=' . $opt_default_type . '&id=' . $pk . $data['replace_end'];
                                 $text = '<span class="icon-pencil"></span> ' . JText::_('JTOOLBAR_EDIT') . ' (' . JText::_('LIB_CCK_SEBLOD') . ')';
                                 $pre = '<a href="' . $link . '">' . $text . '</a></li>';
                             }
                         }
                         if ($multilanguage) {
                             if (isset($list[$pk]) && $list[$pk]->key) {
                                 $cur = $list[$pk]->language;
                                 $key = $list[$pk]->key;
                                 $link = 'index.php?option=com_cck&amp;view=form' . $return . '&type=' . $list[$pk]->cck;
                                 foreach ($languages as $l => $v) {
                                     if ($cur != $l) {
                                         if (isset($list_assoc[$key][$l])) {
                                             $link2 = $link . '&amp;id=' . $list_assoc[$key][$l]->id . $data['replace_end'];
                                             $t_edit .= '<li><a href="' . $link2 . '&plop=1"><span class="icon-arrow-right-3"> ' . $l . '</a></li>';
                                         } else {
                                             $link2 = $link . '&amp;translate=' . $l . '&amp;translate_id=' . $pk . $data['replace_end'];
                                             $t_add .= '<li><a href="' . $link2 . '"><span class="icon-arrow-right-3"> ' . $l . '</a></li>';
                                         }
                                     }
                                 }
                                 if ($t_edit || $t_add) {
                                     $pre .= '<li class="divider"></li>';
                                     if ($t_edit) {
                                         $pre .= '<li><a href="javascript:void(0);"><span class="icon-comments-2"></span> ' . JText::_('LIB_CCK_TRANSLATE_EDIT') . '</a></li>' . $t_edit;
                                     }
                                     if ($t_add) {
                                         $pre .= '<li><a href="javascript:void(0);"><span class="icon-comments-2"></span> ' . JText::_('LIB_CCK_TRANSLATE') . '</a></li>' . $t_add;
                                     }
                                 }
                             }
                         }
                         if ($pre != '') {
                             $pre .= '<li class="divider"></li>';
                             $buffer = str_replace($row, $pre . '<li>' . $row, $buffer);
                         }
                     }
                 }
             }
         }
     } elseif ($data['options']->get('edit_alt', 1)) {
         $search = '#<a href="index.php\\?option=com_cck&amp;view=form(.*):(.*)([a-z\\-0-9]*)\\)(.*)</p>#sU';
         preg_match_all($search, $buffer, $matches2);
         if (count($matches2[3])) {
             foreach ($matches2[3] as $k => $m) {
                 if (isset($matches[$idx][$k])) {
                     $search = ': ' . $matches2[3][$k] . ')';
                     $replace = ': ' . $items[$k] . ' style="color: #888888;">' . $m . '</a>)';
                     $matches0 = str_replace($search, $replace, $matches2[0][$k]);
                     $buffer = str_replace($matches2[0][$k], $matches0, $buffer);
                 }
             }
         }
     }
     return $buffer;
 }
 public static function onCCK_StoragePrepareSearch(&$field, $match, $value, $name, $name2, $target)
 {
     $sql = '';
     switch ($match) {
         case 'exact':
             $sql = $target . ' = ' . JCckDatabase::quote($value);
             break;
         case 'alpha':
             $sql = $target . ' LIKE ' . JCckDatabase::quote(JCckDatabase::escape($value, true) . '%', false);
             break;
         case 'zeta':
             /* Zeta is not the last letter of Greek alphabet but.. this won't be an issue here. */
             $sql = $target . ' LIKE ' . JCckDatabase::quote('%' . JCckDatabase::escape($value, true), false);
             break;
         case 'any':
             $separator = $field->match_value ? $field->match_value : ' ';
             $values = explode($separator, $value);
             if (count($values)) {
                 $fragments = array();
                 foreach ($values as $v) {
                     if (strlen($v) > 0) {
                         $fragments[] = $target . ' LIKE ' . JCckDatabase::quote('%' . JCckDatabase::escape($v, true) . '%', false);
                     }
                 }
                 if (count($fragments)) {
                     $sql = '((' . implode(') OR (', $fragments) . '))';
                 }
             }
             break;
         case 'any_exact':
             $separator = $field->match_value ? $field->match_value : ' ';
             $values = explode($separator, $value);
             if (count($values)) {
                 $fragments = array();
                 $var_type = $field->match_options ? $field->match_options->get('var_type', 1) : 1;
                 if (!$var_type) {
                     foreach ($values as $v) {
                         if (strlen($v) > 0) {
                             $fragments[] = $v;
                         }
                     }
                 } else {
                     foreach ($values as $v) {
                         if (strlen($v) > 0) {
                             $fragments[] = JCckDatabase::quote($v);
                         }
                     }
                 }
                 if (count($fragments)) {
                     $sql = $target . ' IN (' . implode(',', $fragments) . ')';
                 }
             }
             break;
         case 'each':
             $separator = $field->match_value ? $field->match_value : ' ';
             $values = explode($separator, $value);
             if (count($values)) {
                 $fragments = array();
                 foreach ($values as $v) {
                     if (strlen($v) > 0) {
                         $fragments[] = $target . ' LIKE ' . JCckDatabase::quote('%' . JCckDatabase::escape($v, true) . '%', false);
                     }
                 }
                 if (count($fragments)) {
                     $sql = '((' . implode(') AND (', $fragments) . '))';
                 }
             }
             break;
         case 'date_past_only':
             $sql = $target . ' < ' . JCckDatabase::quote($value);
             break;
         case 'date_past':
             $sql = $target . ' <= ' . JCckDatabase::quote($value);
             break;
         case 'date_future':
             $sql = $target . ' >= ' . JCckDatabase::quote($value);
             break;
         case 'date_future_only':
             $sql = $target . ' > ' . JCckDatabase::quote($value);
             break;
         case 'nested_exact':
             $table = $field->match_options ? $field->match_options->get('table', $field->storage_table) : $field->storage_table;
             $column = 'id';
             $values = JCckDevHelper::getBranch($table, $value);
             if ($column != 'id') {
                 if (count($values)) {
                     $fragments = array();
                     foreach ($values as $v) {
                         if ($v != '') {
                             $fragments[] = JCckDatabase::quote($v);
                         }
                     }
                     if (count($fragments)) {
                         $sql = $target . ' IN (' . implode(',', $fragments) . ')';
                     }
                 }
             } else {
                 if (count($values)) {
                     $sql = $target . ' IN (' . implode(',', $values) . ')';
                 }
             }
             break;
         case 'num_higher':
             $sql = $target . ' >= ' . JCckDatabase::quote($value);
             break;
         case 'num_higher_only':
             $sql = $target . ' > ' . JCckDatabase::quote($value);
             break;
         case 'num_lower':
             $sql = $target . ' <= ' . JCckDatabase::quote($value);
             break;
         case 'num_lower_only':
             $sql = $target . ' < ' . JCckDatabase::quote($value);
             break;
         case 'not_alpha':
             $sql = $target . ' NOT LIKE ' . JCckDatabase::quote(JCckDatabase::escape($value, true) . '%', false);
             break;
         case 'not_any_exact':
             $separator = $field->match_value ? $field->match_value : ' ';
             $values = explode($separator, $value);
             if (count($values)) {
                 $fragments = array();
                 foreach ($values as $v) {
                     if (strlen($v) > 0) {
                         $fragments[] = JCckDatabase::quote($v);
                     }
                 }
                 if (count($fragments)) {
                     $sql = $target . ' NOT IN (' . implode(',', $fragments) . ')';
                 }
             }
             break;
         case 'not_zeta':
             /* Zeta is not the last letter of Greek alphabet but.. this won't be an issue here. */
             $sql = $target . ' NOT LIKE ' . JCckDatabase::quote('%' . JCckDatabase::escape($value, true), false);
             break;
         case 'not_empty':
             $sql = $target . ' != ""';
             break;
         case 'not_equal':
             $sql = $target . ' != ' . JCckDatabase::quote($value);
             break;
         case 'not_like':
             $sql = $target . ' NOT LIKE ' . JCckDatabase::quote('%' . JCckDatabase::escape($value, true) . '%', false);
             break;
         case 'not_null':
             $sql = $target . ' != "0"';
             break;
         case 'is_null':
             $sql = $target . ' IS NULL';
             break;
         case 'is_not_null':
             $sql = $target . ' IS NOT NULL';
             break;
         case 'none':
             return;
             break;
         default:
             $sql = $target . ' LIKE ' . JCckDatabase::quote('%' . JCckDatabase::escape($value, true) . '%', false);
             break;
     }
     return $sql;
 }
Example #29
0
 protected static function _getOptionsList($options2, $free_sql, $lang_code, $static = false)
 {
     $options = '';
     if ($free_sql == 0) {
         $opt_table = isset($options2['table']) ? ' FROM ' . $options2['table'] : '';
         $opt_name = isset($options2['name']) ? $options2['name'] : '';
         $opt_value = isset($options2['value']) ? $options2['value'] : '';
         $opt_where = @$options2['where'] != '' ? ' WHERE ' . $options2['where'] : '';
         $opt_orderby = @$options2['orderby'] != '' ? ' ORDER BY ' . $options2['orderby'] . ' ' . (@$options2['orderby_direction'] != '' ? $options2['orderby_direction'] : 'ASC') : '';
         // Language Detection
         $opt_value = str_replace('[lang]', $lang_code, $opt_value);
         $opt_name = str_replace('[lang]', $lang_code, $opt_name);
         $opt_where = str_replace('[lang]', $lang_code, $opt_where);
         $opt_orderby = str_replace('[lang]', $lang_code, $opt_orderby);
         if ($opt_name && $opt_table) {
             $query = 'SELECT ' . $opt_name . ',' . $opt_value . $opt_table . $opt_where . $opt_orderby;
             $query = JCckDevHelper::replaceLive($query);
             $lists = $static ? JCckDatabaseCache::loadObjectList($query) : JCckDatabase::loadObjectList($query);
             if (count($lists)) {
                 foreach ($lists as $list) {
                     $options .= $list->{$opt_name} . '=' . $list->{$opt_value} . '||';
                 }
             }
         }
     } else {
         $opt_query = isset($options2['query']) ? $options2['query'] : '';
         // Language Detection
         $opt_query = str_replace('[lang]', $lang_code, $opt_query);
         $opt_query = JCckDevHelper::replaceLive($opt_query);
         $lists = $static ? JCckDatabaseCache::loadObjectList($opt_query) : JCckDatabase::loadObjectList($opt_query);
         if (count($lists)) {
             foreach ($lists as $list) {
                 $options .= @$list->text . '=' . @$list->value . '||';
             }
         }
     }
     return $options;
 }
Example #30
0
 public static function onCCK_StoragePrepareSearch(&$field, $match, $value, $name, $name2, $target)
 {
     $sql = '';
     $TA = '(::' . $name . $name2 . '::)';
     $TZ = '(::/' . $name . $name2 . '::)';
     //if ( !empty( $field->match_target ) && $field->match_target != '~' ) {
     //	$target	=	self::_getTarget( $name, $field->match_target );
     //	$TA		=	'';
     //	$TZ		=	'';
     //}
     switch ($match) {
         case 'exact':
             $sql = !$TA ? $target . ' = "' . $TA . $value . $TZ . '"' : $target . ' REGEXP "' . $TA . $value . $TZ . '"';
             break;
         case 'empty':
             $sql = $target . ' REGEXP "' . $TA . $TZ . '"';
             break;
         case 'alpha':
             $sql = $target . ' REGEXP "' . $TA . $value . '.*' . $TZ . '"';
             break;
         case 'zeta':
             /* Zeta is not the last letter of Greek alphabet but.. this won't be an issue here. */
             $sql = $target . ' REGEXP "' . $TA . '.*' . $value . $TZ . '"';
             break;
         case 'any':
             $separator = $field->match_value ? $field->match_value : ' ';
             $values = explode($separator, $value);
             if (count($values)) {
                 $fragments = array();
                 foreach ($values as $v) {
                     if (strlen($v) > 0) {
                         $fragments[] = $target . ' REGEXP "' . $TA . '.*' . $v . '.*' . $TZ . '"';
                     }
                 }
                 if (count($fragments)) {
                     $sql = '((' . implode(') OR (', $fragments) . '))';
                 }
             }
             break;
         case 'any_exact':
             $separator = $field->match_value ? $field->match_value : ' ';
             $values = explode($separator, $value);
             if (count($values)) {
                 $fragments = array();
                 foreach ($values as $v) {
                     if (strlen($v) > 0) {
                         $fragments[] = !$TA ? $target . ' = "' . $TA . $v . $TZ . '"' : $target . ' REGEXP "' . $TA . $v . $TZ . '"';
                     }
                 }
                 if (count($fragments)) {
                     $sql = '((' . implode(') OR (', $fragments) . '))';
                 }
             }
             break;
         case 'each':
         case 'each_exact':
             $separator = $field->match_value ? $field->match_value : ' ';
             $values = explode($separator, $value);
             if (count($values)) {
                 $fragments = array();
                 if ($match == 'each_exact') {
                     foreach ($values as $v) {
                         if (strlen($v) > 0) {
                             $fragments[] = (!$TA ? $target . ' = "' . $TA . $v . $TZ . '"' : $target . ' REGEXP "' . $TA . $v . $TZ . '"') . $target . ' REGEXP "' . $TA . $v . $separator . '.*' . $TZ . '"' . $target . ' REGEXP "' . $TA . '.*' . $separator . $v . $separator . '.*' . $TZ . '"' . $target . ' REGEXP "' . $TA . '.*' . $separator . $v . $TZ . '"';
                         }
                     }
                 } else {
                     foreach ($values as $v) {
                         if (strlen($v) > 0) {
                             $fragments[] = $target . ' REGEXP "' . $TA . '.*' . $v . '.*' . $TZ . '"';
                         }
                     }
                 }
                 if (count($fragments)) {
                     $sql = '((' . implode(') AND (', $fragments) . '))';
                 }
             }
             break;
         case 'date_past_only':
         case 'date_past':
         case 'date_future':
         case 'date_future_only':
             JFactory::getApplication()->enqueueMessage(JText::_('COM_CCK_DATE_AND_TIME_MATCH_ONLY_WITH_STANDARD'), 'notice');
             break;
         case 'nested_exact':
             $table = $field->match_options ? $field->match_options->get('table', $field->storage_table) : $field->storage_table;
             $values = JCckDevHelper::getBranch($table, $value);
             if (count($values)) {
                 $fragments = array();
                 foreach ($values as $v) {
                     if ($v != '') {
                         $fragments[] = !$TA ? $target . ' = "' . $TA . $v . $TZ . '"' : $target . ' REGEXP "' . $TA . $v . $TZ . '"';
                     }
                 }
                 if (count($fragments)) {
                     $sql = '((' . implode(') OR (', $fragments) . '))';
                 }
             }
             break;
         case 'num_higher':
             $range = '';
             $max = $field->match_value ? $field->match_value : 99999;
             if ($value <= $max) {
                 $range = CCK_List::generateRange($value, $max);
             }
             $range = '[[:<:]](' . $range . ')[[:>:]]';
             $sql = $target . ' REGEXP "' . $TA . $range . $TZ . '"';
             break;
         case 'num_higher_only':
             $range = '';
             $max = $field->match_value ? $field->match_value : 99999;
             if ($value <= $max) {
                 $range = CCK_List::generateRange($value, $max);
             }
             $range = '[[:<:]](' . $range . ')[[:>:]]';
             $sql = $target . ' REGEXP "' . $TA . $range . $TZ . '"';
             break;
         case 'num_lower':
             $range = '';
             $min = $field->match_value ? $field->match_value : 0;
             if ($value >= $min) {
                 $range = CCK_List::generateRange($min, $value);
             }
             $range = '[[:<:]](' . $range . ')[[:>:]]';
             $sql = $target . ' REGEXP "' . $TA . $range . $TZ . '"';
             break;
         case 'num_lower_only':
             $range = '';
             $min = $field->match_value ? $field->match_value : 0;
             if ($value >= $min) {
                 $range = CCK_List::generateRange($min, $value);
             }
             $range = '[[:<:]](' . $range . ')[[:>:]]';
             $sql = $target . ' REGEXP "' . $TA . $range . $TZ . '"';
             break;
         case 'not_alpha':
             $sql = $target . ' NOT REGEXP "' . $TA . $value . '.*' . $TZ . '"';
             break;
         case 'not_any_exact':
             // todo
             break;
         case 'not_zeta':
             /* Zeta is not the last letter of Greek alphabet but.. this won't be an issue here. */
             $sql = $target . ' NOT REGEXP "' . $TA . '.*' . $value . $TZ . '"';
             break;
         case 'not_empty':
             $sql = $target . ' NOT REGEXP "' . $TA . $TZ . '"';
             break;
         case 'not_equal':
             $sql = $target . ' NOT REGEXP "' . $TA . $value . $TZ . '"';
             break;
         case 'not_like':
             $sql = $target . ' NOT REGEXP "' . $TA . '.*' . $value . '.*' . $TZ . '"';
             break;
         case 'not_null':
             $sql = $target . ' NOT REGEXP "' . $TA . '0' . $TZ . '"';
             break;
         case 'is_null':
             // todo
             break;
         case 'is_not_null':
             // todo
             break;
         case 'radius_higher':
         case 'radius_lower':
             JFactory::getApplication()->enqueueMessage(JText::_('COM_CCK_RADIUS_MATCH_ONLY_WITH_STANDARD'), 'notice');
             break;
         case 'none':
             return;
             break;
         default:
             $sql = $target . ' REGEXP "' . $TA . '.*' . $value . '.*' . $TZ . '"';
             break;
     }
     return $sql;
 }