public function importData() { // Check for request forgeries JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); // check if import is allowed for this user. $user = JFactory::getUser(); if ($user->authorise('component.import', 'com_componentbuilder') && $user->authorise('core.import', 'com_componentbuilder')) { // Get the import model $model = $this->getModel('Components'); // get the headers to import $headers = $model->getExImPortHeaders(); if (ComponentbuilderHelper::checkObject($headers)) { // Load headers to session. $session = JFactory::getSession(); $headers = json_encode($headers); $session->set('component_VDM_IMPORTHEADERS', $headers); $session->set('backto_VDM_IMPORT', 'components'); $session->set('dataType_VDM_IMPORTINTO', 'component'); // Redirect to import view. $message = JText::_('COM_COMPONENTBUILDER_IMPORT_SELECT_FILE_FOR_COMPONENTS'); $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=import', false), $message); return; } } // Redirect to the list screen with error. $message = JText::_('COM_COMPONENTBUILDER_IMPORT_FAILED'); $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=components', false), $message, 'error'); return; }
protected function checkEditView($view) { if (ComponentbuilderHelper::checkString($view)) { $views = array(); // check if this is a edit view if (in_array($view, $views)) { return true; } } return false; }
/** * Setting the toolbar */ protected function addToolBar() { $canDo = ComponentbuilderHelper::getActions('componentbuilder'); JToolBarHelper::title(JText::_('COM_COMPONENTBUILDER_DASHBOARD'), 'grid-2'); // set help url for this view if found $help_url = ComponentbuilderHelper::getHelpUrl('componentbuilder'); if (ComponentbuilderHelper::checkString($help_url)) { JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); } if ($canDo->get('core.admin') || $canDo->get('core.options')) { JToolBarHelper::preferences('com_componentbuilder'); } }
protected function getViewRelation($view) { if (ComponentbuilderHelper::checkString($view)) { $views = array('component' => 'components', 'admin_view' => 'admin_views', 'custom_admin_view' => 'custom_admin_views', 'site_view' => 'site_views', 'template' => 'templates', 'layout' => 'layouts', 'dynamic_get' => 'dynamic_gets', 'snippet' => 'snippets', 'field' => 'fields', 'fieldtype' => 'fieldtypes', 'help_document' => 'help_documents'); // check if this is a list view if (in_array($view, $views)) { return array('edit' => false, 'view' => array_search($view, $views), 'views' => $view); } elseif (array_key_exists($view, $views)) { return array('edit' => true, 'view' => $view, 'views' => $views[$view]); } } return false; }
public function getDbTableColumns($tableName, $as, $type) { // Get a db connection. $db = JFactory::getDbo(); // get the columns $columns = $db->getTableColumns("#__" . $tableName); if (ComponentbuilderHelper::checkArray($columns)) { // build the return string $tableColumns = array(); foreach ($columns as $column => $type) { $tableColumns[] = $as . "." . $column . ' AS ' . $column; } return implode("\n", $tableColumns); } return false; }
@author Llewellyn van der Merwe <https://www.vdm.io/joomla-component-builder> @copyright Copyright (C) 2015. All Rights Reserved @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html Builds Complex Joomla Components /-----------------------------------------------------------------------------------------------------------------------------*/ // No direct access to this file defined('_JEXEC') or die('Restricted access'); $edit = "index.php?option=com_componentbuilder&view=layouts&task=layout.edit"; foreach ($this->items as $i => $item) { ?> <?php $canCheckin = $this->user->authorise('core.manage', 'com_checkin') || $item->checked_out == $this->user->id || $item->checked_out == 0; $userChkOut = JFactory::getUser($item->checked_out); $canDo = ComponentbuilderHelper::getActions('layout', $item, 'layouts'); ?> <tr class="row<?php echo $i % 2; ?> "> <td class="order nowrap center hidden-phone"> <?php if ($canDo->get('core.edit.state')) { ?> <?php if ($this->saveOrder) { $iconClass = ' inactive'; } else { $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); }
private function getFTP($clientInput) { $signature = md5($clientInput); if (isset($this->FTP[$signature]) && $this->FTP[$signature] instanceof JClientFtp) { return $this->FTP[$signature]; } else { // make sure we have a string and it is not default or empty if (ComponentbuilderHelper::checkString($clientInput)) { // turn into vars parse_str($clientInput); // set options if (isset($options) && ComponentbuilderHelper::checkArray($options)) { foreach ($options as $option => $value) { if ('timeout' == $option) { $options[$option] = (int) $value; } if ('type' == $option) { $options[$option] = (string) $value; } } } else { $options = array(); } // get ftp object if (isset($host) && $host != 'HOSTNAME' && isset($port) && $port != 'PORT_INT' && isset($username) && $username != '*****@*****.**' && isset($password) && $password != 'password') { // load for reuse $this->FTP[$signature] = JClientFtp::getInstance($host, $port, $options, $username, $password); return $this->FTP[$signature]; } } } return false; }
@author Llewellyn van der Merwe <https://www.vdm.io/joomla-component-builder> @copyright Copyright (C) 2015. All Rights Reserved @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html Builds Complex Joomla Components /-----------------------------------------------------------------------------------------------------------------------------*/ // No direct access to this file defined('_JEXEC') or die('Restricted access'); $edit = "index.php?option=com_componentbuilder&view=components&task=component.edit"; foreach ($this->items as $i => $item) { ?> <?php $canCheckin = $this->user->authorise('core.manage', 'com_checkin') || $item->checked_out == $this->user->id || $item->checked_out == 0; $userChkOut = JFactory::getUser($item->checked_out); $canDo = ComponentbuilderHelper::getActions('component', $item, 'components'); ?> <tr class="row<?php echo $i % 2; ?> "> <td class="order nowrap center hidden-phone"> <?php if ($canDo->get('core.edit.state')) { ?> <?php if ($this->saveOrder) { $iconClass = ' inactive'; } else { $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); }
public function getFieldType($typeName, $xml, $property) { // make sure its lower case $typeName = ComponentbuilderHelper::safeString($typeName); if ($typeName == 'custom' || $typeName == 'customuser') { $xmlValue = ComponentbuilderHelper::safeString(ComponentbuilderHelper::getBetween($xml, 'type="', '"')); } elseif (ComponentbuilderHelper::checkString($typeName)) { $xmlValue = $typeName; } elseif (isset($property['example']) && ComponentbuilderHelper::checkString($property['example']) && $property['adjustable'] == 0) { $xmlValue = $property['example']; } else { $xmlValue = ComponentbuilderHelper::safeString(ComponentbuilderHelper::getBetween($xml, 'type="', '"')); } // check if the value is set if (ComponentbuilderHelper::checkString($xmlValue)) { // add the value return $xmlValue; } else { // fall back to text return 'text'; } }
@author Llewellyn van der Merwe <https://www.vdm.io/joomla-component-builder> @copyright Copyright (C) 2015. All Rights Reserved @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html Builds Complex Joomla Components /-----------------------------------------------------------------------------------------------------------------------------*/ // No direct access to this file defined('_JEXEC') or die('Restricted access'); $edit = "index.php?option=com_componentbuilder&view=help_documents&task=help_document.edit"; foreach ($this->items as $i => $item) { ?> <?php $canCheckin = $this->user->authorise('core.manage', 'com_checkin') || $item->checked_out == $this->user->id || $item->checked_out == 0; $userChkOut = JFactory::getUser($item->checked_out); $canDo = ComponentbuilderHelper::getActions('help_document', $item, 'help_documents'); ?> <tr class="row<?php echo $i % 2; ?> "> <td class="order nowrap center hidden-phone"> <?php if ($canDo->get('help_document.edit.state')) { ?> <?php if ($this->saveOrder) { $iconClass = ' inactive'; } else { $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); }
/** * Save the data from the file to the database * * @param string $package Paths to the uploaded package file * * @return boolean false on failure * **/ protected function save($data, $table) { // import the data if there is any if (ComponentbuilderHelper::checkArray($data['array'])) { // get user object $user = JFactory::getUser(); // remove header if it has headers $id_key = $data['target_headers']['id']; $published_key = $data['target_headers']['published']; $ordering_key = $data['target_headers']['ordering']; // get the first array set $firstSet = reset($data['array']); // check if first array is a header array and remove if true if ($firstSet[$id_key] == 'id' || $firstSet[$published_key] == 'published' || $firstSet[$ordering_key] == 'ordering') { array_shift($data['array']); } // make sure there is still values in array and that it was not only headers if (ComponentbuilderHelper::checkArray($data['array']) && $user->authorise($table . '.import', 'com_componentbuilder') && $user->authorise('core.import', 'com_componentbuilder')) { // set target. $target = array_flip($data['target_headers']); // Get a db connection. $db = JFactory::getDbo(); // set some defaults $todayDate = JFactory::getDate()->toSql(); // get global action permissions $canDo = ComponentbuilderHelper::getActions($table); $canEdit = $canDo->get('core.edit'); $canState = $canDo->get('core.edit.state'); $canCreate = $canDo->get('core.create'); $hasAlias = $this->getAliasesUsed($table); // prosses the data foreach ($data['array'] as $row) { $found = false; if (isset($row[$id_key]) && is_numeric($row[$id_key]) && $row[$id_key] > 0) { // raw items import & update! $query = $db->getQuery(true); $query->select('version')->from($db->quoteName('#__componentbuilder_' . $table))->where($db->quoteName('id') . ' = ' . $db->quote($row[$id_key])); // Reset the query using our newly populated query object. $db->setQuery($query); $db->execute(); $found = $db->getNumRows(); } if ($found && $canEdit) { // update item $id = $row[$id_key]; $version = $db->loadResult(); // reset all buckets $query = $db->getQuery(true); $fields = array(); // Fields to update. foreach ($row as $key => $cell) { // ignore column if ('IGNORE' == $target[$key]) { continue; } // update modified if ('modified_by' == $target[$key]) { continue; } // update modified if ('modified' == $target[$key]) { continue; } // update version if ('version' == $target[$key]) { $cell = (int) $version + 1; } // verify publish authority if ('published' == $target[$key] && !$canState) { continue; } // set to update array if (in_array($key, $data['target_headers']) && is_numeric($cell)) { $fields[] = $db->quoteName($target[$key]) . ' = ' . $cell; } elseif (in_array($key, $data['target_headers']) && is_string($cell)) { $fields[] = $db->quoteName($target[$key]) . ' = ' . $db->quote($cell); } elseif (in_array($key, $data['target_headers']) && is_null($cell)) { // if import data is null then set empty $fields[] = $db->quoteName($target[$key]) . " = ''"; } } // load the defaults $fields[] = $db->quoteName('modified_by') . ' = ' . $db->quote($user->id); $fields[] = $db->quoteName('modified') . ' = ' . $db->quote($todayDate); // Conditions for which records should be updated. $conditions = array($db->quoteName('id') . ' = ' . $id); $query->update($db->quoteName('#__componentbuilder_' . $table))->set($fields)->where($conditions); $db->setQuery($query); $db->execute(); } elseif ($canCreate) { // insert item $query = $db->getQuery(true); // reset all buckets $columns = array(); $values = array(); $version = false; // Insert columns. Insert values. foreach ($row as $key => $cell) { // ignore column if ('IGNORE' == $target[$key]) { continue; } // remove id if ('id' == $target[$key]) { continue; } // update created if ('created_by' == $target[$key]) { continue; } // update created if ('created' == $target[$key]) { continue; } // Make sure the alias is incremented if ('alias' == $target[$key]) { $cell = $this->getAlias($cell, $table); } // update version if ('version' == $target[$key]) { $cell = 1; $version = true; } // set to insert array if (in_array($key, $data['target_headers']) && is_numeric($cell)) { $columns[] = $target[$key]; $values[] = $cell; } elseif (in_array($key, $data['target_headers']) && is_string($cell)) { $columns[] = $target[$key]; $values[] = $db->quote($cell); } elseif (in_array($key, $data['target_headers']) && is_null($cell)) { // if import data is null then set empty $columns[] = $target[$key]; $values[] = "''"; } } // load the defaults $columns[] = 'created_by'; $values[] = $db->quote($user->id); $columns[] = 'created'; $values[] = $db->quote($todayDate); if (!$version) { $columns[] = 'version'; $values[] = 1; } // Prepare the insert query. $query->insert($db->quoteName('#__componentbuilder_' . $table))->columns($db->quoteName($columns))->values(implode(',', $values)); // Set the query using our newly populated query object and execute it. $db->setQuery($query); $done = $db->execute(); if ($done) { $aId = $db->insertid(); // make sure the access of asset is set ComponentbuilderHelper::setAsset($aId, $table); } } else { return false; } } return true; } } return false; }
/** * Escape the values for a SQL dump * * @param string $value the value to escape * * @return string on success with escaped string * */ public function mysql_escape($value) { // if array then return maped if (ComponentbuilderHelper::checkArray($value)) { return array_map(__METHOD__, $value); } // if string make sure it is correctly escaped if (ComponentbuilderHelper::checkString($value) && !is_numeric($value)) { // Get a db connection. $db = JFactory::getDbo(); return $db->quote($value); } // if empty value return place holder if (empty($value)) { return "''"; } // if not array or string then return number return $value; }
/** * Method to save the form data. * * @param array $data The form data. * * @return boolean True on success. * * @since 1.6 */ public function save($data) { $input = JFactory::getApplication()->input; $filter = JFilterInput::getInstance(); // set the metadata to the Item Data if (isset($data['metadata']) && isset($data['metadata']['author'])) { $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); $metadata = new JRegistry(); $metadata->loadArray($data['metadata']); $data['metadata'] = (string) $metadata; } // Set the php_after_getitem string to base64 string. if (isset($data['php_after_getitem'])) { $data['php_after_getitem'] = base64_encode($data['php_after_getitem']); } // Set the php_before_getitems string to base64 string. if (isset($data['php_before_getitems'])) { $data['php_before_getitems'] = base64_encode($data['php_before_getitems']); } // Set the php_before_getitem string to base64 string. if (isset($data['php_before_getitem'])) { $data['php_before_getitem'] = base64_encode($data['php_before_getitem']); } // Set the php_getlistquery string to base64 string. if (isset($data['php_getlistquery'])) { $data['php_getlistquery'] = base64_encode($data['php_getlistquery']); } // Set the php_after_getitems string to base64 string. if (isset($data['php_after_getitems'])) { $data['php_after_getitems'] = base64_encode($data['php_after_getitems']); } // Set the php_calculation string to base64 string. if (isset($data['php_calculation'])) { $data['php_calculation'] = base64_encode($data['php_calculation']); } // Set the php_custom_get string to base64 string. if (isset($data['php_custom_get'])) { $data['php_custom_get'] = base64_encode($data['php_custom_get']); } // Set the Params Items to data if (isset($data['params']) && is_array($data['params'])) { $params = new JRegistry(); $params->loadArray($data['params']); $data['params'] = (string) $params; } // Alter the uniqe field for save as copy if ($input->get('task') == 'save2copy') { // Automatic handling of other uniqe fields $uniqeFields = $this->getUniqeFields(); if (ComponentbuilderHelper::checkArray($uniqeFields)) { foreach ($uniqeFields as $uniqeField) { $data[$uniqeField] = $this->generateUniqe($uniqeField, $data[$uniqeField]); } } } if (parent::save($data)) { return true; } return false; }
/** * Method to get a list of options for a list input. * * @return array An array of JHtml options. */ public function getOptions() { $db = JFactory::getDBO(); $query = $db->getQuery(true); $query->select($db->quoteName(array('a.id', 'a.name', 'a.gettype'), array('id', 'dynamic_get_name', 'type'))); $query->from($db->quoteName('#__componentbuilder_dynamic_get', 'a')); $query->where($db->quoteName('a.published') . ' = 1'); $query->order('a.name ASC'); $db->setQuery((string) $query); $items = $db->loadObjectList(); $options = array(); if ($items) { $model = ComponentbuilderHelper::getModel('dynamic_gets'); foreach ($items as $item) { $type = $model->selectionTranslation($item->type, 'gettype'); $options[] = JHtml::_('select.option', $item->id, $item->dynamic_get_name . ' (' . JText::_($type) . ')'); } } return $options; }
/** * Method to save the form data. * * @param array $data The form data. * * @return boolean True on success. * * @since 1.6 */ public function save($data) { $input = JFactory::getApplication()->input; $filter = JFilterInput::getInstance(); // set the metadata to the Item Data if (isset($data['metadata']) && isset($data['metadata']['author'])) { $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); $metadata = new JRegistry(); $metadata->loadArray($data['metadata']); $data['metadata'] = (string) $metadata; } // Set the xml string to JSON string. if (isset($data['xml'])) { $data['xml'] = (string) json_encode($data['xml']); } // Set the css_view string to base64 string. if (isset($data['css_view'])) { $data['css_view'] = base64_encode($data['css_view']); } // Set the css_views string to base64 string. if (isset($data['css_views'])) { $data['css_views'] = base64_encode($data['css_views']); } // Set the javascript_view_footer string to base64 string. if (isset($data['javascript_view_footer'])) { $data['javascript_view_footer'] = base64_encode($data['javascript_view_footer']); } // Set the javascript_views_footer string to base64 string. if (isset($data['javascript_views_footer'])) { $data['javascript_views_footer'] = base64_encode($data['javascript_views_footer']); } // Set the Params Items to data if (isset($data['params']) && is_array($data['params'])) { $params = new JRegistry(); $params->loadArray($data['params']); $data['params'] = (string) $params; } // Alter the uniqe field for save as copy if ($input->get('task') == 'save2copy') { // Automatic handling of other uniqe fields $uniqeFields = $this->getUniqeFields(); if (ComponentbuilderHelper::checkArray($uniqeFields)) { foreach ($uniqeFields as $uniqeField) { $data[$uniqeField] = $this->generateUniqe($uniqeField, $data[$uniqeField]); } } } if (parent::save($data)) { return true; } return false; }
?> </option> <?php foreach ($this->headers as $value => $option) { ?> <?php $selected = strtolower($option) == strtolower($title) || strtolower($option) == strtolower($name) ? 'selected="selected"' : ''; ?> <option value="<?php echo ComponentbuilderHelper::htmlEscape($value); ?> " class="required" <?php echo $selected; ?> ><?php echo ComponentbuilderHelper::htmlEscape($option); ?> </option> <?php } ?> </select> </div> </div> <?php } ?> <div class="form-actions"> <input class="btn btn-primary" type="button" value="<?php echo JText::_('COM_COMPONENTBUILDER_IMPORT_CONTINUE'); ?>
/** * Method to get header. * * @return mixed An array of data items on success, false on failure. */ public function getExImPortHeaders() { // Get a db connection. $db = JFactory::getDbo(); // get the columns $columns = $db->getTableColumns("#__componentbuilder_component"); if (ComponentbuilderHelper::checkArray($columns)) { // remove the headers you don't import/export. unset($columns['asset_id']); unset($columns['checked_out']); unset($columns['checked_out_time']); $headers = new stdClass(); foreach ($columns as $column => $type) { $headers->{$column} = $column; } return $headers; } return false; }
</th> <th width="5" data-type="number" data-breakpoints="xs sm md"> <?php echo JText::_('COM_COMPONENTBUILDER_SITE_VIEW_ID'); ?> </th> </tr> </thead> <tbody> <?php foreach ($items as $i => $item) { ?> <?php $canCheckin = $user->authorise('core.manage', 'com_checkin') || $item->checked_out == $user->id || $item->checked_out == 0; $userChkOut = JFactory::getUser($item->checked_out); $canDo = ComponentbuilderHelper::getActions('site_view', $item, 'site_views'); ?> <tr> <td class="nowrap"> <?php if ($canDo->get('core.edit')) { ?> <a href="<?php echo $edit; ?> &id=<?php echo $item->id; ?> &ref=component&refid=<?php echo $id; ?>
/** * Method to get a list of options for a list input. * * @return array An array of JHtml options. */ public function getOptions() { // get custom folder files $localfolder = JPATH_COMPONENT_SITE . '/views'; // set the default $options = array(); // import all needed classes jimport('joomla.filesystem.folder'); // now check if there are files in the folder if (JFolder::exists($localfolder) && ($folders = JFolder::folders($localfolder))) { foreach ($folders as $folder) { $options[] = JHtml::_('select.option', $folder, ComponentbuilderHelper::safeString($folder, 'W')); } } return $options; }
@author Llewellyn van der Merwe <https://www.vdm.io/joomla-component-builder> @copyright Copyright (C) 2015. All Rights Reserved @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html Builds Complex Joomla Components /-----------------------------------------------------------------------------------------------------------------------------*/ // No direct access to this file defined('_JEXEC') or die('Restricted access'); $edit = "index.php?option=com_componentbuilder&view=templates&task=template.edit"; foreach ($this->items as $i => $item) { ?> <?php $canCheckin = $this->user->authorise('core.manage', 'com_checkin') || $item->checked_out == $this->user->id || $item->checked_out == 0; $userChkOut = JFactory::getUser($item->checked_out); $canDo = ComponentbuilderHelper::getActions('template', $item, 'templates'); ?> <tr class="row<?php echo $i % 2; ?> "> <td class="order nowrap center hidden-phone"> <?php if ($canDo->get('core.edit.state')) { ?> <?php if ($this->saveOrder) { $iconClass = ' inactive'; } else { $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); }
public function setCustomFieldTypeFile($data, $viewName_list, $viewName_single) { // make sure it is not already been build if (!isset($this->fileContentDynamic['customfield_' . $data['type']]) || !ComponentbuilderHelper::checkArray($this->fileContentDynamic['customfield_' . $data['type']])) { // first build the custom field type file $target = array('admin' => 'customfield'); $this->buildDynamique($target, 'field' . $data['custom']['extends'], $data['custom']['type']); // set tab and break replacements $tabBreak = array('\\t' => "\t", '\\n' => "\n"); // make field dynamic $replace = array('###TABLE###' => $data['custom']['table'], '###ID###' => $data['custom']['id'], '###TEXT###' => $data['custom']['text'], '###CODE_TEXT###' => $data['code'] . '_' . $data['custom']['text'], '###CODE###' => $data['code'], '###component###' => $this->fileContentStatic['###component###'], '###Component###' => $this->fileContentStatic['###Component###'], '###view_type###' => $viewName_single . '_' . $data['type'], '###type###' => $data['type'], '###view###' => $viewName_single, '###views###' => $viewName_list); // now load the php script if (isset($data['custom']['php']) && ComponentbuilderHelper::checkArray($data['custom']['php'])) { // make sure the ar is reset $phpCode = ''; foreach ($data['custom']['php'] as $line => $code) { if (ComponentbuilderHelper::checkString($code)) { if ($line == 1) { $phpCode .= str_replace(array_keys($tabBreak), array_values($tabBreak), $code); } else { $phpCode .= "\n\t\t" . str_replace(array_keys($tabBreak), array_values($tabBreak), $code); } } } // replace the placholders $phpCode = str_replace(array_keys($replace), array_values($replace), $phpCode); } else { $phpCode = 'return null;'; } if (!ComponentbuilderHelper::checkString($phpCode)) { $phpCode = 'return null;'; } if ($data['custom']['extends'] == 'user') { // now load the php xclude script if (ComponentbuilderHelper::checkArray($data['custom']['phpx'])) { // make sure the ar is reset $phpxCode = ''; foreach ($data['custom']['phpx'] as $line => $code) { if (ComponentbuilderHelper::checkString($code)) { if ($line == 1) { $phpxCode .= str_replace(array_keys($tabBreak), array_values($tabBreak), $code); } else { $phpxCode .= "\n\t\t" . str_replace(array_keys($tabBreak), array_values($tabBreak), $code); } } } // replace the placholders $phpxCode = str_replace(array_keys($replace), array_values($replace), $phpxCode); } else { $phpxCode = 'return null;'; } if (!ComponentbuilderHelper::checkString($phpxCode)) { $phpxCode = 'return null;'; } // temp holder for name $tempName = $data['custom']['label'] . ' Group'; // set lang $groupLangName = $this->langPrefix . '_' . ComponentbuilderHelper::safeString($tempName, 'U'); // add to lang array $this->langContent[$this->lang][$groupLangName] = ComponentbuilderHelper::safeString($tempName, 'W'); // build the Group Control $this->setGroupControl[$data['type']] = $groupLangName; // ###JFORM_GETGROUPS_PHP### <<<DYNAMIC>>> $this->fileContentDynamic['customfield_' . $data['type']]['###JFORM_GETGROUPS_PHP###'] = $phpCode; // ###JFORM_GETEXCLUDED_PHP### <<<DYNAMIC>>> $this->fileContentDynamic['customfield_' . $data['type']]['###JFORM_GETEXCLUDED_PHP###'] = $phpxCode; } else { // ###JFORM_GETOPTIONS_PHP### <<<DYNAMIC>>> $this->fileContentDynamic['customfield_' . $data['type']]['###JFORM_GETOPTIONS_PHP###'] = $phpCode; } // ###Type### <<<DYNAMIC>>> $this->fileContentDynamic['customfield_' . $data['type']]['###Type###'] = ComponentbuilderHelper::safeString($data['custom']['type'], 'F'); // ###type### <<<DYNAMIC>>> $this->fileContentDynamic['customfield_' . $data['type']]['###type###'] = $data['custom']['type']; // ###type### <<<DYNAMIC>>> $this->fileContentDynamic['customfield_' . $data['type']]['###ADD_BUTTON###'] = $this->setAddButttonToListField($data['custom']['view'], $data['custom']['views']); } }
/** * Method to save the form data. * * @param array $data The form data. * * @return boolean True on success. * * @since 1.6 */ public function save($data) { $input = JFactory::getApplication()->input; $filter = JFilterInput::getInstance(); // set the metadata to the Item Data if (isset($data['metadata']) && isset($data['metadata']['author'])) { $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); $metadata = new JRegistry(); $metadata->loadArray($data['metadata']); $data['metadata'] = (string) $metadata; } // Set the groups string to JSON string. if (isset($data['groups'])) { $data['groups'] = (string) json_encode($data['groups']); } // Set the Params Items to data if (isset($data['params']) && is_array($data['params'])) { $params = new JRegistry(); $params->loadArray($data['params']); $data['params'] = (string) $params; } // Alter the title for save as copy if ($input->get('task') == 'save2copy') { $origTable = clone $this->getTable(); $origTable->load($input->getInt('id')); if ($data['title'] == $origTable->title) { list($title, $alias) = $this->_generateNewTitle($data['alias'], $data['title']); $data['title'] = $title; $data['alias'] = $alias; } else { if ($data['alias'] == $origTable->alias) { $data['alias'] = ''; } } $data['published'] = 0; } // Automatic handling of alias for empty fields if (in_array($input->get('task'), array('apply', 'save', 'save2new')) && (int) $input->get('id') == 0) { if ($data['alias'] == null) { if (JFactory::getConfig()->get('unicodeslugs') == 1) { $data['alias'] = JFilterOutput::stringURLUnicodeSlug($data['title']); } else { $data['alias'] = JFilterOutput::stringURLSafe($data['title']); } $table = JTable::getInstance('help_document', 'componentbuilderTable'); if ($table->load(array('alias' => $data['alias'])) && ($table->id != $data['id'] || $data['id'] == 0)) { $msg = JText::_('COM_COMPONENTBUILDER_HELP_DOCUMENT_SAVE_WARNING'); } list($title, $alias) = $this->_generateNewTitle($data['alias'], $data['title']); $data['alias'] = $alias; if (isset($msg)) { JFactory::getApplication()->enqueueMessage($msg, 'warning'); } } } // Alter the uniqe field for save as copy if ($input->get('task') == 'save2copy') { // Automatic handling of other uniqe fields $uniqeFields = $this->getUniqeFields(); if (ComponentbuilderHelper::checkArray($uniqeFields)) { foreach ($uniqeFields as $uniqeField) { $data[$uniqeField] = $this->generateUniqe($uniqeField, $data[$uniqeField]); } } } if (parent::save($data)) { return true; } return false; }
/** * Method to save the form data. * * @param array $data The form data. * * @return boolean True on success. * * @since 1.6 */ public function save($data) { $input = JFactory::getApplication()->input; $filter = JFilterInput::getInstance(); // set the metadata to the Item Data if (isset($data['metadata']) && isset($data['metadata']['author'])) { $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); $metadata = new JRegistry(); $metadata->loadArray($data['metadata']); $data['metadata'] = (string) $metadata; } // Set the custom_get items to data. if (isset($data['custom_get']) && is_array($data['custom_get'])) { $custom_get = new JRegistry(); $custom_get->loadArray($data['custom_get']); $data['custom_get'] = (string) $custom_get; } elseif (!isset($data['custom_get'])) { // Set the empty custom_get to data $data['custom_get'] = ''; } // Set the php_model string to base64 string. if (isset($data['php_model'])) { $data['php_model'] = base64_encode($data['php_model']); } // Set the css_document string to base64 string. if (isset($data['css_document'])) { $data['css_document'] = base64_encode($data['css_document']); } // Set the php_jview string to base64 string. if (isset($data['php_jview'])) { $data['php_jview'] = base64_encode($data['php_jview']); } // Set the php_view string to base64 string. if (isset($data['php_view'])) { $data['php_view'] = base64_encode($data['php_view']); } // Set the php_document string to base64 string. if (isset($data['php_document'])) { $data['php_document'] = base64_encode($data['php_document']); } // Set the php_jview_display string to base64 string. if (isset($data['php_jview_display'])) { $data['php_jview_display'] = base64_encode($data['php_jview_display']); } // Set the js_document string to base64 string. if (isset($data['js_document'])) { $data['js_document'] = base64_encode($data['js_document']); } // Set the css string to base64 string. if (isset($data['css'])) { $data['css'] = base64_encode($data['css']); } // Set the default string to base64 string. if (isset($data['default'])) { $data['default'] = base64_encode($data['default']); } // Set the php_controller string to base64 string. if (isset($data['php_controller'])) { $data['php_controller'] = base64_encode($data['php_controller']); } // Set the Params Items to data if (isset($data['params']) && is_array($data['params'])) { $params = new JRegistry(); $params->loadArray($data['params']); $data['params'] = (string) $params; } // Alter the name for save as copy if ($input->get('task') == 'save2copy') { $origTable = clone $this->getTable(); $origTable->load($input->getInt('id')); if ($data['name'] == $origTable->name) { list($name, $alias) = $this->_generateNewTitle($data['alias'], $data['name']); $data['name'] = $name; $data['alias'] = $alias; } else { if ($data['alias'] == $origTable->alias) { $data['alias'] = ''; } } $data['published'] = 0; } // Automatic handling of alias for empty fields if (in_array($input->get('task'), array('apply', 'save', 'save2new')) && (int) $input->get('id') == 0) { if ($data['alias'] == null) { if (JFactory::getConfig()->get('unicodeslugs') == 1) { $data['alias'] = JFilterOutput::stringURLUnicodeSlug($data['name']); } else { $data['alias'] = JFilterOutput::stringURLSafe($data['name']); } $table = JTable::getInstance('custom_admin_view', 'componentbuilderTable'); if ($table->load(array('alias' => $data['alias'])) && ($table->id != $data['id'] || $data['id'] == 0)) { $msg = JText::_('COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_SAVE_WARNING'); } list($name, $alias) = $this->_generateNewTitle($data['alias'], $data['name']); $data['alias'] = $alias; if (isset($msg)) { JFactory::getApplication()->enqueueMessage($msg, 'warning'); } } } // Alter the uniqe field for save as copy if ($input->get('task') == 'save2copy') { // Automatic handling of other uniqe fields $uniqeFields = $this->getUniqeFields(); if (ComponentbuilderHelper::checkArray($uniqeFields)) { foreach ($uniqeFields as $uniqeField) { $data[$uniqeField] = $this->generateUniqe($uniqeField, $data[$uniqeField]); } } } if (parent::save($data)) { return true; } return false; }
/** * Escapes a value for output in a view script. * * @param mixed $var The output to escape. * * @return mixed The escaped value. */ public function escape($var) { if (strlen($var) > 50) { // use the helper htmlEscape method instead and shorten the string return ComponentbuilderHelper::htmlEscape($var, $this->_charset, true); } // use the helper htmlEscape method instead. return ComponentbuilderHelper::htmlEscape($var, $this->_charset); }
/** * set the Joomla Version Data * * * @return oject The version data * */ private function setJoomlaVersionData() { // set the version data $versionData = json_decode(file_get_contents($this->templatePath . '/settings.json')); // add custom folders if (isset($this->componentData->folders) && ComponentbuilderHelper::checkArray($this->componentData->folders) || $this->addEximport || $this->uikit || $this->footable) { if ($this->addEximport) { // move the import view folder in place $importView = array('folder' => 'importViews', 'path' => 'admin/views/import', 'rename' => 1); $this->componentData->folders[] = $importView; // move the PHPExel Folder $PHPExcel = array('folder' => 'PHPExcel', 'path' => 'admin/helpers', 'rename' => 0); $this->componentData->folders[] = $PHPExcel; } if ($this->uikit) { // move the UIKIT Folder into place $uikit = array('folder' => 'uikit', 'path' => 'media', 'rename' => 0); $this->componentData->folders[] = $uikit; } if ($this->footable && (!isset($this->footableVersion) || 2 == $this->footableVersion)) { // move the footable folder into place $footable = array('folder' => 'footable2', 'path' => 'media/footable', 'rename' => 1); $this->componentData->folders[] = $footable; } elseif ($this->footable && 3 == $this->footableVersion) { // move the footable folder into place $footable = array('folder' => 'footable3', 'path' => 'media/footable', 'rename' => 1); $this->componentData->folders[] = $footable; } // pointer tracker $pointer_tracker = 'h'; foreach ($this->componentData->folders as $custom) { // fix path $custom['path'] = rtrim($custom['path'], '/'); $custom['path'] = ltrim($custom['path'], '/'); // make sure we use the correct name $pathArray = (array) explode('/', $custom['path']); $firstFolder = array_values($pathArray)[0]; $lastFolder = end($pathArray); // only rename folder if last has folder name if ($custom['rename'] == 1) { $custom['path'] = str_replace('/' . $lastFolder, '', $custom['path']); $rename = 'new'; $newname = $lastFolder; if (($tkey = array_search($lastFolder, $pathArray)) !== false) { unset($pathArray[$tkey]); } } else { $lastFolder = $custom['folder']; $rename = false; $newname = ''; } // check if we sould add it to the media xml list if (!isset($this->fileContentStatic['###EXSTRA_MEDIA_FOLDERS###'])) { $this->fileContentStatic['###EXSTRA_MEDIA_FOLDERS###'] = ''; } if (count($pathArray) == 1 && $firstFolder == 'media') { $this->fileContentStatic['###EXSTRA_MEDIA_FOLDERS###'] .= "\n\t\t<folder>" . $lastFolder . "</folder>"; } // check if we sould add it to the site xml list if (!isset($this->fileContentStatic['###EXSTRA_SITE_FOLDERS###'])) { $this->fileContentStatic['###EXSTRA_SITE_FOLDERS###'] = ''; } if (count($pathArray) == 1 && $firstFolder == 'site') { $this->fileContentStatic['###EXSTRA_SITE_FOLDERS###'] .= "\n\t\t<folder>" . $lastFolder . "</folder>"; } // check if we sould add it to the admin xml list if (!isset($this->fileContentStatic['###EXSTRA_ADMIN_FOLDERS###'])) { $this->fileContentStatic['###EXSTRA_ADMIN_FOLDERS###'] = ''; } if (count($pathArray) == 1 && $firstFolder == 'admin') { $this->fileContentStatic['###EXSTRA_ADMIN_FOLDERS###'] .= "\n\t\t\t<folder>" . $lastFolder . "</folder>"; } // make we have not duplicates $key_pointer = ComponentbuilderHelper::safeString($custom['folder']) . '_f' . $pointer_tracker; $pointer_tracker++; // set new folder to object $versionData->move->static->{$key_pointer} = new stdClass(); $versionData->move->static->{$key_pointer}->naam = $custom['folder']; $versionData->move->static->{$key_pointer}->path = 'c0mp0n3nt/' . $custom['path']; $versionData->move->static->{$key_pointer}->rename = $rename; $versionData->move->static->{$key_pointer}->newName = $newname; $versionData->move->static->{$key_pointer}->type = 'folder'; $versionData->move->static->{$key_pointer}->custom = true; } unset($this->componentData->folders); unset($custom); } // add custom files if (isset($this->componentData->files) && ComponentbuilderHelper::checkArray($this->componentData->files) || $this->addEximport || $this->googlechart) { if ($this->addEximport) { // move the PHPExel main file $PHPExcel = array('file' => 'PHPExcel.php', 'path' => 'admin/helpers', 'rename' => 0); $this->componentData->files[] = $PHPExcel; } if ($this->googlechart) { // move the google chart files $googleChart = array('file' => 'google.jsapi.js', 'path' => 'media/js', 'rename' => 0); $this->componentData->files[] = $googleChart; $googleChart = array('file' => 'chartbuilder.php', 'path' => 'admin/helpers', 'rename' => 0); $this->componentData->files[] = $googleChart; } // pointer tracker $pointer_tracker = 'h'; foreach ($this->componentData->files as $custom) { // make we have not duplicates $key_pointer = ComponentbuilderHelper::safeString($custom['file']) . '_g' . $pointer_tracker; $pointer_tracker++; // set new file to object $versionData->move->static->{$key_pointer} = new stdClass(); $versionData->move->static->{$key_pointer}->naam = $custom['file']; // get the path info $pathInfo = pathinfo($custom['path']); if (isset($pathInfo['extension']) && $pathInfo['extension']) { $pathInfo['dirname'] = rtrim($pathInfo['dirname'], '/'); $pathInfo['dirname'] = ltrim($pathInfo['dirname'], '/'); $versionData->move->static->{$key_pointer}->path = 'c0mp0n3nt/' . $pathInfo['dirname']; $versionData->move->static->{$key_pointer}->rename = 'new'; $versionData->move->static->{$key_pointer}->newName = $pathInfo['basename']; // set the name $name = $pathInfo['basename']; } else { $custom['path'] = rtrim($custom['path'], '/'); $custom['path'] = ltrim($custom['path'], '/'); $versionData->move->static->{$key_pointer}->path = 'c0mp0n3nt/' . $custom['path']; $versionData->move->static->{$key_pointer}->rename = false; // set the name $name = $custom['file']; } // check if file should be updated if (isset($custom['notnew']) && $custom['notnew'] == 0) { $this->notNew[] = $key_pointer; } $versionData->move->static->{$key_pointer}->type = 'file'; $versionData->move->static->{$key_pointer}->custom = true; } unset($this->componentData->files); unset($custom); } return $versionData; }
public function getIcons() { // load user for access menus $user = JFactory::getUser(); // reset icon array $icons = array(); // view groups array $viewGroups = array('main' => array('png.compiler', 'png.component.add', 'png.components', 'png.admin_view.add', 'png.admin_views', 'png.custom_admin_view.add', 'png.custom_admin_views', 'png.site_view.add', 'png.site_views', 'png.template.add', 'png.templates', 'png.layout.add', 'png.layouts', 'png.dynamic_get.add', 'png.dynamic_gets', 'png.snippet.add', 'png.snippets', 'png.field.add', 'png.fields', 'png.fields.catid', 'png.fieldtype.add', 'png.fieldtypes', 'png.fieldtypes.catid', 'png.help_document.add', 'png.help_documents')); // view access array $viewAccess = array('admin_views.access' => 'admin_view.access', 'admin_view.access' => 'admin_view.access', 'admin_views.submenu' => 'admin_view.submenu', 'admin_views.dashboard_list' => 'admin_view.dashboard_list', 'admin_view.dashboard_add' => 'admin_view.dashboard_add', 'custom_admin_views.access' => 'custom_admin_view.access', 'custom_admin_view.access' => 'custom_admin_view.access', 'custom_admin_views.submenu' => 'custom_admin_view.submenu', 'custom_admin_views.dashboard_list' => 'custom_admin_view.dashboard_list', 'custom_admin_view.dashboard_add' => 'custom_admin_view.dashboard_add', 'site_views.access' => 'site_view.access', 'site_view.access' => 'site_view.access', 'site_views.submenu' => 'site_view.submenu', 'site_views.dashboard_list' => 'site_view.dashboard_list', 'site_view.dashboard_add' => 'site_view.dashboard_add', 'templates.access' => 'template.access', 'template.access' => 'template.access', 'templates.submenu' => 'template.submenu', 'templates.dashboard_list' => 'template.dashboard_list', 'template.dashboard_add' => 'template.dashboard_add', 'layouts.access' => 'layout.access', 'layout.access' => 'layout.access', 'layouts.submenu' => 'layout.submenu', 'layouts.dashboard_list' => 'layout.dashboard_list', 'layout.dashboard_add' => 'layout.dashboard_add', 'dynamic_get.create' => 'dynamic_get.create', 'dynamic_gets.access' => 'dynamic_get.access', 'dynamic_get.access' => 'dynamic_get.access', 'dynamic_gets.submenu' => 'dynamic_get.submenu', 'dynamic_gets.dashboard_list' => 'dynamic_get.dashboard_list', 'dynamic_get.dashboard_add' => 'dynamic_get.dashboard_add', 'snippets.access' => 'snippet.access', 'snippet.access' => 'snippet.access', 'snippets.submenu' => 'snippet.submenu', 'snippets.dashboard_list' => 'snippet.dashboard_list', 'snippet.dashboard_add' => 'snippet.dashboard_add', 'field.create' => 'field.create', 'fields.access' => 'field.access', 'field.access' => 'field.access', 'fields.submenu' => 'field.submenu', 'fields.dashboard_list' => 'field.dashboard_list', 'field.dashboard_add' => 'field.dashboard_add', 'fieldtype.create' => 'fieldtype.create', 'fieldtypes.access' => 'fieldtype.access', 'fieldtype.access' => 'fieldtype.access', 'fieldtypes.submenu' => 'fieldtype.submenu', 'fieldtypes.dashboard_list' => 'fieldtype.dashboard_list', 'fieldtype.dashboard_add' => 'fieldtype.dashboard_add', 'help_document.create' => 'help_document.create', 'help_documents.access' => 'help_document.access', 'help_document.access' => 'help_document.access', 'help_documents.submenu' => 'help_document.submenu', 'help_documents.dashboard_list' => 'help_document.dashboard_list', 'help_document.dashboard_add' => 'help_document.dashboard_add'); foreach ($viewGroups as $group => $views) { $i = 0; if (ComponentbuilderHelper::checkArray($views)) { foreach ($views as $view) { $add = false; if (strpos($view, '.') !== false) { $dwd = explode('.', $view); if (count($dwd) == 3) { list($type, $name, $action) = $dwd; } elseif (count($dwd) == 2) { list($type, $name) = $dwd; $action = false; } if ($action) { $viewName = $name; switch ($action) { case 'add': $url = 'index.php?option=com_componentbuilder&view=' . $name . '&layout=edit'; $image = $name . '_' . $action . '.' . $type; $alt = $name . ' ' . $action; $name = 'COM_COMPONENTBUILDER_DASHBOARD_' . ComponentbuilderHelper::safeString($name, 'U') . '_ADD'; $add = true; break; default: $url = 'index.php?option=com_categories&view=categories&extension=com_componentbuilder.' . $name; $image = $name . '_' . $action . '.' . $type; $alt = $name . ' ' . $action; $name = 'COM_COMPONENTBUILDER_DASHBOARD_' . ComponentbuilderHelper::safeString($name, 'U') . '_' . ComponentbuilderHelper::safeString($action, 'U'); break; } } else { $viewName = $name; $alt = $name; $url = 'index.php?option=com_componentbuilder&view=' . $name; $image = $name . '.' . $type; $name = 'COM_COMPONENTBUILDER_DASHBOARD_' . ComponentbuilderHelper::safeString($name, 'U'); $hover = false; } } else { $viewName = $view; $alt = $view; $url = 'index.php?option=com_componentbuilder&view=' . $view; $image = $view . '.png'; $name = ucwords($view) . '<br /><br />'; $hover = false; } // first make sure the view access is set if (ComponentbuilderHelper::checkArray($viewAccess)) { // setup some defaults $dashboard_add = false; $dashboard_list = false; $accessTo = ''; $accessAdd = ''; // acces checking start $accessCreate = isset($viewAccess[$viewName . '.create']) ? ComponentbuilderHelper::checkString($viewAccess[$viewName . '.create']) : false; $accessAccess = isset($viewAccess[$viewName . '.access']) ? ComponentbuilderHelper::checkString($viewAccess[$viewName . '.access']) : false; // set main controllers $accessDashboard_add = isset($viewAccess[$viewName . '.dashboard_add']) ? ComponentbuilderHelper::checkString($viewAccess[$viewName . '.dashboard_add']) : false; $accessDashboard_list = isset($viewAccess[$viewName . '.dashboard_list']) ? ComponentbuilderHelper::checkString($viewAccess[$viewName . '.dashboard_list']) : false; // check for adding access if ($add && $accessCreate) { $accessAdd = $viewAccess[$viewName . '.create']; } elseif ($add) { $accessAdd = 'core.create'; } // check if acces to view is set if ($accessAccess) { $accessTo = $viewAccess[$viewName . '.access']; } // set main access controllers if ($accessDashboard_add) { $dashboard_add = $user->authorise($viewAccess[$viewName . '.dashboard_add'], 'com_componentbuilder'); } if ($accessDashboard_list) { $dashboard_list = $user->authorise($viewAccess[$viewName . '.dashboard_list'], 'com_componentbuilder'); } if (ComponentbuilderHelper::checkString($accessAdd) && ComponentbuilderHelper::checkString($accessTo)) { // check access if ($user->authorise($accessAdd, 'com_componentbuilder') && $user->authorise($accessTo, 'com_componentbuilder') && $dashboard_add) { $icons[$group][$i] = new StdClass(); $icons[$group][$i]->url = $url; $icons[$group][$i]->name = $name; $icons[$group][$i]->image = $image; $icons[$group][$i]->alt = $alt; } } elseif (ComponentbuilderHelper::checkString($accessTo)) { // check access if ($user->authorise($accessTo, 'com_componentbuilder') && $dashboard_list) { $icons[$group][$i] = new StdClass(); $icons[$group][$i]->url = $url; $icons[$group][$i]->name = $name; $icons[$group][$i]->image = $image; $icons[$group][$i]->alt = $alt; } } elseif (ComponentbuilderHelper::checkString($accessAdd)) { // check access if ($user->authorise($accessAdd, 'com_componentbuilder') && $dashboard_add) { $icons[$group][$i] = new StdClass(); $icons[$group][$i]->url = $url; $icons[$group][$i]->name = $name; $icons[$group][$i]->image = $image; $icons[$group][$i]->alt = $alt; } } else { $icons[$group][$i] = new StdClass(); $icons[$group][$i]->url = $url; $icons[$group][$i]->name = $name; $icons[$group][$i]->image = $image; $icons[$group][$i]->alt = $alt; } } else { $icons[$group][$i] = new StdClass(); $icons[$group][$i]->url = $url; $icons[$group][$i]->name = $name; $icons[$group][$i]->image = $image; $icons[$group][$i]->alt = $alt; } $i++; } } else { $icons[$group][$i] = false; } } return $icons; }
/** * Setting the toolbar */ protected function addToolBar() { JToolBarHelper::title(JText::_('COM_COMPONENTBUILDER_IMPORT_TITLE'), 'upload'); JHtmlSidebar::setAction('index.php?option=com_componentbuilder&view=import'); if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) { JToolBarHelper::preferences('com_componentbuilder'); } // set help url for this view if found $help_url = ComponentbuilderHelper::getHelpUrl('import'); if (ComponentbuilderHelper::checkString($help_url)) { JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); } }
@author Llewellyn van der Merwe <https://www.vdm.io/joomla-component-builder> @copyright Copyright (C) 2015. All Rights Reserved @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html Builds Complex Joomla Components /-----------------------------------------------------------------------------------------------------------------------------*/ // No direct access to this file defined('_JEXEC') or die('Restricted access'); $edit = "index.php?option=com_componentbuilder&view=fields&task=field.edit"; foreach ($this->items as $i => $item) { ?> <?php $canCheckin = $this->user->authorise('core.manage', 'com_checkin') || $item->checked_out == $this->user->id || $item->checked_out == 0; $userChkOut = JFactory::getUser($item->checked_out); $canDo = ComponentbuilderHelper::getActions('field', $item, 'fields'); ?> <tr class="row<?php echo $i % 2; ?> "> <td class="order nowrap center hidden-phone"> <?php if ($canDo->get('field.edit.state')) { ?> <?php if ($this->saveOrder) { $iconClass = ' inactive'; } else { $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); }
/** * Get UIKIT Components **/ public static function getUikitComp($content, $classes = array()) { if (strpos($content, 'class="uk-') !== false) { // reset $temp = array(); foreach (self::$uk_components as $looking => $add) { if (strpos($content, $looking) !== false) { $temp[] = $looking; } } // make sure uikit is loaded to config if (strpos($content, 'class="uk-') !== false) { self::$uikit = true; } // sorter if (self::checkArray($temp)) { // merger if (self::checkArray($classes)) { $newTemp = array_merge($temp, $classes); $temp = array_unique($newTemp); } return $temp; } } if (self::checkArray($classes)) { return $classes; } return false; }
/** * Method to save the form data. * * @param array $data The form data. * * @return boolean True on success. * * @since 1.6 */ public function save($data) { $input = JFactory::getApplication()->input; $filter = JFilterInput::getInstance(); // set the metadata to the Item Data if (isset($data['metadata']) && isset($data['metadata']['author'])) { $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); $metadata = new JRegistry(); $metadata->loadArray($data['metadata']); $data['metadata'] = (string) $metadata; } // Set the php_helper_site string to base64 string. if (isset($data['php_helper_site'])) { $data['php_helper_site'] = base64_encode($data['php_helper_site']); } // Set the php_helper_admin string to base64 string. if (isset($data['php_helper_admin'])) { $data['php_helper_admin'] = base64_encode($data['php_helper_admin']); } // Set the sql string to base64 string. if (isset($data['sql'])) { $data['sql'] = base64_encode($data['sql']); } // Set the php_admin_event string to base64 string. if (isset($data['php_admin_event'])) { $data['php_admin_event'] = base64_encode($data['php_admin_event']); } // Set the php_site_event string to base64 string. if (isset($data['php_site_event'])) { $data['php_site_event'] = base64_encode($data['php_site_event']); } // Set the php_dashboard_methods string to base64 string. if (isset($data['php_dashboard_methods'])) { $data['php_dashboard_methods'] = base64_encode($data['php_dashboard_methods']); } // Set the css string to base64 string. if (isset($data['css'])) { $data['css'] = base64_encode($data['css']); } // Set the php_preflight_install string to base64 string. if (isset($data['php_preflight_install'])) { $data['php_preflight_install'] = base64_encode($data['php_preflight_install']); } // Set the php_preflight_update string to base64 string. if (isset($data['php_preflight_update'])) { $data['php_preflight_update'] = base64_encode($data['php_preflight_update']); } // Set the php_postflight_install string to base64 string. if (isset($data['php_postflight_install'])) { $data['php_postflight_install'] = base64_encode($data['php_postflight_install']); } // Set the php_postflight_update string to base64 string. if (isset($data['php_postflight_update'])) { $data['php_postflight_update'] = base64_encode($data['php_postflight_update']); } // Set the php_method_uninstall string to base64 string. if (isset($data['php_method_uninstall'])) { $data['php_method_uninstall'] = base64_encode($data['php_method_uninstall']); } // Set the readme string to base64 string. if (isset($data['readme'])) { $data['readme'] = base64_encode($data['readme']); } // Get the basic encription key. $basickey = ComponentbuilderHelper::getCryptKey('basic'); // Get the encription object $basic = new FOFEncryptAes($basickey, 128); // Encript data update_server_ftp. if (isset($data['update_server_ftp']) && $basickey) { $data['update_server_ftp'] = $basic->encryptString($data['update_server_ftp']); } // Encript data whmcs_key. if (isset($data['whmcs_key']) && $basickey) { $data['whmcs_key'] = $basic->encryptString($data['whmcs_key']); } // Encript data sales_server_ftp. if (isset($data['sales_server_ftp']) && $basickey) { $data['sales_server_ftp'] = $basic->encryptString($data['sales_server_ftp']); } // Set the Params Items to data if (isset($data['params']) && is_array($data['params'])) { $params = new JRegistry(); $params->loadArray($data['params']); $data['params'] = (string) $params; } // Alter the uniqe field for save as copy if ($input->get('task') == 'save2copy') { // Automatic handling of other uniqe fields $uniqeFields = $this->getUniqeFields(); if (ComponentbuilderHelper::checkArray($uniqeFields)) { foreach ($uniqeFields as $uniqeField) { $data[$uniqeField] = $this->generateUniqe($uniqeField, $data[$uniqeField]); } } } if (parent::save($data)) { return true; } return false; }