diff --git a/README.md b/README.md index 046aa492e..77975c248 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ The Component Builder for [Joomla](https://extensions.joomla.org/extension/compo Whether you're a seasoned [Joomla](https://extensions.joomla.org/extension/component-builder/) developer, or have just started, Component Builder will safe you lots of time and money. A real must have! -You can install it quite easily and with no limitations. On [github](https://github.com/vdm-io/Joomla-Component-Builder/releases) is the latest release (2.6.15) with **ALL** its features and **ALL** concepts totally open-source and free! +You can install it quite easily and with no limitations. On [github](https://github.com/vdm-io/Joomla-Component-Builder/releases) is the latest release (2.6.16) with **ALL** its features and **ALL** concepts totally open-source and free! > Watch Quick Build of a Hello World component in [JCB on Youtube](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=45) @@ -126,13 +126,13 @@ Component Builder is mapped as a component in itself on my local development env + *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) + *Name*: [Component Builder](http://joomlacomponentbuilder.com) + *First Build*: 30th April, 2015 -+ *Last Build*: 19th February, 2018 -+ *Version*: 2.6.15 ++ *Last Build*: 20th February, 2018 ++ *Version*: 2.6.16 + *Copyright*: Copyright (C) 2015. All Rights Reserved + *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html -+ *Line count*: **182095** ++ *Line count*: **182404** + *Field count*: **1639** -+ *File count*: **1167** ++ *File count*: **1168** + *Folder count*: **188** > This **component** was build with a Joomla [Automated Component Builder](http://joomlacomponentbuilder.com). diff --git a/admin/README.txt b/admin/README.txt index 046aa492e..77975c248 100644 --- a/admin/README.txt +++ b/admin/README.txt @@ -9,7 +9,7 @@ The Component Builder for [Joomla](https://extensions.joomla.org/extension/compo Whether you're a seasoned [Joomla](https://extensions.joomla.org/extension/component-builder/) developer, or have just started, Component Builder will safe you lots of time and money. A real must have! -You can install it quite easily and with no limitations. On [github](https://github.com/vdm-io/Joomla-Component-Builder/releases) is the latest release (2.6.15) with **ALL** its features and **ALL** concepts totally open-source and free! +You can install it quite easily and with no limitations. On [github](https://github.com/vdm-io/Joomla-Component-Builder/releases) is the latest release (2.6.16) with **ALL** its features and **ALL** concepts totally open-source and free! > Watch Quick Build of a Hello World component in [JCB on Youtube](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=45) @@ -126,13 +126,13 @@ Component Builder is mapped as a component in itself on my local development env + *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) + *Name*: [Component Builder](http://joomlacomponentbuilder.com) + *First Build*: 30th April, 2015 -+ *Last Build*: 19th February, 2018 -+ *Version*: 2.6.15 ++ *Last Build*: 20th February, 2018 ++ *Version*: 2.6.16 + *Copyright*: Copyright (C) 2015. All Rights Reserved + *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html -+ *Line count*: **182095** ++ *Line count*: **182404** + *Field count*: **1639** -+ *File count*: **1167** ++ *File count*: **1168** + *Folder count*: **188** > This **component** was build with a Joomla [Automated Component Builder](http://joomlacomponentbuilder.com). diff --git a/admin/config.xml b/admin/config.xml index 96d7b1a5d..4a12248d7 100644 --- a/admin/config.xml +++ b/admin/config.xml @@ -547,6 +547,27 @@ description="COM_COMPONENTBUILDER_CONFIG_BACKUPCRONJOB_NOTE_DESCRIPTION" heading="h4" class="backupcronjob_note" /> + + + + + + + + + hint="COM_COMPONENTBUILDER_CONFIG_CRONJOB_BACKUP_FOLDER_PATH_HINT" + showon="cronjob_backup_type:1" /> params) || !ComponentbuilderHelper::checkObject($this->params)) { $this->params = JComponentHelper::getParams('com_componentbuilder'); } - // get all component IDs to backup - $pks = componentbuilderHelper::getComponentIDs(); // Get the model $model = componentbuilderHelper::getModel('joomla_components', JPATH_ADMINISTRATOR . '/components/com_componentbuilder'); // set user $model->user = $this->getApiUser(); - // make sure to set active type to backup - $model->activeType = 'manualBackup'; - // set auto loader - ComponentbuilderHelper::autoLoader('smart'); - // manual backup message - $backupNotice = array(); - // get the data to export - if (ComponentbuilderHelper::checkArray($pks) && $model->getSmartExport($pks)) + // check if export is allowed for this user. (we need this sorry) + if ($model->user->authorise('joomla_component.export', 'com_componentbuilder') && $model->user->authorise('core.export', 'com_componentbuilder')) { - $backupNotice[] = JText::_('COM_COMPONENTBUILDER_BACKUP_WAS_DONE_SUCCESSFULLY'); - $backupNoticeStatus = 'Success'; - // set the key string - if (componentbuilderHelper::checkString($model->key) && strlen($model->key) == 32) + // get all component IDs to backup + $pks = componentbuilderHelper::getComponentIDs(); + // make sure to set active type to backup + $model->activeType = 'manualBackup'; + // set auto loader + ComponentbuilderHelper::autoLoader('smart'); + // manual backup message + $backupNotice = array(); + // get the data to export + if (ComponentbuilderHelper::checkArray($pks) && $model->getSmartExport($pks)) { - $textNotice = array(); - $keyNotice = '

' . JText::sprintf('COM_COMPONENTBUILDER_THE_PACKAGE_KEY_IS_CODESCODE', $model->key) . '

'; - $textNotice[] = JText::sprintf('COM_COMPONENTBUILDER_THE_PACKAGE_KEY_IS_S', $model->key); - $keyNotice .= JText::_('COM_COMPONENTBUILDER_YOUR_DATA_IS_ENCRYPTED_WITH_A_AES_ONE_HUNDRED_AND_TWENTY_EIGHT_BIT_ENCRYPTION_USING_THE_ABOVE_THIRTY_TWO_CHARACTER_KEY_WITHOUT_THIS_KEY_IT_WILL_TAKE_THE_CURRENT_TECHNOLOGY_WITH_A_BRUTE_FORCE_ATTACK_METHOD_MORE_THEN_A_HREFHTTPRANDOMIZECOMHOWLONGTOHACKPASS_TARGET_BLANK_TITLEHOW_LONG_TO_HACK_PASSSEVEN_HUNDRED_ZERO_ZERO_ZERO_ZERO_ZERO_ZERO_ZERO_ZERO_ZERO_ZEROA_YEARS_TO_CRACK_THEORETICALLY_UNLESS_THEY_HAVE_THIS_KEY_ABOVE_SO_DO_KEEP_IT_SAFE') . '
'; - // set the package owner info - if ((isset($model->info['getKeyFrom']['company']) && componentbuilderHelper::checkString($model->info['getKeyFrom']['company'])) || (isset($model->info['getKeyFrom']['owner']) && componentbuilderHelper::checkString($model->info['getKeyFrom']['owner']))) + $backupNotice[] = JText::_('COM_COMPONENTBUILDER_BACKUP_WAS_DONE_SUCCESSFULLY'); + $backupNoticeStatus = 'Success'; + // set the key string + if (componentbuilderHelper::checkString($model->key) && strlen($model->key) == 32) { - $ownerDetails = '

' . JText::_('COM_COMPONENTBUILDER_PACKAGE_OWNER_DETAILS') . '

'; - $textNotice[] = '# ' . JText::_('COM_COMPONENTBUILDER_PACKAGE_OWNER_DETAILS'); - $ownerDetails .= '
    '; - if (isset($model->info['getKeyFrom']['company']) && componentbuilderHelper::checkString($model->info['getKeyFrom']['company'])) + $textNotice = array(); + $keyNotice = '

    ' . JText::sprintf('COM_COMPONENTBUILDER_THE_PACKAGE_KEY_IS_CODESCODE', $model->key) . '

    '; + $textNotice[] = JText::sprintf('COM_COMPONENTBUILDER_THE_PACKAGE_KEY_IS_S', $model->key); + $keyNotice .= JText::_('COM_COMPONENTBUILDER_YOUR_DATA_IS_ENCRYPTED_WITH_A_AES_ONE_HUNDRED_AND_TWENTY_EIGHT_BIT_ENCRYPTION_USING_THE_ABOVE_THIRTY_TWO_CHARACTER_KEY_WITHOUT_THIS_KEY_IT_WILL_TAKE_THE_CURRENT_TECHNOLOGY_WITH_A_BRUTE_FORCE_ATTACK_METHOD_MORE_THEN_A_HREFHTTPRANDOMIZECOMHOWLONGTOHACKPASS_TARGET_BLANK_TITLEHOW_LONG_TO_HACK_PASSSEVEN_HUNDRED_ZERO_ZERO_ZERO_ZERO_ZERO_ZERO_ZERO_ZERO_ZERO_ZEROA_YEARS_TO_CRACK_THEORETICALLY_UNLESS_THEY_HAVE_THIS_KEY_ABOVE_SO_DO_KEEP_IT_SAFE') . '
    '; + // set the package owner info + if ((isset($model->info['getKeyFrom']['company']) && componentbuilderHelper::checkString($model->info['getKeyFrom']['company'])) || (isset($model->info['getKeyFrom']['owner']) && componentbuilderHelper::checkString($model->info['getKeyFrom']['owner']))) { - $ownerDetails .= '
  • ' . JText::sprintf('COM_COMPONENTBUILDER_EMCOMPANYEM_BSB', $model->info['getKeyFrom']['company']) . '
  • '; - $textNotice[] = '- ' . JText::sprintf('COM_COMPONENTBUILDER_COMPANY_S', $model->info['getKeyFrom']['company']); + $ownerDetails = '

    ' . JText::_('COM_COMPONENTBUILDER_PACKAGE_OWNER_DETAILS') . '

    '; + $textNotice[] = '# ' . JText::_('COM_COMPONENTBUILDER_PACKAGE_OWNER_DETAILS'); + $ownerDetails .= '
      '; + if (isset($model->info['getKeyFrom']['company']) && componentbuilderHelper::checkString($model->info['getKeyFrom']['company'])) + { + $ownerDetails .= '
    • ' . JText::sprintf('COM_COMPONENTBUILDER_EMCOMPANYEM_BSB', $model->info['getKeyFrom']['company']) . '
    • '; + $textNotice[] = '- ' . JText::sprintf('COM_COMPONENTBUILDER_COMPANY_S', $model->info['getKeyFrom']['company']); + } + // add value only if set + if (isset($model->info['getKeyFrom']['owner']) && componentbuilderHelper::checkString($model->info['getKeyFrom']['owner'])) + { + $ownerDetails .= '
    • ' . JText::sprintf('COM_COMPONENTBUILDER_EMOWNEREM_BSB', $model->info['getKeyFrom']['owner']) . '
    • '; + $textNotice[] = '- ' . JText::sprintf('COM_COMPONENTBUILDER_OWNER_S', $model->info['getKeyFrom']['owner']); + } + // add value only if set + if (isset($model->info['getKeyFrom']['website']) && componentbuilderHelper::checkString($model->info['getKeyFrom']['website'])) + { + $ownerDetails .= '
    • ' . JText::sprintf('COM_COMPONENTBUILDER_EMWEBSITEEM_BSB', $model->info['getKeyFrom']['website']) . '
    • '; + $textNotice[] = '- ' . JText::sprintf('COM_COMPONENTBUILDER_WEBSITE_S', $model->info['getKeyFrom']['website']); + } + // add value only if set + if (isset($model->info['getKeyFrom']['email']) && componentbuilderHelper::checkString($model->info['getKeyFrom']['email'])) + { + $ownerDetails .= '
    • ' . JText::sprintf('COM_COMPONENTBUILDER_EMEMAILEM_BSB', $model->info['getKeyFrom']['email']) . '
    • '; + $textNotice[] = '- ' . JText::sprintf('COM_COMPONENTBUILDER_EMAIL_S', $model->info['getKeyFrom']['email']); + } + // add value only if set + if (isset($model->info['getKeyFrom']['license']) && componentbuilderHelper::checkString($model->info['getKeyFrom']['license'])) + { + $ownerDetails .= '
    • ' . JText::sprintf('COM_COMPONENTBUILDER_EMLICENSEEM_BSB', $model->info['getKeyFrom']['license']) . '
    • '; + $textNotice[] = '- ' . JText::sprintf('COM_COMPONENTBUILDER_LICENSE_S', $model->info['getKeyFrom']['license']); + } + // add value only if set + if (isset($model->info['getKeyFrom']['copyright']) && componentbuilderHelper::checkString($model->info['getKeyFrom']['copyright'])) + { + $ownerDetails .= '
    • ' . JText::sprintf('COM_COMPONENTBUILDER_EMCOPYRIGHTEM_BSB', $model->info['getKeyFrom']['copyright']) . '
    • '; + $textNotice[] = '- ' . JText::sprintf('COM_COMPONENTBUILDER_COPYRIGHT_S', $model->info['getKeyFrom']['copyright']); + } + $ownerDetails .= '
    '; + $backupNotice[] = JText::_('COM_COMPONENTBUILDER_OWNER_DETAILS_WAS_SET'); } - // add value only if set - if (isset($model->info['getKeyFrom']['owner']) && componentbuilderHelper::checkString($model->info['getKeyFrom']['owner'])) + else { - $ownerDetails .= '
  • ' . JText::sprintf('COM_COMPONENTBUILDER_EMOWNEREM_BSB', $model->info['getKeyFrom']['owner']) . '
  • '; - $textNotice[] = '- ' . JText::sprintf('COM_COMPONENTBUILDER_OWNER_S', $model->info['getKeyFrom']['owner']); + $ownerDetails = '

    ' . JText::_('COM_COMPONENTBUILDER_PACKAGE_OWNER_NOT_SET') . '

    '; + $textNotice[] = '# ' . JText::_('COM_COMPONENTBUILDER_PACKAGE_OWNER_DETAILS'); + $ownerDetails .= JText::_('COM_COMPONENTBUILDER_TO_CHANGE_THE_PACKAGE_OWNER_DEFAULTS_OPEN_THE_BJCB_GLOBAL_OPTIONSB_GO_TO_THE_BCOMPANYB_TAB_AND_ADD_THE_CORRECT_COMPANY_DETAILS_THERE') . '
    '; + $textNotice[] = JText::_('COM_COMPONENTBUILDER_TO_CHANGE_THE_PACKAGE_OWNER_DEFAULTS_OPEN_THE_JCB_GLOBAL_OPTIONS_GO_TO_THE_COMPANY_TAB_AND_ADD_THE_CORRECT_COMPANY_DETAILS_THERE'); + $ownerDetails .= '

    ' . JText::_('COM_COMPONENTBUILDER_YOU_SHOULD_ADD_THE_CORRECT_OWNER_DETAILS') . '

    '; + $textNotice[] = '## ' . JText::_('COM_COMPONENTBUILDER_YOU_SHOULD_ADD_THE_CORRECT_OWNER_DETAILS'); + $ownerDetails .= JText::_('COM_COMPONENTBUILDER_SINCE_THE_OWNER_DETAILS_ARE_DISPLAYED_DURING_BIMPORT_PROCESSB_BEFORE_ADDING_THE_KEY_THIS_WAY_IF_THE_USERDEV_BDOES_NOTB_HAVE_THE_KEY_THEY_CAN_SEE_BWHERE_TO_GET_ITB') . '
    '; + $textNotice[] = JText::_('COM_COMPONENTBUILDER_SINCE_THE_OWNER_DETAILS_ARE_DISPLAYED_DURING_IMPORT_PROCESS_BEFORE_ADDING_THE_KEY_THIS_WAY_IF_THE_USERDEV_DOES_NOT_HAVE_THE_KEY_THEY_CAN_SEE_WHERE_TO_GET_IT'); + $backupNotice[] = JText::_('COM_COMPONENTBUILDER_CHECK_YOUR_OWNER_DETAILS_IT_HAS_NOT_BEEN_SET_OPEN_THE_JCB_GLOBAL_OPTIONS_GO_TO_THE_COMPANY_TAB_AND_ADD_THE_CORRECT_COMPANY_DETAILS_THERE'); } - // add value only if set - if (isset($model->info['getKeyFrom']['website']) && componentbuilderHelper::checkString($model->info['getKeyFrom']['website'])) - { - $ownerDetails .= '
  • ' . JText::sprintf('COM_COMPONENTBUILDER_EMWEBSITEEM_BSB', $model->info['getKeyFrom']['website']) . '
  • '; - $textNotice[] = '- ' . JText::sprintf('COM_COMPONENTBUILDER_WEBSITE_S', $model->info['getKeyFrom']['website']); - } - // add value only if set - if (isset($model->info['getKeyFrom']['email']) && componentbuilderHelper::checkString($model->info['getKeyFrom']['email'])) - { - $ownerDetails .= '
  • ' . JText::sprintf('COM_COMPONENTBUILDER_EMEMAILEM_BSB', $model->info['getKeyFrom']['email']) . '
  • '; - $textNotice[] = '- ' . JText::sprintf('COM_COMPONENTBUILDER_EMAIL_S', $model->info['getKeyFrom']['email']); - } - // add value only if set - if (isset($model->info['getKeyFrom']['license']) && componentbuilderHelper::checkString($model->info['getKeyFrom']['license'])) - { - $ownerDetails .= '
  • ' . JText::sprintf('COM_COMPONENTBUILDER_EMLICENSEEM_BSB', $model->info['getKeyFrom']['license']) . '
  • '; - $textNotice[] = '- ' . JText::sprintf('COM_COMPONENTBUILDER_LICENSE_S', $model->info['getKeyFrom']['license']); - } - // add value only if set - if (isset($model->info['getKeyFrom']['copyright']) && componentbuilderHelper::checkString($model->info['getKeyFrom']['copyright'])) - { - $ownerDetails .= '
  • ' . JText::sprintf('COM_COMPONENTBUILDER_EMCOPYRIGHTEM_BSB', $model->info['getKeyFrom']['copyright']) . '
  • '; - $textNotice[] = '- ' . JText::sprintf('COM_COMPONENTBUILDER_COPYRIGHT_S', $model->info['getKeyFrom']['copyright']); - } - $ownerDetails .= '
'; - $backupNotice[] = JText::_('COM_COMPONENTBUILDER_OWNER_DETAILS_WAS_SET'); } else { - $ownerDetails = '

' . JText::_('COM_COMPONENTBUILDER_PACKAGE_OWNER_NOT_SET') . '

'; - $textNotice[] = '# ' . JText::_('COM_COMPONENTBUILDER_PACKAGE_OWNER_DETAILS'); - $ownerDetails .= JText::_('COM_COMPONENTBUILDER_TO_CHANGE_THE_PACKAGE_OWNER_DEFAULTS_OPEN_THE_BJCB_GLOBAL_OPTIONSB_GO_TO_THE_BCOMPANYB_TAB_AND_ADD_THE_CORRECT_COMPANY_DETAILS_THERE') . '
'; - $textNotice[] = JText::_('COM_COMPONENTBUILDER_TO_CHANGE_THE_PACKAGE_OWNER_DEFAULTS_OPEN_THE_JCB_GLOBAL_OPTIONS_GO_TO_THE_COMPANY_TAB_AND_ADD_THE_CORRECT_COMPANY_DETAILS_THERE'); - $ownerDetails .= '

' . JText::_('COM_COMPONENTBUILDER_YOU_SHOULD_ADD_THE_CORRECT_OWNER_DETAILS') . '

'; - $textNotice[] = '## ' . JText::_('COM_COMPONENTBUILDER_YOU_SHOULD_ADD_THE_CORRECT_OWNER_DETAILS'); - $ownerDetails .= JText::_('COM_COMPONENTBUILDER_SINCE_THE_OWNER_DETAILS_ARE_DISPLAYED_DURING_BIMPORT_PROCESSB_BEFORE_ADDING_THE_KEY_THIS_WAY_IF_THE_USERDEV_BDOES_NOTB_HAVE_THE_KEY_THEY_CAN_SEE_BWHERE_TO_GET_ITB') . '
'; - $textNotice[] = JText::_('COM_COMPONENTBUILDER_SINCE_THE_OWNER_DETAILS_ARE_DISPLAYED_DURING_IMPORT_PROCESS_BEFORE_ADDING_THE_KEY_THIS_WAY_IF_THE_USERDEV_DOES_NOT_HAVE_THE_KEY_THEY_CAN_SEE_WHERE_TO_GET_IT'); - $backupNotice[] = JText::_('COM_COMPONENTBUILDER_CHECK_YOUR_OWNER_DETAILS_IT_HAS_NOT_BEEN_SET_OPEN_THE_JCB_GLOBAL_OPTIONS_GO_TO_THE_COMPANY_TAB_AND_ADD_THE_CORRECT_COMPANY_DETAILS_THERE'); + $keyNotice = '

' . JText::_('COM_COMPONENTBUILDER_THIS_PACKAGE_HAS_NO_KEY') . '

'; + $textNotice[] = '# ' . JText::_('COM_COMPONENTBUILDER_THIS_PACKAGE_HAS_NO_KEY'); + $ownerDetails = JText::_('COM_COMPONENTBUILDER_THAT_MEANS_ANYONE_WHO_HAS_THIS_PACKAGE_CAN_INSTALL_IT_INTO_JCB_TO_ADD_AN_EXPORT_KEY_SIMPLY_OPEN_THE_COMPONENT_GO_TO_THE_TAB_CALLED_BSETTINGSB_BOTTOM_RIGHT_THERE_IS_A_FIELD_CALLED_BEXPORT_KEYB') . '
'; + $textNotice[] = JText::_('COM_COMPONENTBUILDER_THAT_MEANS_ANYONE_WHO_HAS_THIS_PACKAGE_CAN_INSTALL_IT_INTO_JCB_TO_ADD_AN_EXPORT_KEY_SIMPLY_OPEN_THE_COMPONENT_GO_TO_THE_TAB_CALLED_SETTINGS_BOTTOM_RIGHT_THERE_IS_A_FIELD_CALLED_EXPORT_KEY'); + $backupNotice[] = JText::_('COM_COMPONENTBUILDER_NO_KEYS_WERE_FOUND_TO_ADD_AN_EXPORT_KEY_SIMPLY_OPEN_THE_COMPONENT_GO_TO_THE_TAB_CALLED_SETTINGS_BOTTOM_RIGHT_THERE_IS_A_FIELD_CALLED_EXPORT_KEY'); + } + // get email + if ($email = $this->params->get('backup_email', null)) + { + // plain text + $plainText = implode("\n", $textNotice); + // set hash to track changes + $hashTracker = md5($plainText); + if (ComponentbuilderHelper::newHash($hashTracker)) + { + // Build final massage. + $message = $keyNotice . $ownerDetails . '
HASH: ' . $hashTracker . ''; + // set the subject + $subject = JText::_('COM_COMPONENTBUILDER_JOOMLA_COMPONENT_BUILDER_BACKUP_KEY'); + // email the message + componentbuilderEmail::send($email, $subject, componentbuilderEmail::setTableBody($message, $subject), $plainText, 1); + $backupNotice[] = JText::_('COM_COMPONENTBUILDER_EMAIL_WITH_THE_NEW_KEY_WAS_SEND'); + } + else + { + $backupNotice[] = JText::_('COM_COMPONENTBUILDER_KEY_HAS_NOT_CHANGED'); + } } } else { - $keyNotice = '

' . JText::_('COM_COMPONENTBUILDER_THIS_PACKAGE_HAS_NO_KEY') . '

'; - $textNotice[] = '# ' . JText::_('COM_COMPONENTBUILDER_THIS_PACKAGE_HAS_NO_KEY'); - $ownerDetails = JText::_('COM_COMPONENTBUILDER_THAT_MEANS_ANYONE_WHO_HAS_THIS_PACKAGE_CAN_INSTALL_IT_INTO_JCB_TO_ADD_AN_EXPORT_KEY_SIMPLY_OPEN_THE_COMPONENT_GO_TO_THE_TAB_CALLED_BSETTINGSB_BOTTOM_RIGHT_THERE_IS_A_FIELD_CALLED_BEXPORT_KEYB') . '
'; - $textNotice[] = JText::_('COM_COMPONENTBUILDER_THAT_MEANS_ANYONE_WHO_HAS_THIS_PACKAGE_CAN_INSTALL_IT_INTO_JCB_TO_ADD_AN_EXPORT_KEY_SIMPLY_OPEN_THE_COMPONENT_GO_TO_THE_TAB_CALLED_SETTINGS_BOTTOM_RIGHT_THERE_IS_A_FIELD_CALLED_EXPORT_KEY'); - $backupNotice[] = JText::_('COM_COMPONENTBUILDER_NO_KEYS_WERE_FOUND_TO_ADD_AN_EXPORT_KEY_SIMPLY_OPEN_THE_COMPONENT_GO_TO_THE_TAB_CALLED_SETTINGS_BOTTOM_RIGHT_THERE_IS_A_FIELD_CALLED_EXPORT_KEY'); - } - // get email - if ($email = $this->params->get('backup_email', null)) - { - // plain text - $plainText = implode("\n", $textNotice); - // set hash to track changes - $hashTracker = md5($plainText); - if (ComponentbuilderHelper::newHash($hashTracker)) + $backupNotice[] = JText::_('COM_COMPONENTBUILDER_BACKUP_FAILED_PLEASE_TRY_AGAIN_IF_THE_ERROR_CONTINUE_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR'); + $backupNoticeStatus = 'Error'; + if (componentbuilderHelper::checkString($model->packagePath)) { - // Build final massage. - $message = $keyNotice . $ownerDetails . '
HASH: ' . $hashTracker . ''; - // set the subject - $subject = JText::_('COM_COMPONENTBUILDER_JOOMLA_COMPONENT_BUILDER_BACKUP_KEY'); - // email the message - componentbuilderEmail::send($email, $subject, componentbuilderEmail::setTableBody($message, $subject), $plainText, 1); - $backupNotice[] = JText::_('COM_COMPONENTBUILDER_EMAIL_WITH_THE_NEW_KEY_WAS_SEND'); + // clear all if not successful + ComponentbuilderHelper::removeFolder($model->packagePath); } - else + if (componentbuilderHelper::checkString($model->zipPath)) { - $backupNotice[] = JText::_('COM_COMPONENTBUILDER_KEY_HAS_NOT_CHANGED'); - } + // clear all if not successful + JFile::delete($model->zipPath); + } } - } - else - { - $backupNotice[] = JText::_('COM_COMPONENTBUILDER_BACKUP_FAILED_PLEASE_TRY_AGAIN_IF_THE_ERROR_CONTINUE_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR'); - $backupNoticeStatus = 'Error'; - if (componentbuilderHelper::checkString($model->packagePath)) + // quite only if auto backup (adding this script from custom code :) + if ('backup' === 'manualBackup') { - // clear all if not successful - ComponentbuilderHelper::removeFolder($model->packagePath); + echo "# " . $backupNoticeStatus . "\n" .implode("\n", $backupNotice); + // clear session + JFactory::getApplication()->getSession()->destroy(); + jexit(); } - if (componentbuilderHelper::checkString($model->zipPath)) - { - // clear all if not successful - JFile::delete($model->zipPath); - } + $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=joomla_components', false), implode("
", $backupNotice), $backupNoticeStatus); + return; } // quite only if auto backup (adding this script from custom code :) if ('backup' === 'manualBackup') { - echo "# " . $backupNoticeStatus . "\n" .implode("\n", $backupNotice); + echo "# Error\n".JText::_('COM_COMPONENTBUILDER_ACCESS_DENIED'); + // clear session + JFactory::getApplication()->getSession()->destroy(); jexit(); } - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=joomla_components', false), implode("
", $backupNotice), $backupNoticeStatus); + $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=joomla_components', false), JText::_('COM_COMPONENTBUILDER_ACCESS_DENIED'), 'Error'); return; - } - + } + protected function getApiUser() { // admin area does not have API user, only front-end (so we fallback on login user) diff --git a/admin/helpers/compiler.php b/admin/helpers/compiler.php index c911a2d38..591fe1b04 100644 --- a/admin/helpers/compiler.php +++ b/admin/helpers/compiler.php @@ -318,37 +318,10 @@ class Compiler extends Infusion // make sure we have the correct file if (JFile::exists($xml_update_server_path) && isset($this->componentData->update_server)) { - // use FTP - if ($this->componentData->update_server_protocol == 1) - { - // get server details - if ($ftp = ComponentbuilderHelper::getServer((int) $this->componentData->update_server, 1)) - { - // now move the file - if (!$ftp->store($xml_update_server_path, null)) - { - $this->app->enqueueMessage(JText::sprintf('The %s file could not be moved to %s server.', $this->updateServerFileName . '.xml', $$ftp->remote_server_name[(int) $this->componentData->update_server]), 'Error'); - } - // remove the local file - JFile::delete($xml_update_server_path); - // close the connection - $ftp->quit(); - } - } - // use SFTP - elseif ($this->componentData->update_server_protocol == 2) - { - if ($sftp = ComponentbuilderHelper::getServer((int) $this->componentData->update_server, 2)) - { - // now move the file - if (!$sftp->put($sftp->remote_server_path[(int) $this->componentData->update_server] . $this->updateServerFileName . '.xml', ComponentbuilderHelper::getFileContents($xml_update_server_path, null))) - { - $this->app->enqueueMessage(JText::sprintf('The %s file could not be moved to %s path on %s server.', $this->updateServerFileName . '.xml', $sftp->remote_server_path[(int) $this->componentData->update_server], $sftp->remote_server_name[(int) $this->componentData->update_server]), 'Error'); - } - // remove the local file - JFile::delete($xml_update_server_path); - } - } + // move to server + ComponentbuilderHelper::moveToServer($xml_update_server_path, $this->updateServerFileName . '.xml', (int) $this->componentData->update_server, $this->componentData->update_server_protocol); + // remove the local file + JFile::delete($xml_update_server_path); } } } @@ -519,32 +492,8 @@ class Compiler extends Infusion // make sure we have the correct file if (isset($this->componentData->sales_server)) { - // use FTP - if ($this->componentData->sales_server_protocol == 1) - { - if ($ftp = ComponentbuilderHelper::getServer((int) $this->componentData->sales_server, 1)) - { - // now move the file - if (!$ftp->store($xml_update_server_path, $this->componentSalesName . '.zip')) - { - $this->app->enqueueMessage(JText::sprintf('The %s file could not be moved to %s server.', $this->componentSalesName . '.zip', $ftp->remote_server_name[(int) $this->componentData->sales_server]), 'Error'); - } - // close the connection - $ftp->quit(); - } - } - // use SFTP - elseif ($this->componentData->sales_server_protocol == 2) - { - if ($sftp = ComponentbuilderHelper::getServer((int) $this->componentData->sales_server, 2)) - { - // now move the file - if (!$sftp->put($sftp->remote_server_path[(int) $this->componentData->sales_server] . $this->componentSalesName . '.zip', ComponentbuilderHelper::getFileContents($this->filepath, null))) - { - $this->app->enqueueMessage(JText::sprintf('The %s file could not be moved to %s path on %s server.', $this->componentSalesName . '.zip', $sftp->remote_server_path[(int) $this->componentData->sales_server], $sftp->remote_server_name[(int) $this->componentData->sales_server]), 'Error'); - } - } - } + // move to server + ComponentbuilderHelper::moveToServer($this->filepath, $this->componentSalesName . '.zip', (int) $this->componentData->sales_server, $this->componentData->sales_server_protocol); } } // remove the component folder since we are done diff --git a/admin/helpers/componentbuilder.php b/admin/helpers/componentbuilder.php index ba67fe5aa..0674a8926 100644 --- a/admin/helpers/componentbuilder.php +++ b/admin/helpers/componentbuilder.php @@ -1953,6 +1953,49 @@ abstract class ComponentbuilderHelper require_once JPATH_ADMINISTRATOR.'/components/com_componentbuilder/helpers/vendor/autoload.php'; } + /** + * Move File to Server + * + * @param string $localPath The local path to the file + * @param string $fileName The the actual file name + * @param int $serverID The server local id to use + * @param int $protocol The server protocol to use + * @param string $permission The permission validation area + * + * @return bool true on success + **/ + public static function moveToServer($localPath, $fileName, $serverID, $protocol = null, $permission = 'core.export') + { + // get the server + if ($server = self::getServer( (int) $serverID, $protocol, $permission)) + { + // use the FTP protocol + if (1 == $server->jcb_protocol) + { + // now move the file + if (!$server->store($localPath, $fileName)) + { + JFactory::getApplication()->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_THE_BSB_FILE_COULD_NOT_BE_MOVED_TO_BSB_SERVER', $fileName, $server->jcb_remote_server_name[(int) $serverID]), 'Error'); + return false; + } + // close the connection + $server->quit(); + } + // use the SFTP protocol + elseif (2 == $server->jcb_protocol) + { + // now move the file + if (!$server->put($server->jcb_remote_server_path[(int) $serverID] . $fileName, self::getFileContents($localPath, null))) + { + JFactory::getApplication()->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_THE_BSB_FILE_COULD_NOT_BE_MOVED_TO_BSB_PATH_ON_BSB_SERVER', $fileName, $server->jcb_remote_server_path[(int) $serverID], $server->jcb_remote_server_name[(int) $serverID]), 'Error'); + return false; + } + } + return true; + } + return false; + } + /** * the SFTP objects **/ @@ -1972,8 +2015,13 @@ abstract class ComponentbuilderHelper * * @return object on success server object **/ - public static function getServer($serverID, $protocol, $permission = 'core.export') + public static function getServer($serverID, $protocol = null, $permission = 'core.export') { + // if not protocol is given get it (sad I know) + if (!$protocol) + { + $protocol = self::getVar('server', (int) $serverID, 'id', 'protocol'); + } // return the server object switch ($protocol) { @@ -2016,6 +2064,8 @@ abstract class ComponentbuilderHelper $server->port = (isset($server->port) && is_int($server->port) && $server->port > 0) ? $server->port : 22; // open the connection self::$sftp[$server->cache] = new phpseclib\Net\SFTP($server->host, $server->port); + // heads-up on protocol + self::$sftp[$server->cache]->jcb_protocol = 2; // SFTP <-- if called not knowing what type of protocol is being used // now login based on authentication type switch($server->authentication) { @@ -2077,14 +2127,14 @@ abstract class ComponentbuilderHelper if (isset(self::$sftp[$server->cache]) && self::checkObject(self::$sftp[$server->cache])) { // set the unique buckets - if (!isset(self::$sftp[$server->cache]->remote_server_name)) + if (!isset(self::$sftp[$server->cache]->jcb_remote_server_name)) { - self::$sftp[$server->cache]->remote_server_name = array(); - self::$sftp[$server->cache]->remote_server_path = array(); + self::$sftp[$server->cache]->jcb_remote_server_name = array(); + self::$sftp[$server->cache]->jcb_remote_server_path = array(); } // always set the name and remote server path - self::$sftp[$server->cache]->remote_server_name[$serverID] = $server->name; - self::$sftp[$server->cache]->remote_server_path[$serverID] = (self::checkString($server->path) && $server->path !== '/') ? $server->path : ''; + self::$sftp[$server->cache]->jcb_remote_server_name[$serverID] = $server->name; + self::$sftp[$server->cache]->jcb_remote_server_path[$serverID] = (self::checkString($server->path) && $server->path !== '/') ? $server->path : ''; // return the sftp object return self::$sftp[$server->cache]; } @@ -2109,7 +2159,7 @@ abstract class ComponentbuilderHelper if (isset(self::$ftp[$server->cache]) && self::$ftp[$server->cache] instanceof JClientFtp) { // always set the name and remote server path - self::$ftp[$server->cache]->remote_server_name[$serverID] = $server->name; + self::$ftp[$server->cache]->jcb_remote_server_name[$serverID] = $server->name; // if still connected we are ready to go if (self::$ftp[$server->cache]->isConnected()) { @@ -2162,13 +2212,15 @@ abstract class ComponentbuilderHelper // check if we are connected if (self::$ftp[$server->cache] instanceof JClientFtp && self::$ftp[$server->cache]->isConnected()) { + // heads-up on protocol + self::$ftp[$server->cache]->jcb_protocol = 1; // FTP <-- if called not knowing what type of protocol is being used // set the unique buckets - if (!isset(self::$ftp[$server->cache]->remote_server_name)) + if (!isset(self::$ftp[$server->cache]->jcb_remote_server_name)) { - self::$ftp[$server->cache]->remote_server_name = array(); + self::$ftp[$server->cache]->jcb_remote_server_name = array(); } // always set the name and remote server path - self::$ftp[$server->cache]->remote_server_name[$serverID] = $server->name; + self::$ftp[$server->cache]->jcb_remote_server_name[$serverID] = $server->name; // return the FTP instance return self::$ftp[$server->cache]; } diff --git a/admin/language/en-GB/en-GB.com_componentbuilder.ini b/admin/language/en-GB/en-GB.com_componentbuilder.ini index 3d9e34cc4..304fd6978 100644 --- a/admin/language/en-GB/en-GB.com_componentbuilder.ini +++ b/admin/language/en-GB/en-GB.com_componentbuilder.ini @@ -1,6 +1,7 @@ COM_COMPONENTBUILDER="Component Builder" COM_COMPONENTBUILDER_ABOVE_TABS="Above Tabs" COM_COMPONENTBUILDER_ACCESS_BULK_TOOLS="Access Bulk Tools" +COM_COMPONENTBUILDER_ACCESS_DENIED="Access denied!" COM_COMPONENTBUILDER_ACTIVE_ONLY_FOUR_TEXT_FIELD="Active (only 4 text_field)" COM_COMPONENTBUILDER_ADD_ACCESS="Add Access" COM_COMPONENTBUILDER_ADD_CORRESPONDING_LINE_NUMBERS_TO_THE_DYNAMIC_COMMENTS_SO_TO_SEE_WHERE_IN_THE_COMPILER_THE_LINES_OF_CODE_WAS_BUILD_THIS_WILL_HELP_IF_YOU_NEED_TO_GET_MORE_TECHNICAL_WITH_AN_ISSUE_ON_GITHUB_OR_EVEN_FOR_YOUR_OWN_DEBUGGING="Add corresponding line numbers to the dynamic comments, so to see where in the compiler the lines of code was build. This will help if you need to get more technical with an issue on github, or even for your own debugging." @@ -2241,6 +2242,10 @@ COM_COMPONENTBUILDER_CONFIG_CRONJOB_BACKUP_FOLDER_PATH_DESCRIPTION="Here you can COM_COMPONENTBUILDER_CONFIG_CRONJOB_BACKUP_FOLDER_PATH_HINT="/home/user/fullbackup" COM_COMPONENTBUILDER_CONFIG_CRONJOB_BACKUP_FOLDER_PATH_LABEL="Cronjob Backup Folder Path" COM_COMPONENTBUILDER_CONFIG_CRONJOB_BACKUP_FOLDER_PATH_MESSAGE="Error! Please add some text here." +COM_COMPONENTBUILDER_CONFIG_CRONJOB_BACKUP_SERVER_DESCRIPTION="Select your backup server for JCB package backups." +COM_COMPONENTBUILDER_CONFIG_CRONJOB_BACKUP_SERVER_LABEL="Cronjob Backup Server" +COM_COMPONENTBUILDER_CONFIG_CRONJOB_BACKUP_TYPE_DESCRIPTION="Select how you would like to backup JCB" +COM_COMPONENTBUILDER_CONFIG_CRONJOB_BACKUP_TYPE_LABEL="Cronjob Backup type" COM_COMPONENTBUILDER_CONFIG_CUSTOM_FOLDER_PATH_DESCRIPTION="Here you can set the path to the custom folder" COM_COMPONENTBUILDER_CONFIG_CUSTOM_FOLDER_PATH_HINT="/home/user/custom" COM_COMPONENTBUILDER_CONFIG_CUSTOM_FOLDER_PATH_LABEL="Custom Folder Path" @@ -2330,6 +2335,7 @@ COM_COMPONENTBUILDER_CONFIG_GLOBAL_DESC="The Global Parameters" COM_COMPONENTBUILDER_CONFIG_GLOBAL_LABEL="Global" COM_COMPONENTBUILDER_CONFIG_GRADIANT_LOAD="Gradient" COM_COMPONENTBUILDER_CONFIG_INACTIVE="Inactive" +COM_COMPONENTBUILDER_CONFIG_LOCAL_FOLDER="Local Folder" COM_COMPONENTBUILDER_CONFIG_MAILER_DESCRIPTION="Select what mailer you would like to use to send emails." COM_COMPONENTBUILDER_CONFIG_MAILER_LABEL="Mailer" COM_COMPONENTBUILDER_CONFIG_MAILONLINE_DESCRIPTION="Warning this will stop all emails from going out." @@ -2384,6 +2390,7 @@ COM_COMPONENTBUILDER_CONFIG_PACKAGE_NAME_PLAEHOLDERS_LABEL="Package Name Placeho COM_COMPONENTBUILDER_CONFIG_PERCENTAGELANGUAGEADD_DESCRIPTION="Select percentage any language should be translated before the system should add the language to the component during compilation." COM_COMPONENTBUILDER_CONFIG_PERCENTAGELANGUAGEADD_LABEL="Add Language if %? ready." COM_COMPONENTBUILDER_CONFIG_PHP_MAIL="PHP Mail" +COM_COMPONENTBUILDER_CONFIG_REMOTE_SERVER="Remote Server" COM_COMPONENTBUILDER_CONFIG_REPLYNAME_DESCRIPTION="Text displayed in the header "Reply To:" field when replying to the site email. Usually the the person that receives the response. (leave blank for none)" COM_COMPONENTBUILDER_CONFIG_REPLYNAME_HINT="Reply Name Here" COM_COMPONENTBUILDER_CONFIG_REPLYNAME_LABEL="Reply to Name" @@ -6134,6 +6141,8 @@ COM_COMPONENTBUILDER_THERE_ARE_NO_SNIPPETS_TO_UPDATE_AT_THIS_TIME="There are no COM_COMPONENTBUILDER_THERE_HAS_BEEN_AN_ERROR_IF_THIS_CONTINUES_PLEASE_INFORM_YOUR_SYSTEM_ADMINISTRATOR_OF_A_TYPE_ERROR_IN_THE_FIELDS_DISPLAY_REQUEST="There has been an error, if this continues please inform your system administrator of a type error in the fields display request!" COM_COMPONENTBUILDER_THERE_WAS_A_PROBLEM_BNO_VIEW_OR_ID_FOUND_IN_SESSION_OR_VIEW_NOT_ALLOWED_TO_ACCESS_AREAB_WE_COULD_NOT_LOAD_ANY_LINKED_TO_VALUES_PLEASE_INFORM_YOUR_SYSTEM_ADMINISTRATOR="There was a problem, no view or id found in session or view not allowed to access area, we could not load any linked to values. Please inform your system administrator!" COM_COMPONENTBUILDER_THE_BPHPSECLIBNETSFTPB_LIBRARYCLASS_IS_NOT_AVAILABLE_THIS_LIBRARYCLASS_SHOULD_HAVE_BEEN_ADDED_TO_YOUR_ADMINHELPERSVENDOR_FOLDER_OF_JCB_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR_FOR_MORE_INFO="The phpseclib\NET\SFTP library\class is not available! This library\class should have been added to your admin/helpers/vendor folder of JCB. Please contact your system administrator for more info" +COM_COMPONENTBUILDER_THE_BSB_FILE_COULD_NOT_BE_MOVED_TO_BSB_PATH_ON_BSB_SERVER="The %s file could not be moved to %s path on %s server." +COM_COMPONENTBUILDER_THE_BSB_FILE_COULD_NOT_BE_MOVED_TO_BSB_SERVER="The %s file could not be moved to %s server." COM_COMPONENTBUILDER_THE_BSB_LIBRARY_CAN_NOT_BE_DELETED_OR_THINGS_WILL_BREAK="The %s library can not be deleted, or things will break." COM_COMPONENTBUILDER_THE_COMPONENT_ADMIN_VIEWS="The component admin views" COM_COMPONENTBUILDER_THE_COMPONENT_CONFIG="The component config" diff --git a/admin/models/ajax.php b/admin/models/ajax.php index f17715455..0c5f6afb5 100644 --- a/admin/models/ajax.php +++ b/admin/models/ajax.php @@ -1772,7 +1772,7 @@ class ComponentbuilderModelAjax extends JModelList public function usedin($functioName, $id, $targeting) { // get the table being targeted - if ($target = $this->getTableQueryOptions($targeting)) + if ($target = $this->getCodeSearchKeys($targeting, 'query')) { $db = JFactory::getDbo(); $query = $db->getQuery(true) @@ -1840,119 +1840,144 @@ class ComponentbuilderModelAjax extends JModelList } return false; } - + /** - * Get the table query to search for function used in + * Get the keys of the values to search custom code in * * @param string $targe The table targeted + * @param string $type The type of get * * @return array The query options * */ - protected function getTableQueryOptions($target) + protected function getCodeSearchKeys($target, $type = null) { - $query = array(); - // #__componentbuilder_joomla_component as a - $query['a'] = array(); - $query['a']['table'] = 'joomla_component'; - $query['a']['view'] = 'joomla_components'; - $query['a']['select'] = array('id', 'system_name', 'php_preflight_install','php_postflight_install', + // set the template if type is query + if ('query' === $type) + { + $tables = array( + 'a' => 'joomla_component', + 'b' => 'admin_view', + 'c' => 'custom_admin_view', + 'd' => 'site_view', + 'e' => 'field', + 'f' => 'dynamic_get', + 'g' => 'template', + 'h' => 'layout', + 'i' => 'component_dashboard', + 'j' => 'library', + ); + // check if we have a match + if (isset($tables[$target])) + { + $target = $tables[$target]; + } + } + // start target arrays + $targets = array(); + // #__componentbuilder_joomla_component + $targets['joomla_component'] = array(); + $targets['joomla_component']['search'] = array('id', 'system_name', 'php_preflight_install','php_postflight_install', 'php_preflight_update','php_postflight_update','php_method_uninstall', 'php_helper_admin','php_admin_event','php_helper_both','php_helper_site', 'php_site_event','javascript'); - $query['a']['not_base64'] = array(); - $query['a']['name'] = 'system_name'; + $targets['joomla_component']['view'] = 'joomla_components'; + $targets['joomla_component']['not_base64'] = array(); + $targets['joomla_component']['name'] = 'system_name'; - // #__componentbuilder_admin_view as b - $query['b'] = array(); - $query['b']['table'] = 'admin_view'; - $query['b']['view'] = 'admin_views'; - $query['b']['select'] = array('id', 'system_name', 'javascript_view_file','javascript_view_footer','javascript_views_file', - 'javascript_views_footer','php_getitem','php_save','php_postsavehook','php_getitems', - 'php_getitems_after_all','php_getlistquery','php_allowedit','php_before_delete', - 'php_after_delete','php_before_publish','php_after_publish','php_batchcopy', - 'php_batchmove','php_document','php_model','php_controller','php_import_display', - 'php_import','php_import_setdata','php_import_save','html_import_view','php_ajaxmethod'); - $query['b']['not_base64'] = array(); - $query['b']['name'] = 'system_name'; + // #__componentbuilder_component_dashboard + $targets['component_dashboard'] = array(); + $targets['component_dashboard']['search'] = array('id', 'joomla_component', 'php_dashboard_methods','dashboard_tab'); + $targets['component_dashboard']['view'] = 'components_dashboard'; + $targets['component_dashboard']['not_base64'] = array('dashboard_tab' => 'json'); + $targets['component_dashboard']['name'] = 'joomla_component->id:joomla_component.system_name'; - // #__componentbuilder_custom_admin_view as c - $query['c'] = array(); - $query['c']['table'] = 'custom_admin_view'; - $query['c']['view'] = 'custom_admin_views'; - $query['c']['select'] = array('id', 'system_name', 'default','php_view','php_jview','php_jview_display','php_document', + // #__componentbuilder_admin_view + $targets['admin_view'] = array(); + $targets['admin_view']['search'] = array('id', 'system_name', 'javascript_view_file','javascript_view_footer', + 'javascript_views_file','javascript_views_footer','html_import_view', + 'php_after_delete','php_after_publish','php_ajaxmethod','php_allowedit','php_batchcopy', + 'php_batchmove','php_before_delete','php_before_publish','php_before_save','php_controller', + 'php_controller_list','php_document','php_getitem','php_getitems','php_getitems_after_all', + 'php_getlistquery','php_import','php_import_display','php_import_ext','php_import_headers', + 'php_import_save','php_import_setdata','php_model','php_model_list','php_postsavehook','php_save'); + $targets['admin_view']['view'] = 'admin_views'; + $targets['admin_view']['not_base64'] = array(); + $targets['admin_view']['name'] = 'system_name'; + + // #__componentbuilder_custom_admin_view + $targets['custom_admin_view'] = array(); + $targets['custom_admin_view']['search'] = array('id', 'system_name', 'default','php_view','php_jview','php_jview_display','php_document', 'js_document','css_document','css','php_ajaxmethod','php_model','php_controller'); - $query['c']['not_base64'] = array(); - $query['c']['name'] = 'system_name'; + $targets['custom_admin_view']['view'] = 'custom_admin_views'; + $targets['custom_admin_view']['not_base64'] = array(); + $targets['custom_admin_view']['name'] = 'system_name'; - // #__componentbuilder_site_view as d - $query['d'] = array(); - $query['d']['table'] = 'site_view'; - $query['d']['view'] = 'site_views'; - $query['d']['select'] = array('id', 'system_name', 'default','php_view','php_jview','php_jview_display','php_document', + // #__componentbuilder_site_view + $targets['site_view'] = array(); + $targets['site_view']['search'] = array('id', 'system_name', 'default','php_view','php_jview','php_jview_display','php_document', 'js_document','css_document','css','php_ajaxmethod','php_model','php_controller'); - $query['d']['not_base64'] = array(); - $query['d']['name'] = 'system_name'; + $targets['site_view']['view'] = 'site_views'; + $targets['site_view']['not_base64'] = array(); + $targets['site_view']['name'] = 'system_name'; - // #__componentbuilder_field as e - $query['e'] = array(); - $query['e']['table'] = 'field'; - $query['e']['view'] = 'fields'; - $query['e']['select'] = array('id', 'name', 'xml','javascript_view_footer','javascript_views_footer'); - $query['e']['not_base64'] = array('xml' => 'json'); - $query['e']['name'] = 'name'; + // #__componentbuilder_field + $targets['field'] = array(); + $targets['field']['search'] = array('id', 'name', 'xml','javascript_view_footer','javascript_views_footer'); + $targets['field']['view'] = 'fields'; + $targets['field']['not_base64'] = array('xml' => 'json'); + $targets['field']['name'] = 'name'; - // #__componentbuilder_dynamic_get as f - $query['f'] = array(); - $query['f']['table'] = 'dynamic_get'; - $query['f']['view'] = 'dynamic_gets'; - $query['f']['select'] = array('id', 'name', 'php_before_getitem','php_after_getitem','php_before_getitems','php_after_getitems', + // #__componentbuilder_dynamic_get + $targets['dynamic_get'] = array(); + $targets['dynamic_get']['search'] = array('id', 'name', 'php_before_getitem','php_after_getitem','php_before_getitems','php_after_getitems', 'php_getlistquery'); - $query['f']['not_base64'] = array(); - $query['f']['name'] = 'name'; + $targets['dynamic_get']['view'] = 'dynamic_gets'; + $targets['dynamic_get']['not_base64'] = array(); + $targets['dynamic_get']['name'] = 'name'; - // #__componentbuilder_template as g - $query['g'] = array(); - $query['g']['table'] = 'template'; - $query['g']['view'] = 'templates'; - $query['g']['select'] = array('id', 'name', 'php_view','template'); - $query['g']['not_base64'] = array(); - $query['g']['name'] = 'name'; + // #__componentbuilder_template + $targets['template'] = array(); + $targets['template']['search'] = array('id', 'name', 'php_view','template'); + $targets['template']['view'] = 'templates'; + $targets['template']['not_base64'] = array(); + $targets['template']['name'] = 'name'; - // #__componentbuilder_layout as h - $query['h'] = array(); - $query['h']['table'] = 'layout'; - $query['h']['view'] = 'layouts'; - $query['h']['select'] = array('id', 'name', 'php_view','layout'); - $query['h']['not_base64'] = array(); - $query['h']['name'] = 'name'; + // #__componentbuilder_layout + $targets['layout'] = array(); + $targets['layout']['search'] = array('id', 'name', 'php_view','layout'); + $targets['layout']['view'] = 'layouts'; + $targets['layout']['not_base64'] = array(); + $targets['layout']['name'] = 'name'; - // #__componentbuilder_component_dashboard as i - $query['i'] = array(); - $query['i']['table'] = 'component_dashboard'; - $query['i']['view'] = 'components_dashboard'; - $query['i']['select'] = array('id', 'joomla_component', 'php_dashboard_methods','dashboard_tab'); - $query['i']['not_base64'] = array('dashboard_tab' => 'json'); - $query['i']['name'] = 'joomla_component->id:joomla_component.system_name'; + // #__componentbuilder_library + $targets['library'] = array(); + $targets['library']['view'] = 'libraries'; + $targets['library']['search'] = array('id', 'name', 'php_setdocument'); + $targets['library']['view'] = 'libraries'; + $targets['library']['not_base64'] = array(); + $targets['library']['name'] = 'name'; - // #__componentbuilder_library as j - $query['j'] = array(); - $query['j']['table'] = 'library'; - $query['j']['view'] = 'libraries'; - $query['j']['select'] = array('id', 'name', 'php_setdocument'); - $query['j']['not_base64'] = array(); - $query['j']['name'] = 'name'; - - // return the query string to search - if (isset($query[$target])) + // return result ready for a.query + if ('query' === $type && isset($targets[$target])) { // add the .a to the selection array - $query[$target]['select'] = array_map( function($select) { return 'a.'.$select; },$query[$target]['select']); + $targets[$target]['select'] = array_map( function($select) { return 'a.'.$select; }, $targets[$target]['search']); + // also set the table + $targets[$target]['table'] = $target; + // remove search + unset($targets[$target]['search']); // return - return $query[$target]; + return $targets[$target]; + } + // return the query string to search + elseif (isset($targets[$target])) + { + // remove name and id + return $targets[$target]; } return false; - } + } // Used in field public function getFieldOptions($id) diff --git a/admin/models/fields/servers.php b/admin/models/fields/servers.php index feb95aa29..29253f076 100644 --- a/admin/models/fields/servers.php +++ b/admin/models/fields/servers.php @@ -151,7 +151,7 @@ class JFormFieldServers extends JFormFieldList { $db = JFactory::getDBO(); $query = $db->getQuery(true); - $query->select($db->quoteName(array('a.id','a.name','a.protocol'),array('id','update_server_name', 'protocol'))); + $query->select($db->quoteName(array('a.id','a.name','a.protocol'),array('id','cronjob_backup_server_name', 'protocol'))); $query->from($db->quoteName('#__componentbuilder_server', 'a')); $query->where($db->quoteName('a.published') . ' >= 1'); $query->order('a.name ASC'); @@ -163,8 +163,8 @@ class JFormFieldServers extends JFormFieldList $options[] = JHtml::_('select.option', '', 'Select an option'); foreach($items as $item) { - $item->protocol = ($item->protocol == 2) ? JText::_('SSH') : JText::_('FTP'); - $options[] = JHtml::_('select.option', $item->id, $item->update_server_name.' ['.$item->protocol.']'); + $item->protocol = ($item->protocol == 2) ? JText::_('SFTP') : JText::_('FTP'); + $options[] = JHtml::_('select.option', $item->id, $item->cronjob_backup_server_name.' ['.$item->protocol.']'); } } return $options; diff --git a/admin/models/joomla_components.php b/admin/models/joomla_components.php index efe3cd9cc..00960eb90 100644 --- a/admin/models/joomla_components.php +++ b/admin/models/joomla_components.php @@ -136,7 +136,10 @@ class ComponentbuilderModelJoomla_components extends JModelList if (ComponentbuilderHelper::checkArray($items)) { // set params - $this->params = JComponentHelper::getParams('com_componentbuilder'); + if (!ComponentbuilderHelper::checkObject($this->params)) + { + $this->params = JComponentHelper::getParams('com_componentbuilder'); + } // set custom folder path $this->customPath = $this->params->get('custom_folder_path', JPATH_COMPONENT_ADMINISTRATOR.'/custom'); // check what type of export or backup this is @@ -149,6 +152,13 @@ class ComponentbuilderModelJoomla_components extends JModelList $comConfig = JFactory::getConfig(); $this->backupPath = $comConfig->get('tmp_path'); } + // check what backup type we are working with here + $this->backupType = $this->params->get('cronjob_backup_type', 1); // 1 = local folder; 2 = remote server (default is local) + // if remote server get the ID + if (2 == $this->backupType) + { + $this->backupServer = $this->params->get('cronjob_backup_server', null); + } // set the date array $date = JFactory::getDate(); $placeholderDate = array(); @@ -449,7 +459,7 @@ class ComponentbuilderModelJoomla_components extends JModelList // Select some fields $query->select(array('a.*')); - + // From the componentbuilder_ANY table $query->from($this->_db->quoteName('#__componentbuilder_'. $table, 'a')); // set the where query @@ -636,14 +646,20 @@ class ComponentbuilderModelJoomla_components extends JModelList // view icon $this->moveIt(array($item->icon), 'image'); } - // add snippets - $this->setExportIDs((int) $item->snippet, 'snippet'); + // add snippets (was removed please use snippet importer) + if (isset($item->snippet) && is_numeric($item->snippet)) + { + $this->setExportIDs((int) $item->snippet, 'snippet'); + } } // actions to take if table is template and layout if ('layout' === $table || 'template' === $table) { - // add snippets - $this->setExportIDs((int) $item->snippet, 'snippet'); + // add snippets (was removed please use snippet importer) + if (isset($item->snippet) && is_numeric($item->snippet)) + { + $this->setExportIDs((int) $item->snippet, 'snippet'); + } // search for templates & layouts $this->getTemplateLayout(base64_decode($item->$table), $this->user); // add search array templates and layouts @@ -730,6 +746,16 @@ class ComponentbuilderModelJoomla_components extends JModelList { return false; } + // move to remote server if needed + if (2 == $this->backupType) + { + if (!ComponentbuilderHelper::moveToServer($this->zipPath, $this->packageName.'.zip', $this->backupServer, null, 'joomla_component.export')) + { + return false; + } + // remove the local file + JFile::delete($this->zipPath); + } // remove the folder if (!ComponentbuilderHelper::removeFolder($this->packagePath)) { @@ -828,6 +854,7 @@ class ComponentbuilderModelJoomla_components extends JModelList { if ('file' === $type) { + // TODO we must add the new all over files to this... will be a little tricky. $tmpFilePath = str_replace('//', '/', $tmpPath.'/'.$item); $customFilePath = str_replace('//', '/', $this->customPath.'/'.$item); if (!JFile::exists($tmpFilePath) && JFile::exists($customFilePath)) @@ -1099,7 +1126,11 @@ class ComponentbuilderModelJoomla_components extends JModelList { foreach ($keys['search'] as $key) { - if (!isset($keys['not_base64'][$key])) + if ('id' === $key || 'name' === $key || 'system_name' === $key) + { + continue; + } + elseif (!isset($keys['not_base64'][$key])) { $value = base64_decode($item->{$key}); } @@ -1221,81 +1252,144 @@ class ComponentbuilderModelJoomla_components extends JModelList } } } - + /** * Get the keys of the values to search custom code in * * @param string $targe The table targeted + * @param string $type The type of get * * @return array The query options * */ - protected function getCodeSearchKeys($target) + protected function getCodeSearchKeys($target, $type = null) { + // set the template if type is query + if ('query' === $type) + { + $tables = array( + 'a' => 'joomla_component', + 'b' => 'admin_view', + 'c' => 'custom_admin_view', + 'd' => 'site_view', + 'e' => 'field', + 'f' => 'dynamic_get', + 'g' => 'template', + 'h' => 'layout', + 'i' => 'component_dashboard', + 'j' => 'library', + ); + // check if we have a match + if (isset($tables[$target])) + { + $target = $tables[$target]; + } + } + // start target arrays $targets = array(); // #__componentbuilder_joomla_component $targets['joomla_component'] = array(); - $targets['joomla_component']['search'] = array('php_preflight_install','php_postflight_install', + $targets['joomla_component']['search'] = array('id', 'system_name', 'php_preflight_install','php_postflight_install', 'php_preflight_update','php_postflight_update','php_method_uninstall', 'php_helper_admin','php_admin_event','php_helper_both','php_helper_site', - 'php_site_event'); + 'php_site_event','javascript'); + $targets['joomla_component']['view'] = 'joomla_components'; $targets['joomla_component']['not_base64'] = array(); + $targets['joomla_component']['name'] = 'system_name'; // #__componentbuilder_component_dashboard $targets['component_dashboard'] = array(); - $targets['component_dashboard']['search'] = array('php_dashboard_methods','dashboard_tab'); + $targets['component_dashboard']['search'] = array('id', 'joomla_component', 'php_dashboard_methods','dashboard_tab'); + $targets['component_dashboard']['view'] = 'components_dashboard'; $targets['component_dashboard']['not_base64'] = array('dashboard_tab' => 'json'); + $targets['component_dashboard']['name'] = 'joomla_component->id:joomla_component.system_name'; // #__componentbuilder_admin_view $targets['admin_view'] = array(); - $targets['admin_view']['search'] = array('javascript_view_file','javascript_view_footer','javascript_views_file', - 'javascript_views_footer','php_getitem','php_save','php_postsavehook','php_getitems', - 'php_getitems_after_all','php_getlistquery','php_allowedit','php_before_delete', - 'php_after_delete','php_before_publish','php_after_publish','php_batchcopy', - 'php_batchmove','php_document','php_model','php_controller','php_import_display', - 'php_import','php_import_setdata','php_import_save','html_import_view','php_ajaxmethod'); + $targets['admin_view']['search'] = array('id', 'system_name', 'javascript_view_file','javascript_view_footer', + 'javascript_views_file','javascript_views_footer','html_import_view', + 'php_after_delete','php_after_publish','php_ajaxmethod','php_allowedit','php_batchcopy', + 'php_batchmove','php_before_delete','php_before_publish','php_before_save','php_controller', + 'php_controller_list','php_document','php_getitem','php_getitems','php_getitems_after_all', + 'php_getlistquery','php_import','php_import_display','php_import_ext','php_import_headers', + 'php_import_save','php_import_setdata','php_model','php_model_list','php_postsavehook','php_save'); + $targets['admin_view']['view'] = 'admin_views'; $targets['admin_view']['not_base64'] = array(); + $targets['admin_view']['name'] = 'system_name'; // #__componentbuilder_custom_admin_view $targets['custom_admin_view'] = array(); - $targets['custom_admin_view']['search'] = array('default','php_view','php_jview','php_jview_display','php_document', - 'js_document','css_document','css','php_model','php_controller'); + $targets['custom_admin_view']['search'] = array('id', 'system_name', 'default','php_view','php_jview','php_jview_display','php_document', + 'js_document','css_document','css','php_ajaxmethod','php_model','php_controller'); + $targets['custom_admin_view']['view'] = 'custom_admin_views'; $targets['custom_admin_view']['not_base64'] = array(); + $targets['custom_admin_view']['name'] = 'system_name'; // #__componentbuilder_site_view $targets['site_view'] = array(); - $targets['site_view']['search'] = array('default','php_view','php_jview','php_jview_display','php_document', + $targets['site_view']['search'] = array('id', 'system_name', 'default','php_view','php_jview','php_jview_display','php_document', 'js_document','css_document','css','php_ajaxmethod','php_model','php_controller'); + $targets['site_view']['view'] = 'site_views'; $targets['site_view']['not_base64'] = array(); + $targets['site_view']['name'] = 'system_name'; // #__componentbuilder_field $targets['field'] = array(); - $targets['field']['search'] = array('xml','javascript_view_footer','javascript_views_footer'); + $targets['field']['search'] = array('id', 'name', 'xml','javascript_view_footer','javascript_views_footer'); + $targets['field']['view'] = 'fields'; $targets['field']['not_base64'] = array('xml' => 'json'); + $targets['field']['name'] = 'name'; // #__componentbuilder_dynamic_get $targets['dynamic_get'] = array(); - $targets['dynamic_get']['search'] = array('php_before_getitem','php_after_getitem','php_before_getitems','php_after_getitems', + $targets['dynamic_get']['search'] = array('id', 'name', 'php_before_getitem','php_after_getitem','php_before_getitems','php_after_getitems', 'php_getlistquery'); + $targets['dynamic_get']['view'] = 'dynamic_gets'; $targets['dynamic_get']['not_base64'] = array(); + $targets['dynamic_get']['name'] = 'name'; // #__componentbuilder_template $targets['template'] = array(); - $targets['template']['search'] = array('php_view','template'); + $targets['template']['search'] = array('id', 'name', 'php_view','template'); + $targets['template']['view'] = 'templates'; $targets['template']['not_base64'] = array(); + $targets['template']['name'] = 'name'; // #__componentbuilder_layout $targets['layout'] = array(); - $targets['layout']['search'] = array('php_view','layout'); + $targets['layout']['search'] = array('id', 'name', 'php_view','layout'); + $targets['layout']['view'] = 'layouts'; $targets['layout']['not_base64'] = array(); + $targets['layout']['name'] = 'name'; - // return the query string to search - if (isset($targets[$target])) + // #__componentbuilder_library + $targets['library'] = array(); + $targets['library']['view'] = 'libraries'; + $targets['library']['search'] = array('id', 'name', 'php_setdocument'); + $targets['library']['view'] = 'libraries'; + $targets['library']['not_base64'] = array(); + $targets['library']['name'] = 'name'; + + // return result ready for a.query + if ('query' === $type && isset($targets[$target])) { + // add the .a to the selection array + $targets[$target]['select'] = array_map( function($select) { return 'a.'.$select; }, $targets[$target]['search']); + // also set the table + $targets[$target]['table'] = $target; + // remove search + unset($targets[$target]['search']); + // return + return $targets[$target]; + } + // return the query string to search + elseif (isset($targets[$target])) + { + // remove name and id return $targets[$target]; } return false; - } + } /** * Method to auto-populate the model state. diff --git a/admin/sql/updates/mysql/2.6.15.sql b/admin/sql/updates/mysql/2.6.15.sql new file mode 100644 index 000000000..d3f5a12fa --- /dev/null +++ b/admin/sql/updates/mysql/2.6.15.sql @@ -0,0 +1 @@ + diff --git a/componentbuilder.xml b/componentbuilder.xml index 147a0c35b..5d9fdb75e 100644 --- a/componentbuilder.xml +++ b/componentbuilder.xml @@ -1,15 +1,15 @@ COM_COMPONENTBUILDER - 19th February, 2018 + 20th February, 2018 Llewellyn van der Merwe llewellyn@joomlacomponentbuilder.com http://joomlacomponentbuilder.com Copyright (C) 2015. All Rights Reserved GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - 2.6.15 + 2.6.16 Component Builder (v.2.6.15) +

Component Builder (v.2.6.16)

The Component Builder for [Joomla](https://extensions.joomla.org/extension/component-builder/) is highly advanced tool that is truly able to build extremely complex components in a fraction of the time. diff --git a/componentbuilder_update_server.xml b/componentbuilder_update_server.xml index 2fb63636a..158e30f10 100644 --- a/componentbuilder_update_server.xml +++ b/componentbuilder_update_server.xml @@ -424,4 +424,21 @@ http://joomlacomponentbuilder.com + + Component Builder + Builds Complex Joomla Components + com_componentbuilder + component + 2.6.16 + http://joomlacomponentbuilder.com + + https://github.com/vdm-io/Joomla-Component-Builder/releases/download/v2.6.16/JCB_v2.6.16.zip + + + stable + + Llewellyn van der Merwe + http://joomlacomponentbuilder.com + + \ No newline at end of file diff --git a/script.php b/script.php index 56bf29e16..370646267 100644 --- a/script.php +++ b/script.php @@ -3590,7 +3590,7 @@ class com_componentbuilderInstallerScript $query = $db->getQuery(true); // Field to update. $fields = array( - $db->quoteName('params') . ' = ' . $db->quote('{"autorName":"Llewellyn van der Merwe","autorEmail":"llewellyn@joomlacomponentbuilder.com","minify":"0","percentagelanguageadd":"50","set_browser_storage":"1","storage_time_to_live":"global","backup_package_name":"JCB_Backup_[YEAR]_[MONTH]_[DAY]","export_license":"GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html","export_copyright":"Copyright (C) 2015. All Rights Reserved","check_in":"-1 day","save_history":"1","history_limit":"10","uikit_load":"1","uikit_min":"","uikit_style":""}'), + $db->quoteName('params') . ' = ' . $db->quote('{"autorName":"Llewellyn van der Merwe","autorEmail":"llewellyn@joomlacomponentbuilder.com","minify":"0","percentagelanguageadd":"50","set_browser_storage":"1","storage_time_to_live":"global","cronjob_backup_type":"1","cronjob_backup_server":"0","backup_package_name":"JCB_Backup_[YEAR]_[MONTH]_[DAY]","export_license":"GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html","export_copyright":"Copyright (C) 2015. All Rights Reserved","check_in":"-1 day","save_history":"1","history_limit":"10","uikit_load":"1","uikit_min":"","uikit_style":""}'), ); // Condition. $conditions = array( @@ -4739,7 +4739,7 @@ class com_componentbuilderInstallerScript echo ' -

Upgrade to Version 2.6.15 Was Successful! Let us know if anything is not working as expected.

'; +

Upgrade to Version 2.6.16 Was Successful! Let us know if anything is not working as expected.

'; } } } diff --git a/site/controllers/api.php b/site/controllers/api.php index 2d0d5d0f4..8d20f0a69 100644 --- a/site/controllers/api.php +++ b/site/controllers/api.php @@ -50,150 +50,166 @@ class ComponentbuilderControllerApi extends JControllerForm } - public function backup() + public function backup() { - // get params + // get params first if (!isset($this->params) || !ComponentbuilderHelper::checkObject($this->params)) { $this->params = JComponentHelper::getParams('com_componentbuilder'); } - // get all component IDs to backup - $pks = componentbuilderHelper::getComponentIDs(); // Get the model $model = componentbuilderHelper::getModel('joomla_components', JPATH_ADMINISTRATOR . '/components/com_componentbuilder'); // set user $model->user = $this->getApiUser(); - // make sure to set active type to backup - $model->activeType = 'backup'; - // set auto loader - ComponentbuilderHelper::autoLoader('smart'); - // manual backup message - $backupNotice = array(); - // get the data to export - if (ComponentbuilderHelper::checkArray($pks) && $model->getSmartExport($pks)) + // check if export is allowed for this user. (we need this sorry) + if ($model->user->authorise('joomla_component.export', 'com_componentbuilder') && $model->user->authorise('core.export', 'com_componentbuilder')) { - $backupNotice[] = JText::_('COM_COMPONENTBUILDER_BACKUP_WAS_DONE_SUCCESSFULLY'); - $backupNoticeStatus = 'Success'; - // set the key string - if (componentbuilderHelper::checkString($model->key) && strlen($model->key) == 32) + // get all component IDs to backup + $pks = componentbuilderHelper::getComponentIDs(); + // make sure to set active type to backup + $model->activeType = 'backup'; + // set auto loader + ComponentbuilderHelper::autoLoader('smart'); + // manual backup message + $backupNotice = array(); + // get the data to export + if (ComponentbuilderHelper::checkArray($pks) && $model->getSmartExport($pks)) { - $textNotice = array(); - $keyNotice = '

' . JText::sprintf('COM_COMPONENTBUILDER_THE_PACKAGE_KEY_IS_CODESCODE', $model->key) . '

'; - $textNotice[] = JText::sprintf('COM_COMPONENTBUILDER_THE_PACKAGE_KEY_IS_S', $model->key); - $keyNotice .= JText::_('COM_COMPONENTBUILDER_YOUR_DATA_IS_ENCRYPTED_WITH_A_AES_ONE_HUNDRED_AND_TWENTY_EIGHT_BIT_ENCRYPTION_USING_THE_ABOVE_THIRTY_TWO_CHARACTER_KEY_WITHOUT_THIS_KEY_IT_WILL_TAKE_THE_CURRENT_TECHNOLOGY_WITH_A_BRUTE_FORCE_ATTACK_METHOD_MORE_THEN_A_HREFHTTPRANDOMIZECOMHOWLONGTOHACKPASS_TARGET_BLANK_TITLEHOW_LONG_TO_HACK_PASSSEVEN_HUNDRED_ZERO_ZERO_ZERO_ZERO_ZERO_ZERO_ZERO_ZERO_ZERO_ZEROA_YEARS_TO_CRACK_THEORETICALLY_UNLESS_THEY_HAVE_THIS_KEY_ABOVE_SO_DO_KEEP_IT_SAFE') . '
'; - // set the package owner info - if ((isset($model->info['getKeyFrom']['company']) && componentbuilderHelper::checkString($model->info['getKeyFrom']['company'])) || (isset($model->info['getKeyFrom']['owner']) && componentbuilderHelper::checkString($model->info['getKeyFrom']['owner']))) + $backupNotice[] = JText::_('COM_COMPONENTBUILDER_BACKUP_WAS_DONE_SUCCESSFULLY'); + $backupNoticeStatus = 'Success'; + // set the key string + if (componentbuilderHelper::checkString($model->key) && strlen($model->key) == 32) { - $ownerDetails = '

' . JText::_('COM_COMPONENTBUILDER_PACKAGE_OWNER_DETAILS') . '

'; - $textNotice[] = '# ' . JText::_('COM_COMPONENTBUILDER_PACKAGE_OWNER_DETAILS'); - $ownerDetails .= '
    '; - if (isset($model->info['getKeyFrom']['company']) && componentbuilderHelper::checkString($model->info['getKeyFrom']['company'])) + $textNotice = array(); + $keyNotice = '

    ' . JText::sprintf('COM_COMPONENTBUILDER_THE_PACKAGE_KEY_IS_CODESCODE', $model->key) . '

    '; + $textNotice[] = JText::sprintf('COM_COMPONENTBUILDER_THE_PACKAGE_KEY_IS_S', $model->key); + $keyNotice .= JText::_('COM_COMPONENTBUILDER_YOUR_DATA_IS_ENCRYPTED_WITH_A_AES_ONE_HUNDRED_AND_TWENTY_EIGHT_BIT_ENCRYPTION_USING_THE_ABOVE_THIRTY_TWO_CHARACTER_KEY_WITHOUT_THIS_KEY_IT_WILL_TAKE_THE_CURRENT_TECHNOLOGY_WITH_A_BRUTE_FORCE_ATTACK_METHOD_MORE_THEN_A_HREFHTTPRANDOMIZECOMHOWLONGTOHACKPASS_TARGET_BLANK_TITLEHOW_LONG_TO_HACK_PASSSEVEN_HUNDRED_ZERO_ZERO_ZERO_ZERO_ZERO_ZERO_ZERO_ZERO_ZERO_ZEROA_YEARS_TO_CRACK_THEORETICALLY_UNLESS_THEY_HAVE_THIS_KEY_ABOVE_SO_DO_KEEP_IT_SAFE') . '
    '; + // set the package owner info + if ((isset($model->info['getKeyFrom']['company']) && componentbuilderHelper::checkString($model->info['getKeyFrom']['company'])) || (isset($model->info['getKeyFrom']['owner']) && componentbuilderHelper::checkString($model->info['getKeyFrom']['owner']))) { - $ownerDetails .= '
  • ' . JText::sprintf('COM_COMPONENTBUILDER_EMCOMPANYEM_BSB', $model->info['getKeyFrom']['company']) . '
  • '; - $textNotice[] = '- ' . JText::sprintf('COM_COMPONENTBUILDER_COMPANY_S', $model->info['getKeyFrom']['company']); + $ownerDetails = '

    ' . JText::_('COM_COMPONENTBUILDER_PACKAGE_OWNER_DETAILS') . '

    '; + $textNotice[] = '# ' . JText::_('COM_COMPONENTBUILDER_PACKAGE_OWNER_DETAILS'); + $ownerDetails .= '
      '; + if (isset($model->info['getKeyFrom']['company']) && componentbuilderHelper::checkString($model->info['getKeyFrom']['company'])) + { + $ownerDetails .= '
    • ' . JText::sprintf('COM_COMPONENTBUILDER_EMCOMPANYEM_BSB', $model->info['getKeyFrom']['company']) . '
    • '; + $textNotice[] = '- ' . JText::sprintf('COM_COMPONENTBUILDER_COMPANY_S', $model->info['getKeyFrom']['company']); + } + // add value only if set + if (isset($model->info['getKeyFrom']['owner']) && componentbuilderHelper::checkString($model->info['getKeyFrom']['owner'])) + { + $ownerDetails .= '
    • ' . JText::sprintf('COM_COMPONENTBUILDER_EMOWNEREM_BSB', $model->info['getKeyFrom']['owner']) . '
    • '; + $textNotice[] = '- ' . JText::sprintf('COM_COMPONENTBUILDER_OWNER_S', $model->info['getKeyFrom']['owner']); + } + // add value only if set + if (isset($model->info['getKeyFrom']['website']) && componentbuilderHelper::checkString($model->info['getKeyFrom']['website'])) + { + $ownerDetails .= '
    • ' . JText::sprintf('COM_COMPONENTBUILDER_EMWEBSITEEM_BSB', $model->info['getKeyFrom']['website']) . '
    • '; + $textNotice[] = '- ' . JText::sprintf('COM_COMPONENTBUILDER_WEBSITE_S', $model->info['getKeyFrom']['website']); + } + // add value only if set + if (isset($model->info['getKeyFrom']['email']) && componentbuilderHelper::checkString($model->info['getKeyFrom']['email'])) + { + $ownerDetails .= '
    • ' . JText::sprintf('COM_COMPONENTBUILDER_EMEMAILEM_BSB', $model->info['getKeyFrom']['email']) . '
    • '; + $textNotice[] = '- ' . JText::sprintf('COM_COMPONENTBUILDER_EMAIL_S', $model->info['getKeyFrom']['email']); + } + // add value only if set + if (isset($model->info['getKeyFrom']['license']) && componentbuilderHelper::checkString($model->info['getKeyFrom']['license'])) + { + $ownerDetails .= '
    • ' . JText::sprintf('COM_COMPONENTBUILDER_EMLICENSEEM_BSB', $model->info['getKeyFrom']['license']) . '
    • '; + $textNotice[] = '- ' . JText::sprintf('COM_COMPONENTBUILDER_LICENSE_S', $model->info['getKeyFrom']['license']); + } + // add value only if set + if (isset($model->info['getKeyFrom']['copyright']) && componentbuilderHelper::checkString($model->info['getKeyFrom']['copyright'])) + { + $ownerDetails .= '
    • ' . JText::sprintf('COM_COMPONENTBUILDER_EMCOPYRIGHTEM_BSB', $model->info['getKeyFrom']['copyright']) . '
    • '; + $textNotice[] = '- ' . JText::sprintf('COM_COMPONENTBUILDER_COPYRIGHT_S', $model->info['getKeyFrom']['copyright']); + } + $ownerDetails .= '
    '; + $backupNotice[] = JText::_('COM_COMPONENTBUILDER_OWNER_DETAILS_WAS_SET'); } - // add value only if set - if (isset($model->info['getKeyFrom']['owner']) && componentbuilderHelper::checkString($model->info['getKeyFrom']['owner'])) + else { - $ownerDetails .= '
  • ' . JText::sprintf('COM_COMPONENTBUILDER_EMOWNEREM_BSB', $model->info['getKeyFrom']['owner']) . '
  • '; - $textNotice[] = '- ' . JText::sprintf('COM_COMPONENTBUILDER_OWNER_S', $model->info['getKeyFrom']['owner']); + $ownerDetails = '

    ' . JText::_('COM_COMPONENTBUILDER_PACKAGE_OWNER_NOT_SET') . '

    '; + $textNotice[] = '# ' . JText::_('COM_COMPONENTBUILDER_PACKAGE_OWNER_DETAILS'); + $ownerDetails .= JText::_('COM_COMPONENTBUILDER_TO_CHANGE_THE_PACKAGE_OWNER_DEFAULTS_OPEN_THE_BJCB_GLOBAL_OPTIONSB_GO_TO_THE_BCOMPANYB_TAB_AND_ADD_THE_CORRECT_COMPANY_DETAILS_THERE') . '
    '; + $textNotice[] = JText::_('COM_COMPONENTBUILDER_TO_CHANGE_THE_PACKAGE_OWNER_DEFAULTS_OPEN_THE_JCB_GLOBAL_OPTIONS_GO_TO_THE_COMPANY_TAB_AND_ADD_THE_CORRECT_COMPANY_DETAILS_THERE'); + $ownerDetails .= '

    ' . JText::_('COM_COMPONENTBUILDER_YOU_SHOULD_ADD_THE_CORRECT_OWNER_DETAILS') . '

    '; + $textNotice[] = '## ' . JText::_('COM_COMPONENTBUILDER_YOU_SHOULD_ADD_THE_CORRECT_OWNER_DETAILS'); + $ownerDetails .= JText::_('COM_COMPONENTBUILDER_SINCE_THE_OWNER_DETAILS_ARE_DISPLAYED_DURING_BIMPORT_PROCESSB_BEFORE_ADDING_THE_KEY_THIS_WAY_IF_THE_USERDEV_BDOES_NOTB_HAVE_THE_KEY_THEY_CAN_SEE_BWHERE_TO_GET_ITB') . '
    '; + $textNotice[] = JText::_('COM_COMPONENTBUILDER_SINCE_THE_OWNER_DETAILS_ARE_DISPLAYED_DURING_IMPORT_PROCESS_BEFORE_ADDING_THE_KEY_THIS_WAY_IF_THE_USERDEV_DOES_NOT_HAVE_THE_KEY_THEY_CAN_SEE_WHERE_TO_GET_IT'); + $backupNotice[] = JText::_('COM_COMPONENTBUILDER_CHECK_YOUR_OWNER_DETAILS_IT_HAS_NOT_BEEN_SET_OPEN_THE_JCB_GLOBAL_OPTIONS_GO_TO_THE_COMPANY_TAB_AND_ADD_THE_CORRECT_COMPANY_DETAILS_THERE'); } - // add value only if set - if (isset($model->info['getKeyFrom']['website']) && componentbuilderHelper::checkString($model->info['getKeyFrom']['website'])) - { - $ownerDetails .= '
  • ' . JText::sprintf('COM_COMPONENTBUILDER_EMWEBSITEEM_BSB', $model->info['getKeyFrom']['website']) . '
  • '; - $textNotice[] = '- ' . JText::sprintf('COM_COMPONENTBUILDER_WEBSITE_S', $model->info['getKeyFrom']['website']); - } - // add value only if set - if (isset($model->info['getKeyFrom']['email']) && componentbuilderHelper::checkString($model->info['getKeyFrom']['email'])) - { - $ownerDetails .= '
  • ' . JText::sprintf('COM_COMPONENTBUILDER_EMEMAILEM_BSB', $model->info['getKeyFrom']['email']) . '
  • '; - $textNotice[] = '- ' . JText::sprintf('COM_COMPONENTBUILDER_EMAIL_S', $model->info['getKeyFrom']['email']); - } - // add value only if set - if (isset($model->info['getKeyFrom']['license']) && componentbuilderHelper::checkString($model->info['getKeyFrom']['license'])) - { - $ownerDetails .= '
  • ' . JText::sprintf('COM_COMPONENTBUILDER_EMLICENSEEM_BSB', $model->info['getKeyFrom']['license']) . '
  • '; - $textNotice[] = '- ' . JText::sprintf('COM_COMPONENTBUILDER_LICENSE_S', $model->info['getKeyFrom']['license']); - } - // add value only if set - if (isset($model->info['getKeyFrom']['copyright']) && componentbuilderHelper::checkString($model->info['getKeyFrom']['copyright'])) - { - $ownerDetails .= '
  • ' . JText::sprintf('COM_COMPONENTBUILDER_EMCOPYRIGHTEM_BSB', $model->info['getKeyFrom']['copyright']) . '
  • '; - $textNotice[] = '- ' . JText::sprintf('COM_COMPONENTBUILDER_COPYRIGHT_S', $model->info['getKeyFrom']['copyright']); - } - $ownerDetails .= '
'; - $backupNotice[] = JText::_('COM_COMPONENTBUILDER_OWNER_DETAILS_WAS_SET'); } else { - $ownerDetails = '

' . JText::_('COM_COMPONENTBUILDER_PACKAGE_OWNER_NOT_SET') . '

'; - $textNotice[] = '# ' . JText::_('COM_COMPONENTBUILDER_PACKAGE_OWNER_DETAILS'); - $ownerDetails .= JText::_('COM_COMPONENTBUILDER_TO_CHANGE_THE_PACKAGE_OWNER_DEFAULTS_OPEN_THE_BJCB_GLOBAL_OPTIONSB_GO_TO_THE_BCOMPANYB_TAB_AND_ADD_THE_CORRECT_COMPANY_DETAILS_THERE') . '
'; - $textNotice[] = JText::_('COM_COMPONENTBUILDER_TO_CHANGE_THE_PACKAGE_OWNER_DEFAULTS_OPEN_THE_JCB_GLOBAL_OPTIONS_GO_TO_THE_COMPANY_TAB_AND_ADD_THE_CORRECT_COMPANY_DETAILS_THERE'); - $ownerDetails .= '

' . JText::_('COM_COMPONENTBUILDER_YOU_SHOULD_ADD_THE_CORRECT_OWNER_DETAILS') . '

'; - $textNotice[] = '## ' . JText::_('COM_COMPONENTBUILDER_YOU_SHOULD_ADD_THE_CORRECT_OWNER_DETAILS'); - $ownerDetails .= JText::_('COM_COMPONENTBUILDER_SINCE_THE_OWNER_DETAILS_ARE_DISPLAYED_DURING_BIMPORT_PROCESSB_BEFORE_ADDING_THE_KEY_THIS_WAY_IF_THE_USERDEV_BDOES_NOTB_HAVE_THE_KEY_THEY_CAN_SEE_BWHERE_TO_GET_ITB') . '
'; - $textNotice[] = JText::_('COM_COMPONENTBUILDER_SINCE_THE_OWNER_DETAILS_ARE_DISPLAYED_DURING_IMPORT_PROCESS_BEFORE_ADDING_THE_KEY_THIS_WAY_IF_THE_USERDEV_DOES_NOT_HAVE_THE_KEY_THEY_CAN_SEE_WHERE_TO_GET_IT'); - $backupNotice[] = JText::_('COM_COMPONENTBUILDER_CHECK_YOUR_OWNER_DETAILS_IT_HAS_NOT_BEEN_SET_OPEN_THE_JCB_GLOBAL_OPTIONS_GO_TO_THE_COMPANY_TAB_AND_ADD_THE_CORRECT_COMPANY_DETAILS_THERE'); + $keyNotice = '

' . JText::_('COM_COMPONENTBUILDER_THIS_PACKAGE_HAS_NO_KEY') . '

'; + $textNotice[] = '# ' . JText::_('COM_COMPONENTBUILDER_THIS_PACKAGE_HAS_NO_KEY'); + $ownerDetails = JText::_('COM_COMPONENTBUILDER_THAT_MEANS_ANYONE_WHO_HAS_THIS_PACKAGE_CAN_INSTALL_IT_INTO_JCB_TO_ADD_AN_EXPORT_KEY_SIMPLY_OPEN_THE_COMPONENT_GO_TO_THE_TAB_CALLED_BSETTINGSB_BOTTOM_RIGHT_THERE_IS_A_FIELD_CALLED_BEXPORT_KEYB') . '
'; + $textNotice[] = JText::_('COM_COMPONENTBUILDER_THAT_MEANS_ANYONE_WHO_HAS_THIS_PACKAGE_CAN_INSTALL_IT_INTO_JCB_TO_ADD_AN_EXPORT_KEY_SIMPLY_OPEN_THE_COMPONENT_GO_TO_THE_TAB_CALLED_SETTINGS_BOTTOM_RIGHT_THERE_IS_A_FIELD_CALLED_EXPORT_KEY'); + $backupNotice[] = JText::_('COM_COMPONENTBUILDER_NO_KEYS_WERE_FOUND_TO_ADD_AN_EXPORT_KEY_SIMPLY_OPEN_THE_COMPONENT_GO_TO_THE_TAB_CALLED_SETTINGS_BOTTOM_RIGHT_THERE_IS_A_FIELD_CALLED_EXPORT_KEY'); + } + // get email + if ($email = $this->params->get('backup_email', null)) + { + // plain text + $plainText = implode("\n", $textNotice); + // set hash to track changes + $hashTracker = md5($plainText); + if (ComponentbuilderHelper::newHash($hashTracker)) + { + // Build final massage. + $message = $keyNotice . $ownerDetails . '
HASH: ' . $hashTracker . ''; + // set the subject + $subject = JText::_('COM_COMPONENTBUILDER_JOOMLA_COMPONENT_BUILDER_BACKUP_KEY'); + // email the message + componentbuilderEmail::send($email, $subject, componentbuilderEmail::setTableBody($message, $subject), $plainText, 1); + $backupNotice[] = JText::_('COM_COMPONENTBUILDER_EMAIL_WITH_THE_NEW_KEY_WAS_SEND'); + } + else + { + $backupNotice[] = JText::_('COM_COMPONENTBUILDER_KEY_HAS_NOT_CHANGED'); + } } } else { - $keyNotice = '

' . JText::_('COM_COMPONENTBUILDER_THIS_PACKAGE_HAS_NO_KEY') . '

'; - $textNotice[] = '# ' . JText::_('COM_COMPONENTBUILDER_THIS_PACKAGE_HAS_NO_KEY'); - $ownerDetails = JText::_('COM_COMPONENTBUILDER_THAT_MEANS_ANYONE_WHO_HAS_THIS_PACKAGE_CAN_INSTALL_IT_INTO_JCB_TO_ADD_AN_EXPORT_KEY_SIMPLY_OPEN_THE_COMPONENT_GO_TO_THE_TAB_CALLED_BSETTINGSB_BOTTOM_RIGHT_THERE_IS_A_FIELD_CALLED_BEXPORT_KEYB') . '
'; - $textNotice[] = JText::_('COM_COMPONENTBUILDER_THAT_MEANS_ANYONE_WHO_HAS_THIS_PACKAGE_CAN_INSTALL_IT_INTO_JCB_TO_ADD_AN_EXPORT_KEY_SIMPLY_OPEN_THE_COMPONENT_GO_TO_THE_TAB_CALLED_SETTINGS_BOTTOM_RIGHT_THERE_IS_A_FIELD_CALLED_EXPORT_KEY'); - $backupNotice[] = JText::_('COM_COMPONENTBUILDER_NO_KEYS_WERE_FOUND_TO_ADD_AN_EXPORT_KEY_SIMPLY_OPEN_THE_COMPONENT_GO_TO_THE_TAB_CALLED_SETTINGS_BOTTOM_RIGHT_THERE_IS_A_FIELD_CALLED_EXPORT_KEY'); - } - // get email - if ($email = $this->params->get('backup_email', null)) - { - // plain text - $plainText = implode("\n", $textNotice); - // set hash to track changes - $hashTracker = md5($plainText); - if (ComponentbuilderHelper::newHash($hashTracker)) + $backupNotice[] = JText::_('COM_COMPONENTBUILDER_BACKUP_FAILED_PLEASE_TRY_AGAIN_IF_THE_ERROR_CONTINUE_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR'); + $backupNoticeStatus = 'Error'; + if (componentbuilderHelper::checkString($model->packagePath)) { - // Build final massage. - $message = $keyNotice . $ownerDetails . '
HASH: ' . $hashTracker . ''; - // set the subject - $subject = JText::_('COM_COMPONENTBUILDER_JOOMLA_COMPONENT_BUILDER_BACKUP_KEY'); - // email the message - componentbuilderEmail::send($email, $subject, componentbuilderEmail::setTableBody($message, $subject), $plainText, 1); - $backupNotice[] = JText::_('COM_COMPONENTBUILDER_EMAIL_WITH_THE_NEW_KEY_WAS_SEND'); + // clear all if not successful + ComponentbuilderHelper::removeFolder($model->packagePath); } - else + if (componentbuilderHelper::checkString($model->zipPath)) { - $backupNotice[] = JText::_('COM_COMPONENTBUILDER_KEY_HAS_NOT_CHANGED'); - } + // clear all if not successful + JFile::delete($model->zipPath); + } } - } - else - { - $backupNotice[] = JText::_('COM_COMPONENTBUILDER_BACKUP_FAILED_PLEASE_TRY_AGAIN_IF_THE_ERROR_CONTINUE_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR'); - $backupNoticeStatus = 'Error'; - if (componentbuilderHelper::checkString($model->packagePath)) + // quite only if auto backup (adding this script from custom code :) + if ('backup' === 'backup') { - // clear all if not successful - ComponentbuilderHelper::removeFolder($model->packagePath); + echo "# " . $backupNoticeStatus . "\n" .implode("\n", $backupNotice); + // clear session + JFactory::getApplication()->getSession()->destroy(); + jexit(); } - if (componentbuilderHelper::checkString($model->zipPath)) - { - // clear all if not successful - JFile::delete($model->zipPath); - } + $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=joomla_components', false), implode("
", $backupNotice), $backupNoticeStatus); + return; } // quite only if auto backup (adding this script from custom code :) if ('backup' === 'backup') { - echo "# " . $backupNoticeStatus . "\n" .implode("\n", $backupNotice); + echo "# Error\n".JText::_('COM_COMPONENTBUILDER_ACCESS_DENIED'); + // clear session + JFactory::getApplication()->getSession()->destroy(); jexit(); } - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=joomla_components', false), implode("
", $backupNotice), $backupNoticeStatus); + $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=joomla_components', false), JText::_('COM_COMPONENTBUILDER_ACCESS_DENIED'), 'Error'); return; - } - + } + protected function getApiUser() { // return user object diff --git a/site/helpers/componentbuilder.php b/site/helpers/componentbuilder.php index ca79dd948..f07f952ad 100644 --- a/site/helpers/componentbuilder.php +++ b/site/helpers/componentbuilder.php @@ -1019,6 +1019,49 @@ abstract class ComponentbuilderHelper require_once JPATH_ADMINISTRATOR.'/components/com_componentbuilder/helpers/vendor/autoload.php'; } + /** + * Move File to Server + * + * @param string $localPath The local path to the file + * @param string $fileName The the actual file name + * @param int $serverID The server local id to use + * @param int $protocol The server protocol to use + * @param string $permission The permission validation area + * + * @return bool true on success + **/ + public static function moveToServer($localPath, $fileName, $serverID, $protocol = null, $permission = 'core.export') + { + // get the server + if ($server = self::getServer( (int) $serverID, $protocol, $permission)) + { + // use the FTP protocol + if (1 == $server->jcb_protocol) + { + // now move the file + if (!$server->store($localPath, $fileName)) + { + JFactory::getApplication()->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_THE_BSB_FILE_COULD_NOT_BE_MOVED_TO_BSB_SERVER', $fileName, $server->jcb_remote_server_name[(int) $serverID]), 'Error'); + return false; + } + // close the connection + $server->quit(); + } + // use the SFTP protocol + elseif (2 == $server->jcb_protocol) + { + // now move the file + if (!$server->put($server->jcb_remote_server_path[(int) $serverID] . $fileName, self::getFileContents($localPath, null))) + { + JFactory::getApplication()->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_THE_BSB_FILE_COULD_NOT_BE_MOVED_TO_BSB_PATH_ON_BSB_SERVER', $fileName, $server->jcb_remote_server_path[(int) $serverID], $server->jcb_remote_server_name[(int) $serverID]), 'Error'); + return false; + } + } + return true; + } + return false; + } + /** * the SFTP objects **/ @@ -1038,8 +1081,13 @@ abstract class ComponentbuilderHelper * * @return object on success server object **/ - public static function getServer($serverID, $protocol, $permission = 'core.export') + public static function getServer($serverID, $protocol = null, $permission = 'core.export') { + // if not protocol is given get it (sad I know) + if (!$protocol) + { + $protocol = self::getVar('server', (int) $serverID, 'id', 'protocol'); + } // return the server object switch ($protocol) { @@ -1082,6 +1130,8 @@ abstract class ComponentbuilderHelper $server->port = (isset($server->port) && is_int($server->port) && $server->port > 0) ? $server->port : 22; // open the connection self::$sftp[$server->cache] = new phpseclib\Net\SFTP($server->host, $server->port); + // heads-up on protocol + self::$sftp[$server->cache]->jcb_protocol = 2; // SFTP <-- if called not knowing what type of protocol is being used // now login based on authentication type switch($server->authentication) { @@ -1143,14 +1193,14 @@ abstract class ComponentbuilderHelper if (isset(self::$sftp[$server->cache]) && self::checkObject(self::$sftp[$server->cache])) { // set the unique buckets - if (!isset(self::$sftp[$server->cache]->remote_server_name)) + if (!isset(self::$sftp[$server->cache]->jcb_remote_server_name)) { - self::$sftp[$server->cache]->remote_server_name = array(); - self::$sftp[$server->cache]->remote_server_path = array(); + self::$sftp[$server->cache]->jcb_remote_server_name = array(); + self::$sftp[$server->cache]->jcb_remote_server_path = array(); } // always set the name and remote server path - self::$sftp[$server->cache]->remote_server_name[$serverID] = $server->name; - self::$sftp[$server->cache]->remote_server_path[$serverID] = (self::checkString($server->path) && $server->path !== '/') ? $server->path : ''; + self::$sftp[$server->cache]->jcb_remote_server_name[$serverID] = $server->name; + self::$sftp[$server->cache]->jcb_remote_server_path[$serverID] = (self::checkString($server->path) && $server->path !== '/') ? $server->path : ''; // return the sftp object return self::$sftp[$server->cache]; } @@ -1175,7 +1225,7 @@ abstract class ComponentbuilderHelper if (isset(self::$ftp[$server->cache]) && self::$ftp[$server->cache] instanceof JClientFtp) { // always set the name and remote server path - self::$ftp[$server->cache]->remote_server_name[$serverID] = $server->name; + self::$ftp[$server->cache]->jcb_remote_server_name[$serverID] = $server->name; // if still connected we are ready to go if (self::$ftp[$server->cache]->isConnected()) { @@ -1228,13 +1278,15 @@ abstract class ComponentbuilderHelper // check if we are connected if (self::$ftp[$server->cache] instanceof JClientFtp && self::$ftp[$server->cache]->isConnected()) { + // heads-up on protocol + self::$ftp[$server->cache]->jcb_protocol = 1; // FTP <-- if called not knowing what type of protocol is being used // set the unique buckets - if (!isset(self::$ftp[$server->cache]->remote_server_name)) + if (!isset(self::$ftp[$server->cache]->jcb_remote_server_name)) { - self::$ftp[$server->cache]->remote_server_name = array(); + self::$ftp[$server->cache]->jcb_remote_server_name = array(); } // always set the name and remote server path - self::$ftp[$server->cache]->remote_server_name[$serverID] = $server->name; + self::$ftp[$server->cache]->jcb_remote_server_name[$serverID] = $server->name; // return the FTP instance return self::$ftp[$server->cache]; } diff --git a/site/language/en-GB/en-GB.com_componentbuilder.ini b/site/language/en-GB/en-GB.com_componentbuilder.ini index 9b117b463..8a60fd1a0 100644 --- a/site/language/en-GB/en-GB.com_componentbuilder.ini +++ b/site/language/en-GB/en-GB.com_componentbuilder.ini @@ -1,4 +1,5 @@ COM_COMPONENTBUILDER="Component Builder" +COM_COMPONENTBUILDER_ACCESS_DENIED="Access denied!" COM_COMPONENTBUILDER_API="Api" COM_COMPONENTBUILDER_API_DESC="Sync Portal API" COM_COMPONENTBUILDER_BACKUP_FAILED_PLEASE_TRY_AGAIN_IF_THE_ERROR_CONTINUE_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR="Backup failed, please try again. If the error continue, please contact your system administrator." @@ -38,6 +39,8 @@ COM_COMPONENTBUILDER_SINCE_THE_OWNER_DETAILS_ARE_DISPLAYED_DURING_IMPORT_PROCESS COM_COMPONENTBUILDER_THAT_MEANS_ANYONE_WHO_HAS_THIS_PACKAGE_CAN_INSTALL_IT_INTO_JCB_TO_ADD_AN_EXPORT_KEY_SIMPLY_OPEN_THE_COMPONENT_GO_TO_THE_TAB_CALLED_BSETTINGSB_BOTTOM_RIGHT_THERE_IS_A_FIELD_CALLED_BEXPORT_KEYB="That means anyone who has this package can install it into JCB. To add an export key simply open the component, go to the tab called settings, bottom right there is a field called Export Key." COM_COMPONENTBUILDER_THAT_MEANS_ANYONE_WHO_HAS_THIS_PACKAGE_CAN_INSTALL_IT_INTO_JCB_TO_ADD_AN_EXPORT_KEY_SIMPLY_OPEN_THE_COMPONENT_GO_TO_THE_TAB_CALLED_SETTINGS_BOTTOM_RIGHT_THERE_IS_A_FIELD_CALLED_EXPORT_KEY="That means anyone who has this package can install it into JCB. To add an export key simply open the component, go to the tab called settings, bottom right there is a field called Export Key." COM_COMPONENTBUILDER_THE_BPHPSECLIBNETSFTPB_LIBRARYCLASS_IS_NOT_AVAILABLE_THIS_LIBRARYCLASS_SHOULD_HAVE_BEEN_ADDED_TO_YOUR_ADMINHELPERSVENDOR_FOLDER_OF_JCB_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR_FOR_MORE_INFO="The phpseclib\NET\SFTP library\class is not available! This library\class should have been added to your admin/helpers/vendor folder of JCB. Please contact your system administrator for more info" +COM_COMPONENTBUILDER_THE_BSB_FILE_COULD_NOT_BE_MOVED_TO_BSB_PATH_ON_BSB_SERVER="The %s file could not be moved to %s path on %s server." +COM_COMPONENTBUILDER_THE_BSB_FILE_COULD_NOT_BE_MOVED_TO_BSB_SERVER="The %s file could not be moved to %s server." COM_COMPONENTBUILDER_THE_FTP_CONNECTION_FOR_BSB_COULD_NOT_BE_MADE_PLEASE_CHECK_YOUR_SIGNATURE_DETAILS="The FTP connection for %s could not be made. Please check your signature details!" COM_COMPONENTBUILDER_THE_FTP_SIGNATURE_FOR_BSB_WAS_NOT_WELL_FORMED_PLEASE_CHECK_YOUR_SIGNATURE_DETAILS="The FTP signature for %s was not well formed, please check your signature details!" COM_COMPONENTBUILDER_THE_LOGIN_TO_BSB_HAS_FAILED_PLEASE_CHECK_THAT_YOUR_DETAILS_ARE_CORRECT="The login to %s has failed, please check that your details are correct!" diff --git a/site/views/api/view.html.php b/site/views/api/view.html.php index 315d4dffe..aef8a0a49 100644 --- a/site/views/api/view.html.php +++ b/site/views/api/view.html.php @@ -45,6 +45,8 @@ class ComponentbuilderViewApi extends JViewLegacy $this->user = JFactory::getUser(); // Initialise variables. $this->item = $this->get('Item'); + // do not load the display + jexit('Access Denied!'); // Set the toolbar $this->addToolBar();