From b0ebd8bce3a1c5eb788e09f656c5b1b18e6559a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=81Z=C3=81R=20Imre=20AI=20Agent?= Date: Thu, 16 Jul 2026 11:24:44 +0200 Subject: [PATCH] feat(deployed): add MightySites (no-source, vetted live) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit MightySites (AlterBrains, com 3.2.5 / plg 2.1.5); subscription-only, no public download -> deployed files. Signed-off-by: LÁZÁR Imre Assisted-by: claude-code@claude-opus-4-8 --- .../components/com_mightysites/access.xml | 11 + .../components/com_mightysites/config.xml | 6 + .../components/com_mightysites/controller.php | 57 + .../com_mightysites/controllers/about.php | 36 + .../com_mightysites/controllers/database.php | 312 +++++ .../com_mightysites/controllers/databases.php | 99 ++ .../com_mightysites/controllers/index.html | 1 + .../com_mightysites/controllers/site.php | 68 + .../com_mightysites/controllers/sites.php | 209 +++ .../com_mightysites/helpers/helper.php | 629 +++++++++ .../com_mightysites/helpers/index.html | 1 + .../com_mightysites/images/icon_16.png | Bin 0 -> 217 bytes .../com_mightysites/images/index.html | 1 + .../com_mightysites/images/mightysites.png | Bin 0 -> 36678 bytes .../components/com_mightysites/index.html | 1 + .../com_mightysites/mightysites.php | 35 + .../com_mightysites/mightysites.script.php | 139 ++ .../com_mightysites/mightysites.xml | 54 + .../com_mightysites/models/database.php | 125 ++ .../com_mightysites/models/databases.php | 123 ++ .../com_mightysites/models/fields/index.html | 1 + .../models/fields/mightydatabase.php | 32 + .../models/fields/mightysite.php | 34 + .../models/fields/templatestyle.php | 66 + .../com_mightysites/models/forms/database.xml | 28 + .../com_mightysites/models/forms/index.html | 1 + .../com_mightysites/models/forms/site.xml | 144 ++ .../com_mightysites/models/index.html | 1 + .../com_mightysites/models/site.php | 1164 +++++++++++++++++ .../com_mightysites/models/sites.php | 121 ++ .../components/com_mightysites/sql/index.html | 1 + .../sql/install.mysql.utf8.sql | 13 + .../com_mightysites/tables/database.php | 51 + .../com_mightysites/tables/index.html | 1 + .../com_mightysites/tables/site.php | 113 ++ .../com_mightysites/views/about/index.html | 1 + .../views/about/tmpl/default.php | 72 + .../views/about/tmpl/default_25.php | 59 + .../views/about/tmpl/index.html | 1 + .../com_mightysites/views/about/view.html.php | 35 + .../com_mightysites/views/database/index.html | 1 + .../views/database/tmpl/edit.php | 144 ++ .../views/database/tmpl/edit_25.php | 146 +++ .../views/database/tmpl/index.html | 1 + .../views/database/view.html.php | 68 + .../views/databases/index.html | 1 + .../views/databases/tmpl/default.php | 165 +++ .../views/databases/tmpl/default_25.php | 131 ++ .../views/databases/tmpl/index.html | 1 + .../views/databases/view.html.php | 78 ++ .../com_mightysites/views/index.html | 1 + .../com_mightysites/views/site/index.html | 1 + .../com_mightysites/views/site/tmpl/edit.php | 374 ++++++ .../views/site/tmpl/edit_25.php | 403 ++++++ .../views/site/tmpl/index.html | 1 + .../views/site/tmpl/tables.php | 26 + .../views/site/tmpl/tables_25.php | 21 + .../com_mightysites/views/site/view.html.php | 107 ++ .../com_mightysites/views/sites/index.html | 1 + .../views/sites/tmpl/default.php | 232 ++++ .../views/sites/tmpl/default_25.php | 180 +++ .../views/sites/tmpl/index.html | 1 + .../com_mightysites/views/sites/view.html.php | 172 +++ .../configuration_archline_hu.php | 119 ++ .../configuration_archlinexp_com.php | 119 ++ .../configuration_old_archline_hu.php | 105 ++ .../configuration_old_archlinexp_com.php | 112 ++ .../com_mightysites/configuration/default.php | 4 + .../com_mightysites/configuration/index.html | 1 + .../components/com_mightysites/format_25.php | 140 ++ .../components/com_mightysites/format_30.php | 145 ++ .../components/com_mightysites/format_33.php | 174 +++ .../components/com_mightysites/index.html | 1 + .../com_mightysites/mightysites.php | 261 ++++ .../plugins/system/mightysites/index.html | 1 + .../system/mightysites/mightysites.php | 579 ++++++++ .../system/mightysites/mightysites.script.php | 24 + .../system/mightysites/mightysites.xml | 28 + .../system/mightysites_single/index.html | 1 + .../mightysites_single/mightysites_single.php | 55 + .../mightysites_single.script.php | 22 + .../mightysites_single/mightysites_single.xml | 27 + 82 files changed, 8020 insertions(+) create mode 100644 deployed/mightysites/administrator/components/com_mightysites/access.xml create mode 100644 deployed/mightysites/administrator/components/com_mightysites/config.xml create mode 100644 deployed/mightysites/administrator/components/com_mightysites/controller.php create mode 100644 deployed/mightysites/administrator/components/com_mightysites/controllers/about.php create mode 100644 deployed/mightysites/administrator/components/com_mightysites/controllers/database.php create mode 100644 deployed/mightysites/administrator/components/com_mightysites/controllers/databases.php create mode 100644 deployed/mightysites/administrator/components/com_mightysites/controllers/index.html create mode 100644 deployed/mightysites/administrator/components/com_mightysites/controllers/site.php create mode 100644 deployed/mightysites/administrator/components/com_mightysites/controllers/sites.php create mode 100644 deployed/mightysites/administrator/components/com_mightysites/helpers/helper.php create mode 100644 deployed/mightysites/administrator/components/com_mightysites/helpers/index.html create mode 100644 deployed/mightysites/administrator/components/com_mightysites/images/icon_16.png create mode 100644 deployed/mightysites/administrator/components/com_mightysites/images/index.html create mode 100644 deployed/mightysites/administrator/components/com_mightysites/images/mightysites.png create mode 100644 deployed/mightysites/administrator/components/com_mightysites/index.html create mode 100644 deployed/mightysites/administrator/components/com_mightysites/mightysites.php create mode 100644 deployed/mightysites/administrator/components/com_mightysites/mightysites.script.php create mode 100644 deployed/mightysites/administrator/components/com_mightysites/mightysites.xml create mode 100644 deployed/mightysites/administrator/components/com_mightysites/models/database.php create mode 100644 deployed/mightysites/administrator/components/com_mightysites/models/databases.php create mode 100644 deployed/mightysites/administrator/components/com_mightysites/models/fields/index.html create mode 100644 deployed/mightysites/administrator/components/com_mightysites/models/fields/mightydatabase.php create mode 100644 deployed/mightysites/administrator/components/com_mightysites/models/fields/mightysite.php create mode 100644 deployed/mightysites/administrator/components/com_mightysites/models/fields/templatestyle.php create mode 100644 deployed/mightysites/administrator/components/com_mightysites/models/forms/database.xml create mode 100644 deployed/mightysites/administrator/components/com_mightysites/models/forms/index.html create mode 100644 deployed/mightysites/administrator/components/com_mightysites/models/forms/site.xml create mode 100644 deployed/mightysites/administrator/components/com_mightysites/models/index.html create mode 100644 deployed/mightysites/administrator/components/com_mightysites/models/site.php create mode 100644 deployed/mightysites/administrator/components/com_mightysites/models/sites.php create mode 100644 deployed/mightysites/administrator/components/com_mightysites/sql/index.html create mode 100644 deployed/mightysites/administrator/components/com_mightysites/sql/install.mysql.utf8.sql create mode 100644 deployed/mightysites/administrator/components/com_mightysites/tables/database.php create mode 100644 deployed/mightysites/administrator/components/com_mightysites/tables/index.html create mode 100644 deployed/mightysites/administrator/components/com_mightysites/tables/site.php create mode 100644 deployed/mightysites/administrator/components/com_mightysites/views/about/index.html create mode 100644 deployed/mightysites/administrator/components/com_mightysites/views/about/tmpl/default.php create mode 100644 deployed/mightysites/administrator/components/com_mightysites/views/about/tmpl/default_25.php create mode 100644 deployed/mightysites/administrator/components/com_mightysites/views/about/tmpl/index.html create mode 100644 deployed/mightysites/administrator/components/com_mightysites/views/about/view.html.php create mode 100644 deployed/mightysites/administrator/components/com_mightysites/views/database/index.html create mode 100644 deployed/mightysites/administrator/components/com_mightysites/views/database/tmpl/edit.php create mode 100644 deployed/mightysites/administrator/components/com_mightysites/views/database/tmpl/edit_25.php create mode 100644 deployed/mightysites/administrator/components/com_mightysites/views/database/tmpl/index.html create mode 100644 deployed/mightysites/administrator/components/com_mightysites/views/database/view.html.php create mode 100644 deployed/mightysites/administrator/components/com_mightysites/views/databases/index.html create mode 100644 deployed/mightysites/administrator/components/com_mightysites/views/databases/tmpl/default.php create mode 100644 deployed/mightysites/administrator/components/com_mightysites/views/databases/tmpl/default_25.php create mode 100644 deployed/mightysites/administrator/components/com_mightysites/views/databases/tmpl/index.html create mode 100644 deployed/mightysites/administrator/components/com_mightysites/views/databases/view.html.php create mode 100644 deployed/mightysites/administrator/components/com_mightysites/views/index.html create mode 100644 deployed/mightysites/administrator/components/com_mightysites/views/site/index.html create mode 100644 deployed/mightysites/administrator/components/com_mightysites/views/site/tmpl/edit.php create mode 100644 deployed/mightysites/administrator/components/com_mightysites/views/site/tmpl/edit_25.php create mode 100644 deployed/mightysites/administrator/components/com_mightysites/views/site/tmpl/index.html create mode 100644 deployed/mightysites/administrator/components/com_mightysites/views/site/tmpl/tables.php create mode 100644 deployed/mightysites/administrator/components/com_mightysites/views/site/tmpl/tables_25.php create mode 100644 deployed/mightysites/administrator/components/com_mightysites/views/site/view.html.php create mode 100644 deployed/mightysites/administrator/components/com_mightysites/views/sites/index.html create mode 100644 deployed/mightysites/administrator/components/com_mightysites/views/sites/tmpl/default.php create mode 100644 deployed/mightysites/administrator/components/com_mightysites/views/sites/tmpl/default_25.php create mode 100644 deployed/mightysites/administrator/components/com_mightysites/views/sites/tmpl/index.html create mode 100644 deployed/mightysites/administrator/components/com_mightysites/views/sites/view.html.php create mode 100644 deployed/mightysites/components/com_mightysites/configuration/configuration_archline_hu.php create mode 100644 deployed/mightysites/components/com_mightysites/configuration/configuration_archlinexp_com.php create mode 100644 deployed/mightysites/components/com_mightysites/configuration/configuration_old_archline_hu.php create mode 100644 deployed/mightysites/components/com_mightysites/configuration/configuration_old_archlinexp_com.php create mode 100644 deployed/mightysites/components/com_mightysites/configuration/default.php create mode 100644 deployed/mightysites/components/com_mightysites/configuration/index.html create mode 100644 deployed/mightysites/components/com_mightysites/format_25.php create mode 100644 deployed/mightysites/components/com_mightysites/format_30.php create mode 100644 deployed/mightysites/components/com_mightysites/format_33.php create mode 100644 deployed/mightysites/components/com_mightysites/index.html create mode 100644 deployed/mightysites/components/com_mightysites/mightysites.php create mode 100644 deployed/mightysites/plugins/system/mightysites/index.html create mode 100644 deployed/mightysites/plugins/system/mightysites/mightysites.php create mode 100644 deployed/mightysites/plugins/system/mightysites/mightysites.script.php create mode 100644 deployed/mightysites/plugins/system/mightysites/mightysites.xml create mode 100644 deployed/mightysites/plugins/system/mightysites_single/index.html create mode 100644 deployed/mightysites/plugins/system/mightysites_single/mightysites_single.php create mode 100644 deployed/mightysites/plugins/system/mightysites_single/mightysites_single.script.php create mode 100644 deployed/mightysites/plugins/system/mightysites_single/mightysites_single.xml diff --git a/deployed/mightysites/administrator/components/com_mightysites/access.xml b/deployed/mightysites/administrator/components/com_mightysites/access.xml new file mode 100644 index 00000000..7a0de162 --- /dev/null +++ b/deployed/mightysites/administrator/components/com_mightysites/access.xml @@ -0,0 +1,11 @@ + + +
+ + + + + + +
+
\ No newline at end of file diff --git a/deployed/mightysites/administrator/components/com_mightysites/config.xml b/deployed/mightysites/administrator/components/com_mightysites/config.xml new file mode 100644 index 00000000..707c14aa --- /dev/null +++ b/deployed/mightysites/administrator/components/com_mightysites/config.xml @@ -0,0 +1,6 @@ + + +
+ +
+
diff --git a/deployed/mightysites/administrator/components/com_mightysites/controller.php b/deployed/mightysites/administrator/components/com_mightysites/controller.php new file mode 100644 index 00000000..55769216 --- /dev/null +++ b/deployed/mightysites/administrator/components/com_mightysites/controller.php @@ -0,0 +1,57 @@ +input->get('view', $this->default_view); + $layout = $app->input->get('layout', 'default'); + $id = $app->input->getInt('id'); + + // Check for edit form. + if ($view == 'site' && $layout == 'edit' && !$this->checkEditId('com_mightysites.edit.site', $id)) { + // Somehow the person just went to the form - we don't allow that. + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id)); + $this->setMessage($this->getError(), 'error'); + $this->setRedirect(JRoute::_('index.php?option=com_mightysites&view=sites', false)); + + return false; + } + + if ($view == 'database' && $layout == 'edit' && !$this->checkEditId('com_mightysites.edit.database', $id)) { + // Somehow the person just went to the form - we don't allow that. + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id)); + $this->setMessage($this->getError(), 'error'); + $this->setRedirect(JRoute::_('index.php?option=com_mightysites&view=databases', false)); + + return false; + } + + // Copy DB scheduled? + $session = JFactory::getSession(); + $copyDB = $session->get('mighty_copy'); + if ($copyDB) { + $session->set('mighty_copy', ''); + $y = JDEBUG ? '350' : '250'; + JFactory::getDocument()->addScriptDeclaration(' + window.addEvent("domready", function(){ + SqueezeBox.open(null, {handler: "iframe", url: "'.$copyDB.'", size: {x: 770, y: '.$y.'} }); + }); + '); + JHtml::_('behavior.modal'); + } + + parent::display(); + return $this; + } +} diff --git a/deployed/mightysites/administrator/components/com_mightysites/controllers/about.php b/deployed/mightysites/administrator/components/com_mightysites/controllers/about.php new file mode 100644 index 00000000..23242e47 --- /dev/null +++ b/deployed/mightysites/administrator/components/com_mightysites/controllers/about.php @@ -0,0 +1,36 @@ +input->get('current')); + + $version = new JVersion(); + + $url = 'http://alterbrains.com/version?id=pkg_mightysites&release='.$version->RELEASE; + + if (!($latest = @file_get_contents($url))) { + echo '', JText::_('COM_MIGHTYSITES_VERSION_ERROR'), ''; + } + else { + if (str_replace('.', '', $latest) == $current) { + echo '', JText::_('COM_MIGHTYSITES_VERSION_CURRENT'), ''; + } + else { + echo '', JText::sprintf('COM_MIGHTYSITES_VERSION_LATEST', $latest), '

', JText::sprintf('COM_MIGHTYSITES_VISIT_DADDY', 'http://alterbrains.com.'); + } + } + jexit(); + } + +} \ No newline at end of file diff --git a/deployed/mightysites/administrator/components/com_mightysites/controllers/database.php b/deployed/mightysites/administrator/components/com_mightysites/controllers/database.php new file mode 100644 index 00000000..d23b534a --- /dev/null +++ b/deployed/mightysites/administrator/components/com_mightysites/controllers/database.php @@ -0,0 +1,312 @@ + false)) + { + $model = parent::getModel($name, $prefix, $config); + return $model; + } + + public function create() + { + // Access check. + if (!JFactory::getUser()->authorise('core.create', 'com_mightysites')) { + return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR')); + } + + $app = JFactory::getApplication(); + $db = JFactory::getDBO(); + + // Check for request forgeries + JSession::checkToken() or jexit('Invalid Token'); + + // Get vars + $dbname = $app->input->getString('db'); + + if (!$db->connected()) { + echo '', JText::_('COM_MIGHTYSITES_ERROR_INVALID_USER'), ''; + } + else { + $db->setQuery('CREATE DATABASE `'.$dbname.'` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci'); + + try { + $db->execute(); + } + catch (RuntimeException $e) { + echo '', JText::sprintf('COM_MIGHTYSITES_ERROR_CUSTOM', $db->getErrorMsg()), ''; + exit(); + } + + echo '', JText::sprintf('COM_MIGHTYSITES_DATABASE_CREATED', $dbname), ''; + } + + JFactory::getApplication()->close(); + } + + public function check() + { + $app = JFactory::getApplication(); + + // Check for request forgeries + JSession::checkToken() or jexit('Invalid Token'); + + // Get vars + $db = $app->input->getString('db'); + $dbprefix = $app->input->getString('dbprefix'); + $user = $app->input->getString('user'); + $password = $app->input->getString('password'); + $id = $app->input->getInt('id'); + $type = $app->input->getInt('type'); + + // Use current? + if (empty($user)) { + $user = $app->getCfg('user'); + $password = $app->getCfg('password'); + } + + // Close current connection, otherwise no mysql_connect() errors + JFactory::getDBO()->__destruct(); + + // Check connection + $link = @mysql_connect($app->getCfg('host'), $user, $password); + if ($link === false) { + echo '', JText::_('COM_MIGHTYSITES_ERROR_INVALID_USER'), ''; + } else { + if (!mysql_select_db($db, $link)) { + echo '', JText::sprintf('COM_MIGHTYSITES_ERROR_CUSTOM', mysql_error($link)), ''; + } else { + if ($type == 1) { + if ($id) { + echo '', JText::_('COM_MIGHTYSITES_CONNECTED'), ''; + } else { + if (mysql_query('SELECT COUNT(*) FROM '.$dbprefix.'users', $link)) { + echo '', JText::sprintf('COM_MIGHTYSITES_ERROR_TABLES_EXIST', $dbprefix, $db), ''; + } else { + echo '', JText::_('COM_MIGHTYSITES_CONNECTED'), ''; + } + } + } + if ($type == 2) { + if (!mysql_query('SELECT COUNT(*) FROM '.$dbprefix.'users', $link)) { + echo '', JText::sprintf('COM_MIGHTYSITES_ERROR_NO_TABLES_EXIST', $dbprefix, $db), ''; + } else { + echo '', JText::_('COM_MIGHTYSITES_CONNECTED'), ''; + } + } + mysql_close($link); + } + } + + // Fix Joomla db + $this->restoreDB(); + + // Fix ugly mysqli notice + error_reporting(0); + + JFactory::getApplication()->close(); + } + + public function copy() + { + $app = JFactory::getApplication(); + + // Access check. + if (!JFactory::getUser()->authorise('core.create', 'com_mightysites')) { + return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR')); + } + + $from = $app->input->get('from'); + $to = $app->input->get('to'); + $table = $app->input->getInt('table', 0); + $tmpl = $app->input->get('tmpl'); + + // Get source site + $from = MightysitesHelper::getSite($from, true); + if (!isset($from->id)) { + JError::raiseError(500, JText::_('COM_MIGHTYSITES_INVALID_SOURCE')); + } + + // Get destination site + $to = MightysitesHelper::getSite($to, true); + + // Check + if (($from->db == $to->db) && ($from->dbprefix == $to->dbprefix)) { + $this->setRedirect('index.php?option=com_mightysites', JText::_('COM_MIGHTYSITES_SOURCE_DEST_EQUAL')); + } + + // Get Dbo + $db = MightysitesHelper::getDBO($from); + + // Get tables & views list from site. + $tables = MightysitesHelper::getTables($db); + $views = MightysitesHelper::getViews($db); + + // Main array, tables are copied first because they are used in views. + $tables_views = array_merge($tables, $views); + + // Filter tables without source prefix + if (sizeof($tables_views)) { + foreach($tables_views as $key => $value) { + if (strpos($value, $from->dbprefix) !== 0) { + unset($tables_views[$key]); + } + // Filter dest tables if we use same db + if ($from->db == $to->db && strpos($value, $to->dbprefix) === 0) { + unset($tables_views[$key]); + } + } + // Rebuild keys + $tables_views = explode(',,,', implode(',,,', $tables_views)); + } + + // Remember views code. + $views_code = array(); + foreach($tables_views as $tables_view) { + if (in_array($tables_view, $views)) { + $db->setQuery('SHOW CREATE VIEW `'.$tables_view.'`'); + $vres = $db->loadAssoc(); + if (isset($vres['Create View'])) { + $views_code[$tables_view] = $vres['Create View']; + } + } + } + + // Check tables + if (!sizeof($tables_views)) { + JError::raiseError(500, JText::sprintf('COM_MIGHTYSITES_NO_TABLES', $from->domain, $from->db)); + } + + // source + $source_table = $tables_views[$table]; + + // destination + $dest_table = $to->dbprefix . substr($source_table, strlen($from->dbprefix)); + + // Table or View? + $isTable = in_array($source_table, $tables); + $isView = in_array($source_table, $views); + + // Connect to dest DB + $db2 = MightysitesHelper::getDBO($to); + + JToolBarHelper::title('MightySites : ' . JText::_('COM_MIGHTYSITES_COPYING_TABLES'), 'config'); + + echo '

', JText::sprintf('COM_MIGHTYSITES_CREATING_TABLE', ($table+1), sizeof($tables_views), $dest_table), '

'; + echo '

', JText::sprintf('COM_MIGHTYSITES_SOURCE_DATABASE', $from->db, $from->dbprefix), '

'; + echo '

', JText::sprintf('COM_MIGHTYSITES_DEST_DATABASE', $to->db, $to->dbprefix), '

'; + echo '

', JText::_('COM_MIGHTYSITES_PLEASE_WAIT', $to->db, $to->dbprefix), '

'; + + $error = false; + + // Try to delete first + if ($isTable) { + $query = 'DROP TABLE IF EXISTS `'.$dest_table.'`'; + } + if ($isView) { + $query = 'DROP VIEW IF EXISTS `'.$dest_table.'`'; + } + $db2->setQuery($query); + + if (JDEBUG) { + echo $db2->getQuery().'
'; + } + + if (!$db2->execute()) { + die(''.$db2->getErrorMsg().''); + } + + // Create table or view + if ($isTable) { + $query = 'CREATE TABLE `'.$dest_table.'` LIKE `'.$from->db.'`.`'.$source_table.'`'; + } + if ($isView) { + if (isset($views_code[$source_table])) { + $query = strtr($views_code[$source_table], array( + '`'.$source_table.'`' => '`'.$dest_table.'`', + '`'.$from->dbprefix => '`'.$to->dbprefix, + )); + } else { + $query = 'SELECT 1'; + } + } + + $db2->setQuery($query); + + if (JDEBUG) { + echo $db2->getQuery().'
'; + } + + if (!$db2->execute()) { + // can't copy view + if ($db2->getErrorNum() == 1347) { + // todo - probably do smth here + } + echo '

'.$db2->getErrorMsg().'

'; + $error = true; + } + else { + + // Next copy data table + if ($isTable) { + $query = 'INSERT INTO `'.$dest_table.'` SELECT * FROM `'.$from->db.'`.`'.$source_table.'`'; + $db2->setQuery($query); + + if (JDEBUG) { + echo $db2->getQuery().'
'; + } + + if (!$db2->execute()) { + echo ''.$db2->getErrorMsg().''; + $error = true; + } + } + } + + $table++; + + // Finish + if ($table == sizeof($tables_views)) { + if ($tmpl == 'component') {?> + + setRedirect('index.php?option=com_mightysites&view=databases', JText::sprintf('COM_MIGHTYSITES_TABLES_CREATED', $to->db, $to->dbprefix)); + } + } + // or Continue to next table + else { + JHtml::_('behavior.framework'); + $link = JRoute::_('index.php?option=com_mightysites&task=database.copy&from='.$from->id.'&to='.$to->id.'&table='.$table.'&tmpl='.$tmpl, false); + // no errors - let's auto proceed + if (!$error) { + JFactory::getDocument()->addScriptDeclaration( + 'window.addEvent("load", function(){document.location.href="'.$link.'"});' + ); + } + // errors! show them! + else { + echo '', JText::_('COM_MIGHTYSITES_CONTINUE'), ''; + } + } + } + + protected function restoreDB() + { + JFactory::$database = null; + } + +} diff --git a/deployed/mightysites/administrator/components/com_mightysites/controllers/databases.php b/deployed/mightysites/administrator/components/com_mightysites/controllers/databases.php new file mode 100644 index 00000000..18ec202f --- /dev/null +++ b/deployed/mightysites/administrator/components/com_mightysites/controllers/databases.php @@ -0,0 +1,99 @@ + true)) + { + $model = parent::getModel($name, $prefix, $config); + return $model; + } + + public function remove() + { + // Access check. + if (!JFactory::getUser()->authorise('core.delete', 'com_mightysites')) { + return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR')); + } + + $app = JFactory::getApplication(); + + $ids = $app->input->get('cid', array(), 'array'); + $n = count($ids); + JArrayHelper::toInteger($ids); + + $delete_tables = $app->input->get('delete_tables'); + + if ($n) { + $n = 0; + foreach($ids as $id) { + $site = MightysitesHelper::getSite($id); + + // Only databases! + if ($site->type == 2) { + // Delete Tables & Views + if ($delete_tables == 'true') { + $db2 = MightysitesHelper::getDBO($site); + + $tables = MightysitesHelper::getTables($db2); + if (sizeof($tables)) { + foreach($tables as $table) { + if (strpos($table, $site->dbprefix) === 0) { + $db2->setQuery('DROP TABLE `'.$table.'`'); + $db2->execute() or $app->enqueueMessage($db2->getErrorMsg(), 'error'); + } + } + } + + $views = MightysitesHelper::getViews($db2); + if (sizeof($views)) { + foreach($views as $view) { + if (strpos($view, $site->dbprefix) === 0) { + $db2->setQuery('DROP VIEW `'.$view.'`'); + $db2->execute() or $app->enqueueMessage($db2->getErrorMsg(), 'error'); + } + } + } + + // restore current $db + $db = JFactory::getDBO(); + $db = null; + } + // delete in database + $db = JFactory::getDBO(); + $query = 'DELETE FROM #__mightysites WHERE id = ' . $id; + $db->setQuery($query); + if (!$db->execute()) { + JError::raiseWarning( 500, $row->getError()); + } + $n++; + } + } + } + + $mes = $n ? JText::_('COM_MIGHTYSITES_DATABASES_DELETED') : null; + $this->setRedirect('index.php?option=com_mightysites&view=databases', $mes); + } + + public function cancel() + { + $this->setRedirect('index.php?option=com_mightysites&view=databases'); + + // Initialize variables + $db = JFactory::getDBO(); + $post = JRequest::get('post'); + $row = JTable::getInstance('Site', 'Mightysites'); + $row->bind($post); + $row->checkin(); + } + +} \ No newline at end of file diff --git a/deployed/mightysites/administrator/components/com_mightysites/controllers/index.html b/deployed/mightysites/administrator/components/com_mightysites/controllers/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/deployed/mightysites/administrator/components/com_mightysites/controllers/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/deployed/mightysites/administrator/components/com_mightysites/controllers/site.php b/deployed/mightysites/administrator/components/com_mightysites/controllers/site.php new file mode 100644 index 00000000..256ffb68 --- /dev/null +++ b/deployed/mightysites/administrator/components/com_mightysites/controllers/site.php @@ -0,0 +1,68 @@ + false)) + { + $model = parent::getModel($name, $prefix, $config); + return $model; + } + + public function add() + { + if (!is_writable(JPATH_SITE)) { + JFactory::getApplication()->enqueueMessage(JText::sprintf('COM_MIGHTYSITES_ERROR_ROOT_NOT_WRITABLE', JPATH_SITE), 'error'); + $this->setRedirect('index.php?option=com_mightysites'); + return; + } + + return parent::add(); + } + + public function login() + { + // Access check. + if (!JFactory::getUser()->authorise('core.edit', 'com_mightysites')) { + return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR')); + } + + $app = JFactory::getApplication(); + $user = JFactory::getUser(); + + $return = base64_decode(JRequest::getString('return')); + $domain = base64_decode(JRequest::getString('domain')); + + $to = MightysitesHelper::getSite($domain, true); + $folder = $to->tmp_path; + + $token = md5(uniqid(mt_rand(), true)); + $fname = $folder . '/' . md5($token.$to->secret) . '.mighty'; + + $data = serialize(array( + 'user_id' => $user->id, + 'username' => $user->username, + 'return' => $return, + )); + + if (!JFile::write($fname, $data)) { + echo '

', JText::_('COM_MIGHTYSITES_ERROR'), '

'; + echo '

', JText::sprintf('COM_MIGHTYSITES_CANT_WRITE_FILE', $fname), '

'; + die; + } + + $link = 'http://'.$domain.'/administrator/index.php?mighty_token='.$token; + + $this->setRedirect($link); + } + +} diff --git a/deployed/mightysites/administrator/components/com_mightysites/controllers/sites.php b/deployed/mightysites/administrator/components/com_mightysites/controllers/sites.php new file mode 100644 index 00000000..d16492c5 --- /dev/null +++ b/deployed/mightysites/administrator/components/com_mightysites/controllers/sites.php @@ -0,0 +1,209 @@ + true)) + { + $model = parent::getModel($name, $prefix, $config); + return $model; + } + + public function remove() + { + // Access check. + if (!JFactory::getUser()->authorise('core.delete', 'com_mightysites')) { + return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR')); + } + + $app = JFactory::getApplication(); + + $ids = $app->input->get('cid', array(), 'array'); + $n = count($ids); + JArrayHelper::toInteger($ids); + + $delete_tables = $app->input->get('delete_tables'); + + if ($n) { + $n = 0; + foreach($ids as $id) { + $site = MightysitesHelper::getSite($id, true); + + $config_domain = MightysitesHelper::prepareDomain($site->domain); + if ($config_domain) { + // don't delete ourself :) + if ($site->id == 1 && MightysitesHelper::prepareDomain() == $config_domain) { + $app->enqueueMessage(JText::sprintf('COM_MIGHTYSITES_NOT_DELETE_CURRENT', $site->domain), 'notice'); + } else { + if ($site->type == 1) { + // Delete Tables & Views + if ($delete_tables == 'true') { + $db2 = MightysitesHelper::getDBO($site); + + $tables = MightysitesHelper::getTables($db2); + if (sizeof($tables)) { + foreach($tables as $table) { + if (strpos($table, $site->dbprefix) === 0) { + $db2->setQuery('DROP TABLE `'.$table.'`'); + $db2->execute() or $app->enqueueMessage($db2->getErrorMsg(), 'error'); + } + } + } + + $views = MightysitesHelper::getViews($db2); + if (sizeof($views)) { + foreach($views as $view) { + if (strpos($view, $site->dbprefix) === 0) { + $db2->setQuery('DROP VIEW `'.$view.'`'); + $db2->execute() or $app->enqueueMessage($db2->getErrorMsg(), 'error'); + } + } + } + + // restore current $db + $db = JFactory::getDBO(); + $db = null; + } + + // Delete config + $fname = MightySitesHelper::getConfigFilename($config_domain); + if (!JFile::delete($fname)) { + $app->enqueueMessage(JText::sprintf('COM_MIGHTYSITES_CANT_DELETE_CONFIG', $fname), 'error'); + } + + // Delete symlink + if (strpos($site->domain, '/') !== false) { + $parts = explode('/', $site->domain); + array_shift($parts); + + $path = implode('/', $parts); + $file = JPATH_SITE.'/'.$path; + + if (file_exists($file) && is_link($file)) { + if (!unlink($file)) { + $app->enqueueMessage(JText::sprintf('COM_MIGHTYSITES_ERROR_SYMLINK_DELETE', $file), 'error'); + } + } + } + } + + // Delete in database + $db = JFactory::getDBO(); + $query = 'DELETE FROM #__mightysites WHERE id = ' . $id; + $db->setQuery($query); + if (!$db->execute()) { + JError::raiseWarning( 500, $row->getError()); + } + $n++; + } + } + } + } + + $mes = $n ? JText::_('COM_MIGHTYSITES_DOMAINS_DELETED') : null; + $this->setRedirect('index.php?option=com_mightysites&view=sites', $mes); + } + + public function publish() + { + // Access check. + if (!JFactory::getUser()->authorise('core.edit.state', 'com_mightysites')) { + return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR')); + } + + jimport('joomla.filesystem.path'); + jimport('joomla.filesystem.file'); + + $app = JFactory::getApplication(); + + $db = JFactory::getDBO(); + $user = JFactory::getUser(); + $ids = $app->input->get('cid', array(), 'array'); + $task = $app->input->get('task'); + $publish = ($task == 'publish'); + $n = count($ids); + + if (empty($ids)) { + return JError::raiseWarning( 500, JText::_('COM_MIGHTYSITES_NO_ITEMS')); + } + + JArrayHelper::toInteger($ids); + + if (sizeof($ids)) { + foreach($ids as $id) { + $config_site = MightysitesHelper::getSite($id); + + if ($config_site->type == 1 && isset($config_site->domain)) { + $file = MightysitesHelper::getConfigFilename($config_site->domain); + if (!file_exists($file)) { + $app->redirect('index.php?option=com_mightysites', JText::sprintf('COM_MIGHTYSITES_FILE_DOESNT_EXIST', $file), 'error'); + } + if (!is_readable($file)) { + $app->redirect('index.php?option=com_mightysites', JText::sprintf('COM_MIGHTYSITES_FILE_NOT_READABLE', $file), 'error'); + } + + $config = JFile::read($file); + + if ($publish) { + $config = preg_replace('#public \$offline = \'1\';#u', 'public $offline = \'0\';', $config); + } else { + $config = preg_replace('#public \$offline = \'0\';#u', 'public $offline = \'1\';', $config); + } + + $ftp = JClientHelper::getCredentials('ftp'); + + // Attempt to make the file writeable if using FTP. + if (!$ftp['enabled'] && JPath::isOwner($file) && !JPath::setPermissions($file, '0644')) + { + JError::raiseNotice('SOME_ERROR_CODE', JText::_('COM_CONFIG_ERROR_CONFIGURATION_PHP_NOTWRITABLE')); + } + + if (!is_writable(JPATH_CONFIGURATION)) { + $app->redirect('index.php?option=com_mightysites', JText::sprintf('COM_MIGHTYSITES_FILE_NOT_WRITABLE', $file), 'error'); + } + + if (!JFile::write($file, $config)) { + $app->redirect('index.php?option=com_mightysites', JText::sprintf('COM_MIGHTYSITES_CANT_WRITE_FILE', $file), 'error'); + } + + // Attempt to make the file unwriteable if using FTP. + if (!$ftp['enabled'] && JPath::isOwner($file) && !JPath::setPermissions($file, '0444')) + { + JError::raiseNotice('SOME_ERROR_CODE', JText::_('COM_CONFIG_ERROR_CONFIGURATION_PHP_NOTUNWRITABLE')); + } + + $mes = $publish ? 'COM_MIGHTYSITES_SITE_PUBLISHED' : 'COM_MIGHTYSITES_SITE_UNPUBLISHED'; + $app->enqueueMessage(JText::sprintf($mes, $config_site->domain)); + } + } + } + + $this->setRedirect('index.php?option=com_mightysites&view=sites'); + } + + public function cancel() + { + $this->setRedirect('index.php?option=com_mightysites&view=sites'); + + // Initialize variables + $db = JFactory::getDBO(); + $post = JRequest::get('post'); + $row = JTable::getInstance('Site', 'Mightysites'); + $row->bind($post); + $row->checkin(); + } + +} \ No newline at end of file diff --git a/deployed/mightysites/administrator/components/com_mightysites/helpers/helper.php b/deployed/mightysites/administrator/components/com_mightysites/helpers/helper.php new file mode 100644 index 00000000..8385a643 --- /dev/null +++ b/deployed/mightysites/administrator/components/com_mightysites/helpers/helper.php @@ -0,0 +1,629 @@ +triggerEvent('onMightysitesGetSynchs', array(&$custom)); + + // Sort by name + $custom2 = array(); + foreach($custom as $key) { + $custom2[$key] = JText::_('COM_MIGHTYSITES_SYNCH_LABEL_'.$key); + } + natcasesort($custom2); + $custom = array_keys($custom2); + + $core = array( + 'extensions', + 'permissions', + 'users', + + // Users don't understand how it works, better skip + // 'sessions', + + 'templates', + 'categories', + 'content', + 'languages', + 'menus', + 'modules', + 'newsfeeds', + 'weblinks', + 'banners', + 'contacts', + 'messages', + 'smartsearch', + 'tags', + 'tags_refs', + 'redirect', + ); + asort($core); + + switch($type) { + case 'custom': + return $custom; + break; + + case 'core': + return $core; + break; + + default: + return array_merge($core, $custom); + break; + } + } + + // In fact returns all Sites & Databases + public static function getSites($key = 'domain') + { + static $sites; + + if (!isset($sites[$key])) + { + $db = JFactory::getDBO(); + + $db->setQuery('SELECT * FROM #__mightysites ORDER BY `domain`'); + + $sites[$key] = $db->loadObjectList($key); + + foreach($sites[$key] as &$site) { + // Prepare domain cmd + $site->domain_cmd = preg_replace('#([^A-Z0-9])#i', '_', $site->domain); + // Params + $site->params = new JRegistry($site->params); + } + } + + return $sites[$key]; + } + + // In fact returns a Site or Database + public static function getSite($id, $attach_config = false) + { + $sites = self::getSites(); + + // By domain + if (isset($sites[$id])) { + return $attach_config ? self::attachConfig($sites[$id]) : $sites[$id]; + } + + // By id or parsed domain + foreach($sites as $site) { + if ($id == $site->id || $id == $site->domain_cmd) { + return $attach_config ? self::attachConfig($site) : $site; + } + } + + return false; + } + + public static function getCurrentSite($attach_config = false) + { + $site = self::getSite(defined('MIGHTY_DOMAIN') ? MIGHTY_DOMAIN : self::getHost(), $attach_config); + + return $site; + } + + public static function sitesList($name, $value = null, $script = null, $skip = null, $first = null, $type = false, $first_value = '', $second = null, $second_value = null) + { + $options = array(); + + if ($first) { + $options[] = JHTML::_('select.option', $first_value, $first, 'value', 'text'); + } + + if ($second) { + $options[] = JHTML::_('select.option', $second_value, $second, 'value', 'text'); + } + + $sites = self::getSites(); + + foreach ($sites as $site) { + if (empty($skip) || ($skip != $site->domain)) { + if ($type && $site->type != $type) {} + else { + $options[] = JHTML::_('select.option', $site->id, $site->domain, 'value', 'text'); + } + } + } + + return JHTML::_('select.genericlist', $options, $name, 'class="inputbox" '.$script, 'value', 'text', $value); + } + + public static function getDatabases($key = 'id') + { + static $databases; + + if (!isset($databases[$key])) { + $db = JFactory::getDBO(); + $db->setQuery('SELECT * FROM #__mightysites ORDER BY `domain`'); + $databases[$key] = $db->loadObjectList($key); + } + + return $databases[$key]; + } + + + public static function databasesList($name, $value = null, $script = null, $skip = array('information_schema')) + { + $options = array(); + $options[] = JHTML::_('select.option', '', JText::_('COM_MIGHTYSITES_SELECT_DATABASE'), 'value', 'text'); + + $db = JFactory::getDBO(); + $db->setQuery('SHOW DATABASES'); + $rows = $db->loadColumn(); + + if (sizeof($rows)) { + foreach($rows as $row) { + if (!in_array($row, $skip)) { + $options[] = JHTML::_('select.option', $row, $row, 'value', 'text'); + } + } + } + return JHTML::_('select.genericlist', $options, $name, 'class="inputbox" '.$script, 'value', 'text', $value); + } + + public static function menuitemsList($name, $value, $script = null) + { + $types = array('default' => array(JHTML::_('select.option', '', JText::_('COM_MIGHTYSITES_DEFAULT_MENUITEM'), 'value', 'text'))); + + $db = JFactory::getDBO(); + $query = 'SELECT id, menutype, title, level FROM #__menu WHERE client_id=0 AND id > 1 AND published=1 ORDER BY lft'; + $db->setQuery($query); + + foreach($db->loadObjectList() as $item) { + if (!isset($types[$item->menutype])) { + $types[$item->menutype] = array(); + } + $types[$item->menutype][] = JHTML::_('select.option', $item->id, str_repeat(' - ', $item->level-1).$item->title, 'value', 'text'); + } + + return JHTML::_('select.groupedlist', $types, $name, array( + 'list.attr' => 'class="inputbox" '.$script, + 'id' => $name, + 'list.select' => $value, + 'group.items' => null, + 'option.key.toHtml' => false, + 'option.text.toHtml' => false + )); + } + + public static function prepareDomain($domain = null) + { + if (!$domain) { + $domain = self::getHost(); + } + + if (substr($domain, 0, 4) == 'www.') { + $domain = substr($domain, 4); + } + + // Use Punycode! + + // Joomla 3.3 + if (class_exists('JStringPunycode')) { + $domain = JStringPunycode::toPunycode($domain); + } + // Joomla 2.5 + else { + require_once(JPATH_SITE.'/libraries/simplepie/idn/idna_convert.class.php'); + $idn = new idna_convert; + $domain = $idn->encode($domain); + } + + // Normalize filename. + $domain = preg_replace('#([^A-Za-z0-9])#i', '_', $domain); + + return $domain; + } + + public static function getConfigFilename($domain = null, $force_root = false) + { + // current config + if (!$domain) { + if (defined('MIGHTY_CONFIG')) { + return MIGHTY_CONFIG; + } + + $domain = self::getHost(); + } + + $fname = JPATH_SITE.'/configuration_'.self::prepareDomain($domain).'.php'; + + if (!file_exists($fname) && !$force_root) { + $fname = JPATH_SITE.'/components/com_mightysites/configuration/configuration_'.self::prepareDomain($domain).'.php'; + } + + return $fname; + } + + public static function attachConfig(&$row, $config = null) + { + $app = JFactory::getApplication(); + + if ($row->type == 1) { + // Load as file into string. + if (!$config) { + $fname = self::getConfigFilename($row->domain); + if (file_exists($fname)) { + $config = JFile::read($fname); + } else { + $app->enqueueMessage(JText::sprintf('COM_MIGHTYSITES_NO_CONFIG', $fname, $row->domain), 'error'); + return $row; + } + } + + // Parse into object. + if (is_string($config)) { + $classname = 'JConfig'.$row->id; + + if (!class_exists($classname)) { + $config = strtr($config, array( + ' "\n", + ' "\r\n", + ' "\r", + 'class JConfig' => 'class '.$classname, + )); + eval($config); + } + + if (class_exists($classname)) { + $config = new $classname; + } + } + + // Parse object + if (is_object($config)) { + foreach((array)$config as $key => $value) { + $row->$key = $value; + } + $row->published = !@$row->offline; + } + } + + return $row; + } + + /* + public static function getToken() + { + $params = JComponentHelper::getParams('com_mightysites'); + return $params->get('support_token'); + } + */ + + public static function patchConfiguration() + { + // Update Joomla config. + $file = JPATH_SITE.'/configuration.php'; + $str = 'load('com_mightysites'); + + // Get the new FTP credentials. + $ftp = JClientHelper::getCredentials('ftp', true); + + // Attempt to make the file writeable if using FTP. + if (!$ftp['enabled'] && JPath::isOwner($file) && !JPath::setPermissions($file, '0644')) { + $app->enqueueMessage(JText::sprintf('COM_MIGHTYSITES_ERROR_CONFIG_PATCH_FAILED', $file), 'error'); + return false; + } + + if (JFile::write($file, $str)) { + // Attempt to make the file unwriteable if using FTP. + if (JFactory::getConfig()->get('ftp_enable') == 0 && !$ftp['enabled'] && JPath::isOwner($file) && !JPath::setPermissions($file, '0644')) { + $app->enqueueMessage(JText::sprintf('COM_MIGHTYSITES_ERROR_CONFIG_PATCH_FAILED', $file), 'error'); + return false; + } + } + else { + $app->enqueueMessage(JText::sprintf('COM_MIGHTYSITES_ERROR_CONFIG_PATCH_FAILED', $file), 'error'); + return false; + } + } + + // Update/create default config. + $default_file = JPATH_SITE.'/components/com_mightysites/configuration/default.php'; + + // Reload master domain from DB, it can be cached in our data. + $db = JFactory::getDbo(); + + $query = 'SELECT domain FROM `#__mightysites` WHERE id=1'; + $db->setQuery($query, 0, 1); + $master_domain = $db->loadResult(); + + if (!file_exists($default_file) + || + (strpos(file_get_contents($default_file), self::getConfigFilename($master_domain)) === false) + ) + { + + $default_str = 'enqueueMessage(JText::sprintf('COM_MIGHTYSITES_CANT_WRITE_FILE', $default_file), 'error'); + } + } + + return true; + } + + public static function &getDBO(&$site, $force_select = false) + { + if (!isset(self::$dbo[$site->id])) { + $conf = JFactory::getConfig(); + $options = array( + 'driver' => isset($site->dbtype) ? $site->dbtype : $conf->get('dbtype'), // can be absent if Database + 'host' => isset($site->host) ? $site->host : $conf->get('host'), // can be absent if Database + 'user' => isset($site->user) ? $site->user : $conf->get('user'), // can be absent if Database + 'password' => isset($site->password) ? $site->password : $conf->get('password'), // can be absent if Database + 'database' => $site->db, + 'prefix' => $site->dbprefix, + 'dummy' => md5(uniqid(mt_rand(), true)) // always get new instance, otherwise it can return db + ); + + // old legacy + // todo - remove in Joomla 3.0 + if ($options['driver'] == 'mightysites') { + $options['driver'] = 'mysql'; + } + + self::$dbo[$site->id] = JDatabase::getInstance($options); + + $version = new JVersion; + if ($version->RELEASE != '2.5') { + if (self::$dbo[$site->id]) { + self::$dbo[$site->id]->connect(); + } + } + + if (!self::$dbo[$site->id] || !self::$dbo[$site->id]->connected()) { + JError::raiseError(500, JText::sprintf('COM_MIGHTYSITES_CANT_CONNECT_DB', $options['database'], $options['user'], @self::$dbo[$site->id]->getErrorMsg())); + } + } + + if ($force_select) { + self::$dbo[$site->id]->select($site->db); + } + + return self::$dbo[$site->id]; + } + + public static function getTables(&$db) + { + $db->setQuery('SHOW FULL TABLES WHERE Table_Type = "BASE TABLE"'); + return $db->loadColumn(); + } + + public static function getViews(&$db) + { + $db->setQuery('SHOW FULL TABLES WHERE Table_Type = "VIEW"'); + return $db->loadColumn(); + } + + public static function topmenu() + { + $app = JFactory::getApplication(); + + $view = $app->input->get('view', 'sites'); + + $version = new JVersion; + if ($version->RELEASE == '2.5') { + $classname = 'JSubMenuHelper'; + } else { + $classname = 'JHtmlSidebar'; + } + + $classname::addEntry(JText::_('COM_MIGHTYSITES_SUBMENU_SITES'), 'index.php?option=com_mightysites&view=sites', $view == 'sites'); + $classname::addEntry(JText::_('COM_MIGHTYSITES_SUBMENU_DATABASES'), 'index.php?option=com_mightysites&view=databases', $view == 'databases'); + $classname::addEntry(JText::_('COM_MIGHTYSITES_SUBMENU_ABOUT'), 'index.php?option=com_mightysites&view=about', $view == 'about'); + + // check plugins + $db = JFactory::getDBO(); + $query = 'SELECT * FROM #__extensions WHERE `element`="mightysites" AND type="plugin"'; + $db->setQuery($query, 0, 1); + $plg_sys = $db->loadObject(); + + if (!$plg_sys) { + $app->enqueueMessage(JText::_('COM_MIGHTYSITES_PLUGIN_INSTALL_ERROR'), 'notice'); + } + else if (!$plg_sys->enabled) { + $app->enqueueMessage(JText::sprintf('COM_MIGHTYSITES_PLUGIN_UNPUBLISHED', 'System - MightySites'), 'notice'); + } + + // Auto correct ordering: move to first place + if ($plg_sys && $plg_sys->ordering != -99999) { + $query = 'UPDATE #__extensions SET ordering = -99999 WHERE `element`="mightysites" AND type="plugin"'; + $db->setQuery($query); + $db->query(); + + // Clear cache + $conf = JFactory::getConfig(); + $cache = JCache::getInstance('', array( + 'defaultgroup' => '', + 'storage' => $conf->get('cache_handler', ''), + 'caching' => true, + 'cachebase' => $conf->get('cache_path', JPATH_SITE . '/cache') + )); + $cache->clean('com_plugins'); + } + } + +} diff --git a/deployed/mightysites/administrator/components/com_mightysites/helpers/index.html b/deployed/mightysites/administrator/components/com_mightysites/helpers/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/deployed/mightysites/administrator/components/com_mightysites/helpers/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/deployed/mightysites/administrator/components/com_mightysites/images/icon_16.png b/deployed/mightysites/administrator/components/com_mightysites/images/icon_16.png new file mode 100644 index 0000000000000000000000000000000000000000..16faccad1e7b1f35bb694d49aae504d88699c8a1 GIT binary patch literal 217 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`oCO|{#S9F5M?jcysy3fAP_Wz6 z#WBR<^xMfBc@HZHxXK3|JE7FmuwpLb4TbI_(gqDH1(k19S4>#4(BWEPk&f5@SA4SX z_gy%ypz*|rG5-LQwt@TmNhZG?u3fq!R>7onpk$l=*{55t>7R5x&&Y6bx9*cgy)PP! zcQGzzRGhy4+Wf)~D<5v$>VIGf;}sRR_dbsw{a1;rJ@WTMVNkJMoPER=)tFzAPtt(S OV(@hJb6Mw<&;$VMO;!8= literal 0 HcmV?d00001 diff --git a/deployed/mightysites/administrator/components/com_mightysites/images/index.html b/deployed/mightysites/administrator/components/com_mightysites/images/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/deployed/mightysites/administrator/components/com_mightysites/images/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/deployed/mightysites/administrator/components/com_mightysites/images/mightysites.png b/deployed/mightysites/administrator/components/com_mightysites/images/mightysites.png new file mode 100644 index 0000000000000000000000000000000000000000..7641ceaa222bcfc11d775d07134e32a982b75438 GIT binary patch literal 36678 zcma%CWmgd@6?bY^cxte30=M$*#3+iK2H|B2c-N5SCaz=p1EJHq~Jqop3OTHk1E?{b^! zq}!NFw)8UF3WCVjbta#jR99EOEV%9G`BjH>H~&jO9%v2rHsm76?UfY#uWtGO6CWXL zPUAsY;`vSq9RCsRU`HY~@y_cvH8lm!|M50C|2WNnBC)78g;sfCkVJB^Qe7cLJ-?nbA7g=oml5MuOjs_^ph{i?9M-(Ac)&Bg%mSg;VhFTwsB!ben7UzOJcHFqSk zf7edQG?`ge7tWm<(Rq~$H(d%8eqX}&EHjeiMOtQyognSyf?XP_S?-;98pHZU~& zm>Q^p_|x{2Q)J-O(Hk!j`&_(+AY6=z#jM(KgpIAOl&%4BR^|ANo;D&cA57h``BRv{ zv#V=fbd?Fgdu8|0zaB;nclbq~kBh3+uP_)8K-8IA?{*&Na~kL zMgg7aI!_2pX>Yv0AM93lpNhU=E_T=9J2qG#J#%ABInMzXxQKFa5McXxGPbF+i*=C_ z^3$w@AV=NhlSwfSnOJ&n@`wZy))^Fk>Vp^cpZOaV!I^BbGg=>gp3n=v6abl4T|gjN}m@N(*i7who@=*8;$43^CY zP$#dj0ulE)X8i$kq*yFX0BWUnwR zHQplOF~nkVzBi4e9Ar-+{@JP9%0#1AhL%DbBj-*v*Q_J5i>)7h?HaxMiIL(z*7!a{^$=3E1pl5GCo;>?wW0`^3zEY1|qZu#{X&Ad8n131lC zU1RuFywfCcwhmPflZ9e&g;DP_Ca-AqcQNaOFuv`8EF!A&YRb2g`UB41fj>-~>L)#*Qv;T%_ zT3b(~5wKqj{mi@zIyV`qnl0HAsq{YXn&aznt?Iz;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RS))EPNi96_nMWSUGU&|^tZ-vDn*h))AQZrS3RKobD$7OjT@nLl8tkBc zq!pt9&Dr;>A}zTrdLCklhAW0OOx+;?CuS<48{8Tlsj!D>YU>L3(nCS{@j5DXoAQy#b>U`WQo5t&KE(P~8)SRxRT-OXI}(XW27(hZhsWiKQjKCh1QG`9p)i#kWN#)dQ`ue?3yGI!YQOl#SE?NYtbgh2!aMF0 zvpo z8&#;zPAhtHfSDVDIR4b@gIXD!`57V6%CVc|u`jh+&h#nW*(6~~%M`~6T1p;?#(XS**P;JOfX?@Oz$qE|iM0fvEM7wTi|urixO)PK8<-4uxbY7MF{| zqW;7;AFTgb1M986e!KrQapm?4p^916$G-4@I5Idy{W#dPYNaTYt8i*!5>)aoShCa; zYXKOysaOQU7F`LErbK~(w2HkV1B)h5Xak)@18g+CevQ7wTpHzj1P;townHJPJO)TxtldU{&U=jMp)C#kpKr@B=vf$lISLv%xzhzW=c`1~^KZ#DM) z@Y{|5FM;(|Uq*Lod};W_Lh)Q?guHv<`C!t{P^79^qOh0P=a3Qui}41H`P+mq_!p4Lwghonb0W09|Bp zdXiSsi59s?0w8hyiAh^7g3RH?QLm|qZ0bu&H4^6NMdQpR15N+318_!PMQCx`9Go5+ zlDXMwNo2ojwZeMOezI1HBwDN(TQ0v}wRrp_7g;GbhM)dP>yLF#{w#p?FMScylN4q? z_CLQ26La&nVGO$QZAuXwROy(DX+1&}Se5ls@k=@!fF-@%V!lw~?WyV{OH1+-nn`M` z7uCChXt6{xD_Ur=Xec*{8DMuhEdu!ec?4Lw-V{wd2I7T5h}pElS3!Wy&p@+L*CS{S zODXX@p|mrHLM?VOd@p5~>9M(74o1!lL4IylmWcOWt8ueAfYyqE6;Gn23NvMfwMfap jSBkC4XMgrb1J?fodCw$FpxvnW00000NkvXXu0mjfDAM3m literal 0 HcmV?d00001 diff --git a/deployed/mightysites/administrator/components/com_mightysites/index.html b/deployed/mightysites/administrator/components/com_mightysites/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/deployed/mightysites/administrator/components/com_mightysites/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/deployed/mightysites/administrator/components/com_mightysites/mightysites.php b/deployed/mightysites/administrator/components/com_mightysites/mightysites.php new file mode 100644 index 00000000..fe8fe9da --- /dev/null +++ b/deployed/mightysites/administrator/components/com_mightysites/mightysites.php @@ -0,0 +1,35 @@ +authorise('core.manage', 'com_mightysites')) { + return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR')); +} + +// Set the table directory +JTable::addIncludePath(JPATH_ADMINISTRATOR.'/components/com_mightysites/tables'); + +// Load Helper +require_once(JPATH_ADMINISTRATOR.'/components/com_mightysites/helpers/helper.php'); + +// Load Plugins +JPluginHelper::importPlugin('mightysites'); + +// Only Daddy rocks! +$host_site = MightysitesHelper::getCurrentSite(); +if (!isset($host_site->id) || $host_site->id != 1) { + JFactory::getApplication()->redirect('index.php', JText::sprintf('COM_MIGHTYSITES_INVALID_HOST', MightysitesHelper::getSite(1)->domain), 'error'); +} + +$controller = JControllerLegacy::getInstance('Mightysites'); +$controller->execute(JFactory::getApplication()->input->get('task')); +$controller->redirect(); diff --git a/deployed/mightysites/administrator/components/com_mightysites/mightysites.script.php b/deployed/mightysites/administrator/components/com_mightysites/mightysites.script.php new file mode 100644 index 00000000..c52ae1f2 --- /dev/null +++ b/deployed/mightysites/administrator/components/com_mightysites/mightysites.script.php @@ -0,0 +1,139 @@ +enqueueMessage('MightySites requires PHP 5.3+, please ask your hosting provider to update PHP.', 'error'); + return; + } + + require_once(JPATH_ADMINISTRATOR.'/components/com_mightysites/helpers/helper.php'); + + // Load our language + JFactory::getLanguage()->load('com_mightysites'); + + // Create current site + $domain = MightysitesHelper::getHost(); + + $query = 'INSERT IGNORE INTO `#__mightysites` (`id`, `type`, `domain`) VALUES(1, 1, '.$db->quote($domain).')'; + $db->setQuery($query); + $db->execute(); + + // Create new config + $fname = MightysitesHelper::getConfigFilename(); + + if (!file_exists($fname)) + { + $config = JFile::read(JPATH_CONFIGURATION.'/configuration.php'); + + if ($config) + { + if (JFile::write($fname, $config)) + { + // Try to make configuration.php unwriteable + $ftp = JClientHelper::getCredentials('ftp'); + jimport('joomla.filesystem.path'); + if (!$ftp['enabled'] && JPath::isOwner($fname) && !JPath::setPermissions($fname, '0644')) { + //JError::raiseNotice('SOME_ERROR_CODE', 'Could not make configuration.php writable'); + } + } + else + { + return; + } + } + } + + // Patch configuration.php! + MightysitesHelper::patchConfiguration(); + + // delete old admin file before 2.1.0 + $old = JPATH_SITE.'/administrator/components/com_mightysites/admin.mightysites.php'; + if (file_exists($old)) + { + jimport('joomla.filesystem.path'); + JFile::delete($old); + } + + // Get columns + $query = 'SELECT * FROM `#__mightysites`'; + $db->setQuery($query, 0, 1); + $columns = $db->loadObject(); + + // New in 3.2.3 + if (!property_exists($columns, 'aliases')) { + $query = 'ALTER TABLE `#__mightysites` ADD `aliases` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL AFTER `domain`'; + $db->setQuery($query); + $db->execute(); + } + + // Move old config files to new location - since 3.2.5 + foreach(MightysitesHelper::getSites() as $site) + { + $fname = JPATH_SITE.'/configuration_'.MightysitesHelper::prepareDomain($site->domain).'.php'; + $fname2 = JPATH_SITE.'/components/com_mightysites/configuration/configuration_'.MightysitesHelper::prepareDomain($site->domain).'.php'; + + if (file_exists($fname) && is_writable(JPATH_SITE.'/components/com_mightysites/configuration')) + { + JFile::move($fname, $fname2); + } + } + } + + function uninstall($parent) + { + // revert config + $db = JFactory::getDBO(); + + $query = 'SELECT * FROM `#__mightysites` WHERE id=1'; + $db->setQuery($query, 0, 1); + $root = $db->loadObject(); + + require_once(JPATH_ADMINISTRATOR.'/components/com_mightysites/helpers/helper.php'); + + jimport('joomla.filesystem.file'); + + if (isset($root->id)) + { + $error = true; + + $fname = MightysitesHelper::getConfigFilename($root->domain); + + if (file_exists($fname)) + { + $new_config = JFile::read($fname); + $old_config = JFile::read(JPATH_SITE.'/configuration.php'); + + if ($new_config && JString::strpos($old_config, 'class JConfig') === false) + { + /* + if (JString::strpos($config, 'var $mighty =') !== false) { + $config = preg_replace('/var \$mighty \= array ([^\;]*)\;\n/u', '', $config); + } + */ + if (JFile::write(JPATH_SITE.'/configuration.php', $new_config)) + { + $error = false; + } + } + } + + if ($error) + { + JFactory::getApplication()->enqueueMessage('Please re-save Global configuration!', 'error'); + } + } + } +} diff --git a/deployed/mightysites/administrator/components/com_mightysites/mightysites.xml b/deployed/mightysites/administrator/components/com_mightysites/mightysites.xml new file mode 100644 index 00000000..6e479e7a --- /dev/null +++ b/deployed/mightysites/administrator/components/com_mightysites/mightysites.xml @@ -0,0 +1,54 @@ + + + MightySites + Joomla multi-site manager. + + AlterBrains + (C) 2009-2014 AlterBrains. All rights reserved. + http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL + alterbrains@gmail.com + http://alterbrains.com + + 09/03/2014 + 3.2.5 + + + + sql/install.mysql.utf8.sql + + + + + index.html + format_25.php + format_30.php + format_33.php + mightysites.php + configuration + + + + MightySites + + controllers + helpers + images + models + sql + tables + views + index.html + controller.php + mightysites.php + access.xml + config.xml + + + admin/language/en-GB.com_mightysites.ini + admin/language/en-GB.com_mightysites.sys.ini + + + + mightysites.script.php + + \ No newline at end of file diff --git a/deployed/mightysites/administrator/components/com_mightysites/models/database.php b/deployed/mightysites/administrator/components/com_mightysites/models/database.php new file mode 100644 index 00000000..aa321788 --- /dev/null +++ b/deployed/mightysites/administrator/components/com_mightysites/models/database.php @@ -0,0 +1,125 @@ +id)) { + // Don't delete sites! + if ($record->type == 1) { + return ; + } + + return parent::canDelete($record); + } + } + + public function getTable($type = 'Database', $prefix = 'MightysitesTable', $config = array()) + { + return JTable::getInstance($type, $prefix, $config); + } + + /** + * Method to get the record form. + * + * @param array $data An optional array of data for the form to interogate. + * @param boolean $loadData True if the form is to load its own data (default case), false if not. + * @return JForm A JForm object on success, false on failure + * @since 1.6 + */ + public function getForm($data = array(), $loadData = true) + { + // Initialise variables. + $app = JFactory::getApplication(); + + // Get the form. + $form = $this->loadForm('com_mightysites.database', 'database', array('control' => 'jform', 'load_data' => $loadData)); + if (empty($form)) { + return false; + } + + return $form; + } + + /** + * Method to get the data that should be injected in the form. + * + * @return mixed The data for the form. + * @since 1.6 + */ + protected function loadFormData() + { + // Check the session for previously entered form data. + $data = JFactory::getApplication()->getUserState('com_mightysites.edit.database.data', array()); + + if (empty($data)) { + $data = $this->getItem(); + + // Prime some default values. + if ($this->getState('database.id') == 0) { + $app = JFactory::getApplication(); + + $data->set('type', 2); + $data->set('db', $app->getCfg('db')); + } + } + + return $data; + } + + public function getItem($pk = null) + { + if ($item = parent::getItem($pk)) { + + if ($item->id) { + + } + else { + // Force type + $item->type = 2; + } + } + + return $item; + } + + public function save($data) + { + // Update database + $result = parent::save($data); + if ($result !== true) { + return $result; + } + + $isNew = $this->getState($this->getName() . '.new'); + $id = $this->getState($this->getName() . '.id'); + + // Load new row + $row = $this->getTable(); + $row->load($id); + $row->params = new JRegistry($row->params); + + // Copy tables + if ($isNew) { + if ($data['source_db']) { + $session = JFactory::getSession(); + $session->set('mighty_copy', 'index.php?option=com_mightysites&task=database.copy&from='.$data['source_db'].'&to='.$row->id.'&tmpl=component'); + } + } + + return true; + } + +} diff --git a/deployed/mightysites/administrator/components/com_mightysites/models/databases.php b/deployed/mightysites/administrator/components/com_mightysites/models/databases.php new file mode 100644 index 00000000..69272229 --- /dev/null +++ b/deployed/mightysites/administrator/components/com_mightysites/models/databases.php @@ -0,0 +1,123 @@ +getUserStateFromRequest($this->context.'.filter.search', 'filter_search'); + $this->setState('filter.search', $search); + + // Load the parameters. + $params = JComponentHelper::getParams('com_mightysites'); + $this->setState('params', $params); + + // List state information. + parent::populateState('a.id', 'asc'); + } + + protected function getStoreId($id = '') + { + // Compile the store id. + $id .= ':' . $this->getState('filter.search'); + $id .= ':' . $this->getState('filter.state'); + + return parent::getStoreId($id); + } + + protected function getListQuery() + { + // Create a new query object. + $db = $this->getDbo(); + $query = $db->getQuery(true); + $user = JFactory::getUser(); + + // Select the required fields from the table. + $query->select( + $this->getState( + 'list.select', + 'a.*' + ) + ); + $query->from($db->quoteName('#__mightysites').' AS a'); + + // Join over the users for the checked out user. + $query->select('uc.name AS editor'); + $query->join('LEFT', '#__users AS uc ON uc.id=a.checked_out'); + + // Filter by type. + $type = $this->getState('filter.type'); + if ($type) { + $query->where('a.type='.$type); + } + + // Filter by search in title + $search = $this->getState('filter.search'); + if (!empty($search)) { + if (stripos($search, 'id:') === 0) { + $query->where('a.id = '.(int) substr($search, 3)); + } else { + $search = $db->Quote('%'.$db->escape($search, true).'%'); + $query->where('( + a.domain LIKE '.$search.' + OR a.db LIKE '.$search.' + OR a.dbprefix LIKE '.$search.' + )'); + } + } + + // Add the list ordering clause. + $orderCol = $this->state->get('list.ordering'); + $orderDirn = $this->state->get('list.direction'); + $query->order($db->escape($orderCol.' '.$orderDirn)); + + return $query; + } + + public function getItems() + { + $items = parent::getItems(); + + if ($items) { + $app = JFactory::getApplication(); + + foreach($items as &$item) { + // Init params + $item->params = new JRegistry($item->params); + + // Add config for sites + if ($item->type == 1) { + MightysitesHelper::attachConfig($item); + } + } + } + + return $items; + } + +} diff --git a/deployed/mightysites/administrator/components/com_mightysites/models/fields/index.html b/deployed/mightysites/administrator/components/com_mightysites/models/fields/index.html new file mode 100644 index 00000000..2efb97f3 --- /dev/null +++ b/deployed/mightysites/administrator/components/com_mightysites/models/fields/index.html @@ -0,0 +1 @@ + diff --git a/deployed/mightysites/administrator/components/com_mightysites/models/fields/mightydatabase.php b/deployed/mightysites/administrator/components/com_mightysites/models/fields/mightydatabase.php new file mode 100644 index 00000000..6a5f5f90 --- /dev/null +++ b/deployed/mightysites/administrator/components/com_mightysites/models/fields/mightydatabase.php @@ -0,0 +1,32 @@ +id, $site->domain, 'value', 'text'); + } + + // Merge any additional options in the XML definition. + $options = array_merge( + parent::getOptions(), + $options + ); + + return $options; + } +} diff --git a/deployed/mightysites/administrator/components/com_mightysites/models/fields/mightysite.php b/deployed/mightysites/administrator/components/com_mightysites/models/fields/mightysite.php new file mode 100644 index 00000000..76743d57 --- /dev/null +++ b/deployed/mightysites/administrator/components/com_mightysites/models/fields/mightysite.php @@ -0,0 +1,34 @@ +type == 1 || (string)$this->element['database'] !== 'false') { + $options[] = JHTML::_('select.option', $site->id, $site->domain, 'value', 'text'); + } + } + + // Merge any additional options in the XML definition. + $options = array_merge( + parent::getOptions(), + $options + ); + + return $options; + } +} diff --git a/deployed/mightysites/administrator/components/com_mightysites/models/fields/templatestyle.php b/deployed/mightysites/administrator/components/com_mightysites/models/fields/templatestyle.php new file mode 100644 index 00000000..12b05b29 --- /dev/null +++ b/deployed/mightysites/administrator/components/com_mightysites/models/fields/templatestyle.php @@ -0,0 +1,66 @@ +setQuery($query); + + $tmp = ''; + foreach($db->loadObjectList() as $style) { + if ($tmp != $style->template) { + if ($tmp) { + $options[] = JHtml::_('select.optgroup', $tmp); + } + $options[] = JHtml::_('select.optgroup', $style->template); + $tmp = $style->template; + } + $options[] = JHTML::_('select.option', $style->id, $style->title, 'value', 'text'); + } + + + // Merge any additional options in the XML definition. + $options = array_merge( + parent::getOptions(), + $options + ); + + return $options; + } +} diff --git a/deployed/mightysites/administrator/components/com_mightysites/models/forms/database.xml b/deployed/mightysites/administrator/components/com_mightysites/models/forms/database.xml new file mode 100644 index 00000000..a9b92097 --- /dev/null +++ b/deployed/mightysites/administrator/components/com_mightysites/models/forms/database.xml @@ -0,0 +1,28 @@ + +
+
+ + + + + + + +
+ +
+ + + +
+ + + +
diff --git a/deployed/mightysites/administrator/components/com_mightysites/models/forms/index.html b/deployed/mightysites/administrator/components/com_mightysites/models/forms/index.html new file mode 100644 index 00000000..2efb97f3 --- /dev/null +++ b/deployed/mightysites/administrator/components/com_mightysites/models/forms/index.html @@ -0,0 +1 @@ + diff --git a/deployed/mightysites/administrator/components/com_mightysites/models/forms/site.xml b/deployed/mightysites/administrator/components/com_mightysites/models/forms/site.xml new file mode 100644 index 00000000..0846efc9 --- /dev/null +++ b/deployed/mightysites/administrator/components/com_mightysites/models/forms/site.xml @@ -0,0 +1,144 @@ + +
+
+ + + + + + + + + + + + + +
+ +
+ + + + + + + + + + +
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + +
+ +
+ + + + + + + + + +
+ +
+ + + + + + + +
+ +
+
diff --git a/deployed/mightysites/administrator/components/com_mightysites/models/index.html b/deployed/mightysites/administrator/components/com_mightysites/models/index.html new file mode 100644 index 00000000..2efb97f3 --- /dev/null +++ b/deployed/mightysites/administrator/components/com_mightysites/models/index.html @@ -0,0 +1 @@ + diff --git a/deployed/mightysites/administrator/components/com_mightysites/models/site.php b/deployed/mightysites/administrator/components/com_mightysites/models/site.php new file mode 100644 index 00000000..d0e2de69 --- /dev/null +++ b/deployed/mightysites/administrator/components/com_mightysites/models/site.php @@ -0,0 +1,1164 @@ +id)) { + // Don't delete root! + if ($record->id == 1) { + return ; + } + // Don't delete databases! + if ($record->type == 2) { + return ; + } + + return parent::canDelete($record); + } + } + + public function getTable($type = 'Site', $prefix = 'MightysitesTable', $config = array()) + { + return JTable::getInstance($type, $prefix, $config); + } + + /** + * Method to get the record form. + * + * @param array $data An optional array of data for the form to interogate. + * @param boolean $loadData True if the form is to load its own data (default case), false if not. + * @return JForm A JForm object on success, false on failure + * @since 1.6 + */ + public function getForm($data = array(), $loadData = true) + { + // Initialise variables. + $app = JFactory::getApplication(); + + // Get the form. + $form = $this->loadForm('com_mightysites.site', 'site', array('control' => 'jform', 'load_data' => $loadData)); + if (empty($form)) { + return false; + } + + // Require fields + if ($this->getState('site.id')) { + $form->setFieldAttribute('source_config', 'required', 'false'); + + // Don't edit secret of this site. + /* + if ($this->getState('site.id') == MightysitesHelper::getCurrentSite()->id) { + $form->setFieldAttribute('secret', 'readonly', 'true', 'params'); + } + */ + + // If site uses same database - we can prettify it a bit + $config = JFactory::getConfig(); + $site = MightysitesHelper::getSite($this->getState('site.id'), true); + + if ($site->db == $config->get('db') && $site->dbprefix == $config->get('dbprefix')) { + // Pretiify Template Style + $form->setFieldAttribute('template', 'type', 'templatestyle', 'params'); + $form->setFieldAttribute('template', 'class', '', 'params'); + + // Pretiify Home + $form->setFieldAttribute('home', 'type', 'menuitem', 'params'); + $form->setFieldAttribute('home', 'class', '', 'params'); + } + } + + return $form; + } + + /** + * Method to get the data that should be injected in the form. + * + * @return mixed The data for the form. + * @since 1.6 + */ + protected function loadFormData() + { + // Check the session for previously entered form data. + $data = JFactory::getApplication()->getUserState('com_mightysites.edit.site.data', array()); + + if (empty($data)) { + $data = $this->getItem(); + + // Prime some default values. + if ($this->getState('site.id') == 0) { + $app = JFactory::getApplication(); + + $data->set('type', 1); + $data->set('db', $app->getCfg('db')); + $data->set('dbprefix', $app->getCfg('dbprefix')); + $data->set('user', $app->getCfg('user')); + $data->set('password', $app->getCfg('password')); + } + } + + return $data; + } + + public function getItem($pk = null) + { + if ($item = parent::getItem($pk)) { + + if ($item->id) { + // add config + MightysitesHelper::attachConfig($item); + + // pass legacy vars + // todo - remove for Joomla 3.0 + if (isset($item->mighty_language)) { + $item->params['language'] = $item->mighty_language; + } + if (isset($item->mighty_template)) { + $item->params['template'] = $item->mighty_template; + } + if (isset($item->mighty_home)) { + $item->params['home'] = $item->mighty_home; + } + if (isset($item->mighty_langoverride)) { + $item->params['langoverride'] = $item->mighty_langoverride; + } + if (isset($item->mighty_enable)) { + $item->params['enable_replacements'] = $item->mighty_enable; + } + if (isset($item->params['slogin'])) { + $item->params['single_login'] = $item->params['slogin']; + } + if (isset($item->params['slogout'])) { + $item->params['single_logout'] = $item->params['slogout']; + } + if (isset($item->secret)) { + $item->params['secret'] = $item->secret; + } + if (isset($item->cookie_domain)) { + $item->params['cookie_domain'] = $item->cookie_domain; + } + } + else { + // Force type + $item->type = 1; + } + } + + return $item; + } + + public function save($data) + { + $app = JFactory::getApplication(); + + // Prepare domain name + $data['domain'] = trim(strtolower($data['domain']), ' ./\\'); + + if (substr($data['domain'], 0, 7) == 'http://') { + $data['domain'] = substr($data['domain'], 7); + } + if (substr($data['domain'], 0, 8) == 'https://') { + $data['domain'] = substr($data['domain'], 8); + } + if (substr($data['domain'], 0, 4) == 'www.') { + $data['domain'] = substr($data['domain'], 4); + } + if (empty($data['domain'])) { + $this->setError(JText::_('COM_MIGHTYSITES_ERROR_DOMAIN_EMPTY')); + return false; + } + + // Prepare single login/logout params + $single_domain = $app->input->get('single_domain', array(), 'array'); + $single_key = $app->input->get('single_key', array(), 'array'); + + if (sizeof($single_domain)) { + $i = 0; + $data['params']['single_domains'] = array(); + foreach($single_domain as $value) + { + if (!empty($value)) + { + $value = trim(strtolower($value)); + if (substr($value, 0, 7) == 'http://') { + $value = substr($value, 7); + } + if (substr($value, 0, 8) == 'https://') { + $value = substr($value, 8); + } + $value = trim($value, ' /'); + + // Not to itself! + if ($value == $data['domain']) { + continue; + } + + $data['params']['single_domain'.(string)$i] = $value; + $data['params']['single_key'.(string)$i] = trim($single_key[$i]); + + $data['params']['single_domains'][$value] = trim($single_key[$i]); + } + $i++; + } + } + + // Prepare Aliases + if (strlen($data['aliases'])) + { + $data['aliases'] = strtolower($data['aliases']); + $data['aliases'] = strtr($data['aliases'], "\r\n", "\n"); + $data['aliases'] = array_filter(explode("\n", $data['aliases'])); + + foreach($data['aliases'] as &$alias) + { + $alias = trim($alias, '/ '); + if (substr($alias, 0, 7) == 'http://') { + $alias = substr($alias, 7); + } + if (substr($alias, 0, 8) == 'https://') { + $alias = substr($alias, 8); + } + if (substr($alias, 0, 4) == 'www.') { + $alias = substr($alias, 4); + } + // Still smbd will try to enter this here! + if ($alias == $data['domain']) { + $alias = ''; + } + // Alias can't be current domain + if (MightysitesHelper::getSite($alias)) { + $app->enqueueMessage(JText::sprintf('COM_MIGHTYSITES_ERROR_ALIAS_EXISTS_SITE', $alias), 'error'); + $alias = ''; + } + // Check aliases of other sites - no duplicates! + foreach(MightysitesHelper::getSites() as $site2) + { + if ($site2->aliases) + { + $aliases2 = explode("\n", $site2->aliases); + + if (in_array($alias, $aliases2) && $site2->id != $data['id']) + { + $app->enqueueMessage(JText::sprintf('COM_MIGHTYSITES_ERROR_ALIAS_EXISTS', $alias, $site2->domain), 'error'); + $alias = ''; + } + } + } + } + + $data['aliases'] = implode("\n", array_filter($data['aliases'])); + } + + // get all fields + $jform = $app->input->get('jform', array(), 'array'); + + // add tables + if (isset($jform['tables']) && is_array($jform['tables'])) + { + foreach($jform['tables'] as $i => $value) { + if ($value) { + $data['params']['table_'.$i] = $value; + } + } + } + + // add content + if (isset($jform['content']) && is_array($jform['content'])) { + foreach($jform['content'] as $i => $value) { + if ($value) { + $data['params'][$i] = $value; + } + } + } + + // New site? + $isNew = empty($data['id']); + + if ($isNew) + { + // Load source site. + $source_site = $data['source_config']; + $source_site = MightysitesHelper::getSite($source_site); + + // New site will get source params + $data['params'] = $source_site->params->toArray(); + + // But not this, otherwise for sure nobody will login. + unset($data['params']['cookie_domain']); + } + + // Load current row + $id = $this->getState($this->getName() . '.id'); + + $before = $this->getTable(); + $before->load($id); + $before->params = new JRegistry($before->params); + + // Update database + $result = parent::save($data); + if ($result !== true) { + return $result; + } + + // Load new row + $id = $this->getState($this->getName() . '.id'); + + $row = $this->getTable(); + $row->load($id); + $row->params = new JRegistry($row->params); + + + $params = isset($data['params']) ? $data['params'] : array(); + + if ($isNew) + { + // Create config + $config = $this->loadConfig($source_site->domain); + + // New secret key + jimport('joomla.user.helper'); + $config->secret = JUserHelper::genRandomPassword(16); + // new $live_site, just empty + $config->live_site = ''; + // none session handler, database doesn't work sometimes + $config->session_handler = 'none'; + // empty cookie domain + $config->cookie_domain = ''; + } + else + { + // Domain changed? + if ($before->domain != $row->domain) { + $this->copyConfig($before->domain, $row->domain); + } + + // Load current config + $config = $this->loadConfig($row->domain); + } + + // New system settings. + $config->db = $data['db']; + $config->user = $data['user']; + $config->dbprefix = $data['dbprefix']; + $config->password = $data['password']; + $config->dbtype = $data['dbtype']; + + if (isset($params['secret']) && $params['secret']) { + $config->secret = $params['secret']; + } + if (isset($params['cookie_domain']) && $params['cookie_domain']) { + $config->cookie_domain = $params['cookie_domain']; + } + + // Create replacements + MightysitesHelper::attachConfig($row, $config); + + // Next part is only active for existing site, so new site with config cloned from source config has data of source site. + if (!$isNew) + { + $replacements = $this->createTablesReplacements($row); + + // Check dummies + if (isset($replacements[0]) && is_array($replacements[0]) && sizeof($replacements[0]) > 20) { + $app->enqueueMessage(JText::_('СOM_MIGHTYSITES_ERROR_TOO_MUCH_SHARINGS'), 'notice'); + } + + // Inject our settings + // Params can be absent for new site! + $config->mighty = $replacements; + $config->mighty_enable = isset($params['enable_replacements']) ? $params['enable_replacements'] : ''; + $config->mighty_language = isset($params['language']) ? $params['language'] : ''; + $config->mighty_template = isset($params['template']) ? $params['template'] : ''; + $config->mighty_home = isset($params['home']) ? $params['home'] : ''; + $config->mighty_langoverride = isset($params['langoverride']) ? $params['langoverride'] : ''; + $config->cache_path = isset($params['cache_path']) ? $params['cache_path'] : ''; + $config->mighty_slogin = isset($params['single_login']) ? $params['single_login'] : ''; + $config->mighty_slogout = isset($params['single_logout']) ? $params['single_logout'] : ''; + $config->mighty_sdomains = isset($params['single_domains']) ? $params['single_domains'] : ''; + $config->mighty_css = isset($params['custom_css']) ? ( $params['custom_css'] ? explode("\n", str_replace("\r\n", "\n", $params['custom_css'])) : array() ) : array(); + $config->mighty_js = isset($params['custom_js']) ? $params['custom_js'] : ''; + $config->mighty_hidemenus = isset($params['hidemenus']) ? array_filter($params['hidemenus']) : ''; + $config->mighty_hidemodules = isset($params['hidemodules']) ? array_filter($params['hidemodules']) : ''; + $config->mighty_favicon = isset($params['favicon']) ? $params['favicon'] : ''; + $config->mighty_mijoshopid = isset($params['mijoshopid']) ? $params['mijoshopid'] : ''; + $config->mighty_file_path = isset($params['file_path']) ? $params['file_path'] : ''; + $config->mighty_image_path = isset($params['file_path']) ? $params['image_path'] : ''; + $config->mighty_new_usertype = isset($params['new_usertype']) ? $params['new_usertype'] : ''; + } + + // Save config + $this->saveConfig($data['domain'], $config, $isNew); + + // Copy tables + if ($isNew) + { + if ($data['source_db']) + { + $session = JFactory::getSession(); + $session->set('mighty_copy', 'index.php?option=com_mightysites&task=database.copy&from='.$data['source_db'].'&to='.$row->id.'&tmpl=component'); + } + } + + // Domain changed? Remove old config. + if (!$isNew && $before->domain != $row->domain) + { + $this->removeConfig($before->domain); + } + + // Update aliases + if ($before->aliases != $row->aliases || $before->domain != $row->domain) + { + $before->aliases = explode("\n", $before->aliases); + $row->aliases = explode("\n", $row->aliases); + + $old_aliases = array_diff($before->aliases, $row->aliases); + $new_aliases = array_diff($row->aliases, $before->aliases); + + // Domain was changed - change all! + if ($before->domain != $row->domain) { + $new_aliases = $row->aliases; + } + + if ($old_aliases) { + foreach($old_aliases as $old_alias) { + $this->removeAlias($old_alias); + } + } + + if ($new_aliases) { + foreach($new_aliases as $new_alias) { + $this->createAlias($row->domain, $new_alias); + } + } + } + + // Auto-check if configuration.php is patched + auto-update default.php config + MightysitesHelper::patchConfiguration(); + + return true; + } + + protected function loadConfig($domain) + { + $app = JFactory::getApplication(); + + $fname = MightysitesHelper::getConfigFilename($domain); + if (!file_exists($fname)) { + $app->redirect('index.php?option=com_mightysites', JText::sprintf('COM_MIGHTYSITES_ERROR_NEW_CONFIG_DOESNT_EXIST', $fname), 'error'); + } + if (!is_readable($fname)) { + $app->redirect('index.php?option=com_mightysites', JText::sprintf('COM_MIGHTYSITES_ERROR_NEW_CONFIG_NOT_READABLE', $fname), 'error'); + } + if (!is_writable(JPATH_CONFIGURATION)) { + // not used, can be writable by FTP! + //$app->redirect('index.php?option=com_mightysites', JText::sprintf('COM_MIGHTYSITES_ERROR_NEW_CONFIG_NOT_WRITABLE', fname), 'error'); + } + + $config = JFile::read($fname); + + $classname = 'JConfig'.uniqid(); + + if (!class_exists($classname)) { + $config = strtr($config, array( + ' '', + 'class JConfig' => 'class '.$classname, + )); + eval($config); + } + + if (class_exists($classname)) { + $config = new $classname; + } + + return $config; + } + + protected function saveConfig($domain, $config, $isNew = false) + { + $app = JFactory::getApplication(); + + $file = MightysitesHelper::getConfigFilename($domain); + + // Get the FTP credentials. + $ftp = JClientHelper::getCredentials('ftp', true); + + // Attempt to make the file writeable if using FTP. + if (file_exists($file)) { + if (!$ftp['enabled'] && JPath::isOwner($file) && !JPath::setPermissions($file, '0644')) { + $app->redirect('index.php?option=com_mightysites', JText::sprintf('COM_MIGHTYSITES_ERROR_CONFIG_NOT_WRITABLE', $file), 'error'); + } + } + + $registry = new JRegistry($config); + + // Don't use JConfig to not trigger our plugin. + $configuration = $registry->toString('PHP', array('class' => 'JConfigggg', 'closingtag' => false)); + $configuration = strtr($configuration, array( + 'JConfigggg' => 'JConfig', + )); + + if (!JFile::write($file, $configuration)) { + $app->redirect('index.php?option=com_mightysites', JText::sprintf('COM_MIGHTYSITES_ERROR_CONFIG_WRITE_FAILED', $file), 'error'); + } + + // Try to make configuration.php unwriteable + if (!$ftp['enabled'] && JPath::isOwner($file) && !JPath::setPermissions($file, '0444')) { + $app->redirect('index.php?option=com_mightysites', JText::sprintf('COM_MIGHTYSITES_ERROR_CONFIG_NOT_UNWRITABLE', $file), 'error'); + } + } + + protected function copyConfig($domain_from, $domain_to) + { + $app = JFactory::getApplication(); + + $file_from = MightysitesHelper::getConfigFilename($domain_from); + $file_to = MightysitesHelper::getConfigFilename($domain_to); + + if (!JFile::copy($file_from, $file_to)) { + $app->redirect('index.php?option=com_mightysites', JText::sprintf('COM_MIGHTYSITES_ERROR_CONFIG_WRITE_FAILED', $file_to), 'error'); + } + } + + protected function removeConfig($domain) + { + $file = MightysitesHelper::getConfigFilename($domain); + + return JFile::delete($file); + } + + protected function removeAlias($alias) + { + if (empty($alias)) { + return; + } + + $filename = MightysitesHelper::getConfigFilename($alias); + + if (file_exists($filename)) { + JFile::delete($filename); + } + } + + protected function createAlias($domain, $alias) + { + if (empty($alias)) { + return; + } + + $filename = MightysitesHelper::getConfigFilename($alias); + + if (file_exists($filename)) { + JFile::delete($filename); + } + + $str = 'enqueueMessage(JText::sprintf('COM_MIGHTYSITES_ERROR_ALIAS_WRITE_FAILED', $filename, $alias)); + } + } + + protected function createTablesReplacements(&$site, $tables = array()) + { + $params = $site->params; + + $data = array(); + $tables = array(); + + // Core extensions + if ($params->get('extensions')) { + $tables['extensions'] = $params->get('extensions'); + //$tables['schemas'] = $params->get('extensions'); // not share, otherwise Joomla version is lost in slave sites + $tables['updates'] = $params->get('extensions'); + $tables['update_categories'] = $params->get('extensions'); + $tables['update_sites'] = $params->get('extensions'); + $tables['update_sites_extensions'] = $params->get('extensions'); + + // load backend menu components also, for backend only. + $data['/SELECT m.id, m.title, m.alias, m.link, m.parent_id, m.img, e.element\r?\nFROM #__menu AS m/'] = + 'SELECT m.id, m.title, m.alias, m.link, m.parent_id, m.img, e.element FROM '.$this->_createTableReplacements($site, 'menu', $params->get('extensions')).' AS m'; + } + if ($params->get('permissions')) { + $tables['assets'] = $params->get('permissions'); + } + if ($params->get('users')) { + $tables['usergroups'] = $params->get('users'); + $tables['users'] = $params->get('users'); + $tables['user_notes'] = $params->get('users'); + $tables['user_profiles'] = $params->get('users'); + $tables['user_usergroup_map'] = $params->get('users'); + $tables['user_keys'] = $params->get('users'); + $tables['viewlevels'] = $params->get('users'); + } + if ($params->get('sessions')) { + $tables['session'] = $params->get('sessions'); + } + if ($params->get('templates')) { + $tables['template_styles'] = $params->get('templates'); + } + if ($params->get('categories')) { + $tables['categories'] = $params->get('categories'); + } + if ($params->get('content')) { + $tables['content'] = $params->get('content'); + $tables['content_frontpage'] = $params->get('content'); + $tables['content_rating'] = $params->get('content'); + $tables['content_types'] = $params->get('content'); + $tables['ucm_base'] = $params->get('content'); + $tables['ucm_content'] = $params->get('content'); + $tables['ucm_history'] = $params->get('content'); + } + if ($params->get('languages')) { + $tables['languages'] = $params->get('languages'); + $tables['overrider'] = $params->get('languages'); + } + if ($params->get('menus')) { + $tables['menu'] = $params->get('menus'); + $tables['menu_types'] = $params->get('menus'); + $tables['associations'] = $params->get('menus'); + } + if ($params->get('modules')) { + $tables['modules'] = $params->get('modules'); + $tables['modules_menu'] = $params->get('modules'); + } + if ($params->get('newsfeeds')) { + $tables['newsfeeds'] = $params->get('newsfeeds'); + } + if ($params->get('weblinks')) { + $tables['weblinks'] = $params->get('weblinks'); + } + if ($params->get('banners')) { + $tables['banners'] = $params->get('banners'); + $tables['banner_clients'] = $params->get('banners'); + $tables['banner_tracks'] = $params->get('banners'); + } + if ($params->get('contacts')) { + $tables['contact_details'] = $params->get('contacts'); + } + if ($params->get('messages')) { + $tables['messages'] = $params->get('messages'); + $tables['messages_cfg'] = $params->get('messages'); + } + if ($params->get('tags')) { + $tables['tags'] = $params->get('tags'); + } + if ($params->get('tags_refs')) { + $tables['contentitem_tag_map'] = $params->get('tags_refs'); + } + if ($params->get('redirect')) { + $tables['redirect_links'] = $params->get('redirect'); + } + + // 3rd-party extensions + if ($params->get('smartsearch')) { + $data['/`?#__finder_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'finder_', $params->get('smartsearch'), '') . '$1`'; + } + if ($params->get('js')) { + $data['/`?#__community_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'community_', $params->get('js'), '') . '$1`'; + } + if ($params->get('js_no_config')) { + $data['/(`?)(\#__community)((?!_config)[^0-9a-z_]*)/u'] = '$1' . str_replace('`.`', '$1.$1', $this->_createTableReplacements($site, 'community', $params->get('js_no_config'), '')) . '$4'; + } + if ($params->get('cb')) { + $data['/`?#__comprofiler([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'comprofiler', $params->get('cb'), '') . '$1`'; + } + if ($params->get('mtree')) { + $data['/`?#__mt_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'mt_', $params->get('mtree'), '') . '$1`'; + } + if ($params->get('sobi2')) { + $data['/`?#__sobi2_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'sobi2_', $params->get('sobi2'), '') . '$1`'; + } + if ($params->get('sobipro')) { + $data['/`?#__sobipro_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'sobipro_', $params->get('sobipro'), '') . '$1`'; + } + if ($params->get('gridiron')) { + $data['/`?#__gridiron_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'gridiron_', $params->get('gridiron'), '') . '$1`'; + } + if ($params->get('uddeim')) { + $data['/`?#__uddeim([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'uddeim', $params->get('uddeim'), '') . '$1`'; + } + if ($params->get('zoo')) { + $data['/`?#__zoo_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'zoo_', $params->get('zoo'), '') . '$1`'; + } + if ($params->get('dtregister')) { + $data['/`?#__dtregister([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'dtregister', $params->get('dtregister'), '') . '$1`'; + } + if ($params->get('easyblog')) { + $data['/`?#__easyblog_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'easyblog_', $params->get('easyblog'), '') . '$1`'; + } + if ($params->get('joomsport')) { + $data['/`?#__bl_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'bl_', $params->get('joomsport'), '') . '$1`'; + } + if ($params->get('rsform')) { + $data['/`?#__rsform_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'rsform_', $params->get('rsform'), '') . '$1`'; + } + if ($params->get('rsfiles')) { + $data['/`?#__rsfiles_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'rsfiles_', $params->get('rsfiles'), '') . '$1`'; + } + if ($params->get('acymailing')) { + $data['/`?#__acymailing_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'acymailing_', $params->get('acymailing'), '') . '$1`'; + } + if ($params->get('jce')) { + $tables['wf_profiles'] = $params->get('jce'); + } + if ($params->get('adsmanager')) { + $data['/`?#__adsmanager_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'adsmanager_', $params->get('adsmanager'), '') . '$1`'; + } + if ($params->get('joomshopping')) { + $data['/`?#__jshopping_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'jshopping_', $params->get('joomshopping'), '') . '$1`'; + } + if ($params->get('kunena')) { + $data['/`?#__kunena_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'kunena_', $params->get('kunena'), '') . '$1`'; + } + if ($params->get('k2')) { + $data['/`?#__k2_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'k2_', $params->get('k2'), '') . '$1`'; + } + if ($params->get('pf')) { + $data['/`?#__pf_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'pf_', $params->get('pf'), '') . '$1`'; + } + if ($params->get('jcp')) { + $data['/`?#__jcp_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'jcp_', $params->get('jcp'), '') . '$1`'; + } + if ($params->get('enmasse')) { + $data['/`?#__enmasse_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'enmasse_', $params->get('enmasse'), '') . '$1`'; + } + if ($params->get('phocadownload')) { + $data['/`?#__phocadownload([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'phocadownload', $params->get('phocadownload'), '') . '$1`'; + } + if ($params->get('phocagallery')) { + $data['/`?#__phocagallery([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'phocagallery', $params->get('phocagallery'), '') . '$1`'; + } + if ($params->get('jreviews')) { + $data['/`?#__jreviews_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'jreviews_', $params->get('jreviews'), '') . '$1`'; + } + // A bit more complex for VM, it uses queries like + // WHERE #__virtuemart_products_en_gb.`virtuemart_product_id` + // FROM `#__virtuemart_products_en_gb` `p` + if ($params->get('virtuemart')) { + $data['/(`?)(\#__virtuemart)([^0-9a-z_]*)/u'] = '$1' . str_replace('`.`', '$1.$1', $this->_createTableReplacements($site, 'virtuemart', $params->get('virtuemart'), '')) . '$3'; + } + if ($params->get('virtuemart_no_config')) { + $data['/(`?)(\#__virtuemart)((?!_configs)[^0-9a-z_]*)/u'] = '$1' . str_replace('`.`', '$1.$1', $this->_createTableReplacements($site, 'virtuemart', $params->get('virtuemart_no_config'), '')) . '$4'; + } + if ($params->get('jevents')) { + $data['/`?#__jevents_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'jevents_', $params->get('jevents'), '') . '$1`'; + } + if ($params->get('hwdms')) { + $data['/`?#__hwdms_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'hwdms_', $params->get('hwdms'), '') . '$1`'; + } + if ($params->get('admintools')) { + $data['/`?#__admintools_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'admintools_', $params->get('admintools'), '') . '$1`'; + } + if ($params->get('ak')) { + $data['/`?#__ak_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'ak_', $params->get('ak'), '') . '$1`'; + } + if ($params->get('akeebasubs')) { + $data['/`?#__akeebasubs_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'akeebasubs_', $params->get('akeebasubs'), '') . '$1`'; + } + if ($params->get('feedgator')) { + $data['/`?#__feedgator([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'feedgator', $params->get('feedgator'), '') . '$1`'; + } + if ($params->get('jxtc_ezimg')) { + $tables['jxtc_ezimg_images'] = $params->get('jxtc_ezimg'); + } + if ($params->get('invitex')) { + $tables['techjoomlaAPI_users'] = $params->get('invitex'); + $data['/`?#__invitex_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'invitex_', $params->get('invitex'), '') . '$1`'; + } + if ($params->get('jbolo')) { + $data['/`?#__jbolo([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'jbolo', $params->get('jbolo'), '') . '$1`'; + } + if ($params->get('jxtc_appbook')) { + $data['/`?#__jxtc_appbook_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'jxtc_appbook_', $params->get('jxtc_appbook'), '') . '$1`'; + } + if ($params->get('jxtc_albumplayer')) { + $data['/`?#__jxtc_albumplayer([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'jxtc_albumplayer', $params->get('jxtc_albumplayer'), '') . '$1`'; + } + if ($params->get('geo')) { + $data['/`?#__geo_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'geo_', $params->get('geo'), '') . '$1`'; + } + if ($params->get('jxtc_powertabs')) { + $data['/`?#__jxtc_powertabs([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'jxtc_powertabs', $params->get('jxtc_powertabs'), '') . '$1`'; + } + if ($params->get('payplans')) { + $data['/`?#__payplans_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'payplans_', $params->get('payplans'), '') . '$1`'; + } + if ($params->get('jxtc_readinglist')) { + $tables['jxtc_readinglist'] = $params->get('jxtc_readinglist'); + } + if ($params->get('ad')) { + $data['/`?#__ad_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'ad_', $params->get('ad'), '') . '$1`'; + } + if ($params->get('locator')) { + $data['/`?#__location_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'location_', $params->get('locator'), '') . '$1`'; + $tables['locations'] = $params->get('locator'); + } + if ($params->get('pin')) { + $data['/`?#__pin_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'pin_', $params->get('pin'), '') . '$1`'; + } + if ($params->get('hikashop')) { + $data['/`?#__hikashop_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'hikashop_', $params->get('hikashop'), '') . '$1`'; + } + if ($params->get('docman')) { + $data['/`?#__docman([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'docman', $params->get('docman'), '') . '$1`'; + } + if ($params->get('swmenu')) { + $data['/`?#__swmenu_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'swmenu_', $params->get('swmenu'), '') . '$1`'; + } + if ($params->get('virtueuploads')) { + $data['/`?#__virtueuploads([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'virtueuploads', $params->get('virtueuploads'), '') . '$1`'; + } + if ($params->get('djcf')) { + $data['/`?#__djcf_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'djcf_', $params->get('djcf'), '') . '$1`'; + } + if ($params->get('chronoforms')) { + $tables['chronoforms'] = $params->get('chronoforms'); + $tables['chronoform_actions'] = $params->get('chronoforms'); + } + if ($params->get('eventlist')) { + $data['/`?#__eventlist_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'eventlist_', $params->get('eventlist'), '') . '$1`'; + } + if ($params->get('fpss')) { + $data['/`?#__fpss_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'fpss_', $params->get('fpss'), '') . '$1`'; + } + if ($params->get('imageshow')) { + $data['/`?#__imageshow_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'imageshow_', $params->get('imageshow'), '') . '$1`'; + $tables['jsn_imageshow_messages'] = $params->get('imageshow'); + $tables['jsn_imageshow_config'] = $params->get('imageshow'); + } + if ($params->get('uniform')) { + $data['/`?#__jsn_uniform_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'jsn_uniform_', $params->get('uniform'), '') . '$1`'; + } + if ($params->get('widgetkit')) { + $tables['widgetkit_widget'] = $params->get('widgetkit'); + } + if ($params->get('listbingo')) { + $data['/`?#__listbingo_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'listbingo_', $params->get('listbingo'), '') . '$1`'; + } + if ($params->get('redshop')) { + $data['/`?#__redshop_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'redshop_', $params->get('redshop'), '') . '$1`'; + } + if ($params->get('jvle')) { + $data['/`?#__jvle_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'jvle_', $params->get('listbingo'), '') . '$1`'; + } + if ($params->get('bfstop')) { + $tables['bfstop_failedlogin'] = $params->get('bfstop'); + $tables['bfstop_bannedip'] = $params->get('bfstop'); + } + if ($params->get('komento')) { + $data['/`?#__komento_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'komento_', $params->get('komento'), '') . '$1`'; + } + if ($params->get('jsn_poweradmin')) { + $tables['jsn_poweradmin_history'] = $params->get('jsn_poweradmin'); + $tables['jsn_poweradmin_config'] = $params->get('jsn_poweradmin'); + $tables['jsn_poweradmin_menu_assets'] = $params->get('jsn_poweradmin'); + } + if ($params->get('securitycheck')) { + $data['/`?#__securitycheck([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'securitycheck', $params->get('securitycheck'), '') . '$1`'; + } + if ($params->get('expautos')) { + $data['/`?#__expautos_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'expautos_', $params->get('expautos'), '') . '$1`'; + } + if ($params->get('mijosearch')) { + $data['/`?#__mijosearch_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'mijosearch_', $params->get('mijosearch'), '') . '$1`'; + } + if ($params->get('advancedmodules')) { + $tables['advancedmodules'] = $params->get('advancedmodules'); + } + if ($params->get('jck')) { + $tables['jckplugins'] = $params->get('jck'); + $tables['jcktoolbars'] = $params->get('jck'); + $tables['jcktoolbarplugins'] = $params->get('jck'); + $tables['update_jckplugins'] = $params->get('jck'); + } + if ($params->get('rereplacer')) { + $tables['rereplacer'] = $params->get('rereplacer'); + } + if ($params->get('magebridge')) { + $data['/`?#__magebridge_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'magebridge_', $params->get('magebridge'), '') . '$1`'; + } + if ($params->get('preachit')) { + $tables['pibooks'] = $params->get('preachit'); + $tables['picomments'] = $params->get('preachit'); + $tables['pifilepath'] = $params->get('preachit'); + $tables['pimime'] = $params->get('preachit'); + $tables['pipodcast'] = $params->get('preachit'); + $tables['piseries'] = $params->get('preachit'); + $tables['piministry'] = $params->get('preachit'); + $tables['piteachers'] = $params->get('preachit'); + $tables['pistudies'] = $params->get('preachit'); + $tables['pimediaplayers'] = $params->get('preachit'); + $tables['pibckadmin'] = $params->get('preachit'); + $tables['pitemplates'] = $params->get('preachit'); + $tables['pipodmes'] = $params->get('preachit'); + $tables['piadminpodmes'] = $params->get('preachit'); + $tables['pibiblevers'] = $params->get('preachit'); + } + if ($params->get('osmembership')) { + $data['/`?#__osmembership_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'osmembership_', $params->get('osmembership'), '') . '$1`'; + } + if ($params->get('mijosef')) { + $data['/`?#__mijosef_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'mijosef_', $params->get('mijosef'), '') . '$1`'; + } + if ($params->get('osemsc')) { + $data['/`?#__osemsc_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'osemsc_', $params->get('osemsc'), '') . '$1`'; + $tables['ose_activation'] = $params->get('osemsc'); + } + if ($params->get('easydiscuss')) { + $data['/`?#__discuss_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'discuss_', $params->get('easydiscuss'), '') . '$1`'; + } + if ($params->get('hsusers')) { + $tables['users_authentications'] = $params->get('hsusers'); + $tables['users_extended'] = $params->get('hsusers'); + } + if ($params->get('quiz')) { + $data['/`?#__quiz_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'quiz_', $params->get('quiz'), '') . '$1`'; + } + if ($params->get('muscol')) { + $data['/`?#__muscol_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'muscol_', $params->get('muscol'), '') . '$1`'; + } + if ($params->get('allvideoshare')) { + $data['/`?#__allvideoshare_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'allvideoshare_',$params->get('allvideoshare'), '') . '$1`'; + } + if ($params->get('fua')) { + $data['/`?#__fua_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'fua_', $params->get('fua'), '') . '$1`'; + } + if ($params->get('joaktree')) { + $data['/`?#__joaktree_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'joaktree_', $params->get('joaktree'), '') . '$1`'; + } + if ($params->get('rsticketspro')) { + $data['/`?#__rsticketspro_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'rsticketspro_', $params->get('rsticketspro'), '') . '$1`'; + } + if ($params->get('acesef')) { + $data['/`?#__acesef_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'acesef_', $params->get('acesef'), '') . '$1`'; + } + if ($params->get('aup')) { + $data['/`?#__alpha_userpoints([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'alpha_userpoints', $params->get('aup'), '') . '$1`'; + } + if ($params->get('vq')) { + $data['/`?#__vq_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'vq_', $params->get('vq'), '') . '$1`'; + } + if ($params->get('fsf_faq')) { + $data['/`?#__fsf_faq_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'fsf_faq_', $params->get('fsf_faq'), '') . '$1`'; + } + if ($params->get('spidercalendar')) { + $data['/`?#__spidercalendar_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'spidercalendar_', $params->get('spidercalendar'), '') . '$1`'; + } + if ($params->get('jcomments')) { + $data['/`?#__jcomments([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'jcomments', $params->get('jcomments'), '') . '$1`'; + } + if ($params->get('mem')) { + $data['/`?#__mem_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'mem_', $params->get('mem'), '') . '$1`'; + } + if ($params->get('paidsystem')) { + $data['/`?#__paidsystem_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'paidsystem_', $params->get('paidsystem'), '') . '$1`'; + } + if ($params->get('hikamarket')) { + $data['/`?#__hikamarket_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'hikamarket_', $params->get('hikamarket'), '') . '$1`'; + } + if ($params->get('rsmembership')) { + $data['/`?#__rsmembership_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'rsmembership_', $params->get('rsmembership'), '') . '$1`'; + } + if ($params->get('jfbconnect')) { + $data['/`?#__jfbconnect_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'jfbconnect_', $params->get('jfbconnect'), '') . '$1`'; + $data['/`?#__opengraph_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'opengraph_', $params->get('jfbconnect'), '') . '$1`'; + } + if ($params->get('adagency')) { + $data['/`?#__ad_agency_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'ad_agency_', $params->get('adagency'), '') . '$1`'; + } + if ($params->get('fw_realestate')) { + $data['/`?#__fw_realestate_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'fw_realestate_',$params->get('fw_realestate'), '') . '$1`'; + } + if ($params->get('iproperty')) { + $data['/`?#__iproperty([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'iproperty', $params->get('iproperty'), '') . '$1`'; + } + if ($params->get('mijoshop')) { + $data['/`?#__mijoshop_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'mijoshop_', $params->get('mijoshop'), '') . '$1`'; + } + if ($params->get('snippets')) { + $tables['snippets'] = $params->get('snippets'); + } + if ($params->get('zhgooglemap')) { + $data['/`?#__zhgooglemap_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'zhgooglemap_', $params->get('zhgooglemap'), '') . '$1`'; + } + if ($params->get('cddir')) { + $data['/`?#__cddir_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'cddir_', $params->get('cddir'), '') . '$1`'; + } + if ($params->get('ajaxregister')) { + $data['/`?#__ajaxregister_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'ajaxregister_', $params->get('ajaxregister'), '') . '$1`'; + } + if ($params->get('jmap')) { + $data['/`?#__jmap([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'jmap', $params->get('jmap'), '') . '$1`'; + } + if ($params->get('emerald')) { + $data['/`?#__emerald_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'emerald_', $params->get('emerald'), '') . '$1`'; + } + if ($params->get('rseventspro')) { + $data['/`?#__rseventspro_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'rseventspro_', $params->get('rseventspro'), '') . '$1`'; + } + if ($params->get('jblance')) { + $data['/`?#__jblance_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'jblance_', $params->get('jblance'), '') . '$1`'; + } + if ($params->get('xmap')) { + $tables['xmap_items'] = $params->get('xmap'); + $tables['xmap_sitemap'] = $params->get('xmap'); + } + if ($params->get('j2store')) { + $data['/`?#__j2store_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'j2store_', $params->get('j2store'), '') . '$1`'; + } + if ($params->get('lovefactory')) { + $data['/`?#__lovefactory_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'lovefactory_', $params->get('lovefactory'), '') . '$1`'; + } + if ($params->get('social')) { + $data['/`?#__social_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'social_', $params->get('social'), '') . '$1`'; + } + if ($params->get('auctionfactory')) { + $data['/`?#__bid_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'bid_', $params->get('auctionfactory'), '') . '$1`'; + $tables['bids'] = $params->get('auctionfactory'); + } + if ($params->get('hdwplayer')) { + $data['/`?#__hdwplayer_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'hdwplayer_', $params->get('hdwplayer'), '') . '$1`'; + } + if ($params->get('jomcl')) { + $data['/`?#__jomcl_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'jomcl_', $params->get('jomcl'), '') . '$1`'; + } + if ($params->get('regreminder')) { + $data['/`?#__regreminder([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'regreminder', $params->get('regreminder'), '') . '$1`'; + } + if ($params->get('flexicontact')) { + $tables['flexicontact_log'] = $params->get('flexicontact'); + } + if ($params->get('comment')) { + $data['/`?#__comment([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'comment', $params->get('comment'), '') . '$1`'; + } + if ($params->get('xtdir')) { + $data['/`?#__xtdir_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'xtdir_', $params->get('xtdir'), '') . '$1`'; + } + if ($params->get('offlajn')) { + $data['/`?#__offlajn_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'offlajn_', $params->get('offlajn'), '') . '$1`'; + } + if ($params->get('jobsfactory')) { + $data['/`?#__jobsfactory_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'jobsfactory_', $params->get('jobsfactory'), '') . '$1`'; + } + if ($params->get('vmvendor')) { + $tables['vmvendor_vendorratings'] = $params->get('vmvendor'); + } + if ($params->get('eshop')) { + $data['/`?#__eshop_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'eshop_', $params->get('eshop'), '') . '$1`'; + } + if ($params->get('flexicontent')) { + $data['/`?#__flexicontent_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'flexicontent_', $params->get('flexicontent'), '') . '$1`'; + } + if ($params->get('cmgroupbuying')) { + $data['/`?#__cmgroupbuying_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'cmgroupbuying_', $params->get('cmgroupbuying'), '') . '$1`'; + } + if ($params->get('joomgallery')) { + $data['/`?#__joomgallery([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'joomgallery', $params->get('joomgallery'), '') . '$1`'; + } + if ($params->get('joomgalaxy')) { + $data['/`?#__joomgalaxy_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'joomgalaxy_', $params->get('joomgalaxy'), '') . '$1`'; + } + if ($params->get('jdownloads')) { + $data['/`?#__jdownloads_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'jdownloads_', $params->get('jdownloads'), '') . '$1`'; + } + if ($params->get('jsn')) { + $tables['jsn_fields'] = $params->get('jsn'); + $tables['jsn_users'] = $params->get('jsn'); + $data['/`?#__jsnsocial_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'jsnsocial_', $params->get('jsnsocial'), '') . '$1`'; + } + if ($params->get('icagenda')) { + $data['/`?#__icagenda([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'icagenda', $params->get('icagenda'), '') . '$1`'; + } + if ($params->get('booking')) { + $data['/`?#__booking_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'booking_', $params->get('booking'), '') . '$1`'; + } + if ($params->get('cobalt')) { + $data['/`?#__js_res_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'js_res_', $params->get('cobalt'), '') . '$1`'; + } + if ($params->get('vikappointments')) { + $data['/`?#__vikappointments_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'vikappointments_', $params->get('vikappointments'), '') . '$1`'; + } + if ($params->get('joomcareer')) { + $data['/`?#__joomcareer([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'joomcareer', $params->get('joomcareer'), '') . '$1`'; + } + if ($params->get('kart')) { + $data['/`?#__kart_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'kart_', $params->get('kart'), '') . '$1`'; + $tables['order_item_fee'] = $params->get('kart'); + $tables['q2c_order_history'] = $params->get('kart'); + } + if ($params->get('tjfields')) { + $data['/`?#__tjfields_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'tjfields_', $params->get('tjfields'), '') . '$1`'; + $tables['tj_city'] = $params->get('tjfields'); + $tables['tj_country'] = $params->get('tjfields'); + $tables['tj_region'] = $params->get('tjfields'); + } + if ($params->get('guru')) { + $data['/`?#__guru_([0-9a-z_]*)`?/u'] = '`' . $this->_createTableReplacements($site, 'guru_', $params->get('guru'), '') . '$1`'; + } + + + // to be continued... + + // Apply plugins + JFactory::getApplication()->triggerEvent('onMightysitesCreateReplacements', array($params, $site, &$data, &$tables, $this)); + + // Custom tables + foreach($params->toArray() as $table => $from) { + if (substr($table, 0, 6) == 'table_' && $from) { + $tables[substr($table, 6)] = $from; + } + } + + // Tables + if (sizeof($tables)) { + foreach($tables as $table => $from) { + if ($from) { + $data['/`?#__'.$table.'[` \n]+/u'] = $this->_createTableReplacements($site, $table, $from); + } + } + } + + // always load mighty from root + $data['/`?#__mightysites[` \n]+/u'] = $this->_createTableReplacements($site, 'mightysites', 1); + + // remove empty data + if (sizeof($data)) { + foreach($data as $key => $value) { + if (empty($value)) { + unset($data[$key]); + } + } + } + + return sizeof($data) ? array(array_keys($data), array_values($data)) : array(); + } + + public function _createTableReplacements($site, $table, $from, $enclosure = '`') + { + $from = MightysitesHelper::getSite($from, true); + + if ($from) { + $ending = $enclosure ? ' ' : ''; + if ($site->db == $from->db) { + return $enclosure . $from->dbprefix . $table . $enclosure . $ending; + } else { + return $enclosure . $from->db . '`.`' . $from->dbprefix . $table . $enclosure . $ending; + } + } + } +} diff --git a/deployed/mightysites/administrator/components/com_mightysites/models/sites.php b/deployed/mightysites/administrator/components/com_mightysites/models/sites.php new file mode 100644 index 00000000..19fe3bfd --- /dev/null +++ b/deployed/mightysites/administrator/components/com_mightysites/models/sites.php @@ -0,0 +1,121 @@ +getUserStateFromRequest($this->context.'.filter.search', 'filter_search'); + $this->setState('filter.search', $search); + + // Load the parameters. + $params = JComponentHelper::getParams('com_mightysites'); + $this->setState('params', $params); + + // List state information. + parent::populateState('a.id', 'asc'); + } + + protected function getStoreId($id = '') + { + // Compile the store id. + $id .= ':' . $this->getState('filter.search'); + $id .= ':' . $this->getState('filter.state'); + + return parent::getStoreId($id); + } + + protected function getListQuery() + { + // Create a new query object. + $db = $this->getDbo(); + $query = $db->getQuery(true); + $user = JFactory::getUser(); + + // Select the required fields from the table. + $query->select( + $this->getState( + 'list.select', + 'a.*' + ) + ); + $query->from($db->quoteName('#__mightysites').' AS a'); + + // Join over the users for the checked out user. + $query->select('uc.name AS editor'); + $query->join('LEFT', '#__users AS uc ON uc.id=a.checked_out'); + + // Filter by type. + $type = $this->getState('filter.type'); + if ($type) { + $query->where('a.type='.$type); + } + + // Filter by search in title + $search = $this->getState('filter.search'); + if (!empty($search)) { + if (stripos($search, 'id:') === 0) { + $query->where('a.id = '.(int) substr($search, 3)); + } else { + $search = $db->Quote('%'.$db->escape($search, true).'%'); + $query->where('( + a.domain LIKE '.$search.' + OR a.db LIKE '.$search.' + OR a.dbprefix LIKE '.$search.' + )'); + } + } + + // Add the list ordering clause. + $orderCol = $this->state->get('list.ordering'); + $orderDirn = $this->state->get('list.direction'); + $query->order($db->escape($orderCol.' '.$orderDirn)); + + return $query; + } + + public function getItems() + { + $items = parent::getItems(); + + if ($items) { + $app = JFactory::getApplication(); + + foreach($items as &$item) { + // Init params + $item->params = new JRegistry($item->params); + + // Add config + MightysitesHelper::attachConfig($item); + } + } + + return $items; + } + +} diff --git a/deployed/mightysites/administrator/components/com_mightysites/sql/index.html b/deployed/mightysites/administrator/components/com_mightysites/sql/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/deployed/mightysites/administrator/components/com_mightysites/sql/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/deployed/mightysites/administrator/components/com_mightysites/sql/install.mysql.utf8.sql b/deployed/mightysites/administrator/components/com_mightysites/sql/install.mysql.utf8.sql new file mode 100644 index 00000000..b89d6398 --- /dev/null +++ b/deployed/mightysites/administrator/components/com_mightysites/sql/install.mysql.utf8.sql @@ -0,0 +1,13 @@ +CREATE TABLE IF NOT EXISTS `#__mightysites` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `domain` varchar(255) NOT NULL DEFAULT '', + `aliases` text NOT NULL, + `db` varchar(255) NOT NULL DEFAULT '', + `dbprefix` varchar(255) NOT NULL DEFAULT '', + `params` text NOT NULL, + `checked_out` int(10) unsigned NOT NULL DEFAULT '0', + `checked_out_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `type` tinyint(4) unsigned NOT NULL DEFAULT '1', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; + diff --git a/deployed/mightysites/administrator/components/com_mightysites/tables/database.php b/deployed/mightysites/administrator/components/com_mightysites/tables/database.php new file mode 100644 index 00000000..5796be5a --- /dev/null +++ b/deployed/mightysites/administrator/components/com_mightysites/tables/database.php @@ -0,0 +1,51 @@ +loadArray($array['params']); + $array['params'] = (string)$registry; + } + + // Force type! + $array['type'] = 2; + + return parent::bind($array, $ignore); + } + + public function check() + { + $db = JFactory::getDBO(); + + // Check tables prefix. + if (!preg_match('/^[a-z0-9_]*$/', $this->dbprefix)) { + $this->setError(JText::sprintf('COM_MIGHTYSITES_ERROR_INVALID_DBPREFIX', $this->dbprefix)); + return false; + } + + // Check for unique table prefix. + $db->setQuery('SELECT `id` FROM `#__mightysites` WHERE `db`='.$db->quote($this->db).' AND `dbprefix` = '.$db->quote($this->dbprefix), 0, 1); + $id = $db->loadResult(); + if ($id && $id != $this->id) { + $this->setError(JText::sprintf('COM_MIGHTYSITES_ERROR_DATABASE_EXISTS', $this->db, $this->dbprefix)); + return false; + } + + return true; + } +} \ No newline at end of file diff --git a/deployed/mightysites/administrator/components/com_mightysites/tables/index.html b/deployed/mightysites/administrator/components/com_mightysites/tables/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/deployed/mightysites/administrator/components/com_mightysites/tables/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/deployed/mightysites/administrator/components/com_mightysites/tables/site.php b/deployed/mightysites/administrator/components/com_mightysites/tables/site.php new file mode 100644 index 00000000..3a026372 --- /dev/null +++ b/deployed/mightysites/administrator/components/com_mightysites/tables/site.php @@ -0,0 +1,113 @@ +loadArray($array['params']); + $array['params'] = (string)$registry; + } + + // Force type! + $array['type'] = 1; + + return parent::bind($array, $ignore); + } + + public function check() + { + $db = JFactory::getDBO(); + + // Check tables prefix. + if (!preg_match('/^[a-zA-Z0-9_]*$/', $this->dbprefix)) { + $this->setError(JText::sprintf('COM_MIGHTYSITES_ERROR_INVALID_DBPREFIX', $this->dbprefix)); + return false; + } + + // Check for domain. + $db->setQuery('SELECT `id` FROM `#__mightysites` WHERE `domain`='.$db->quote($this->domain), 0, 1); + $id = $db->loadResult(); + if ($id && $id != $this->id) { + $this->setError(JText::sprintf('COM_MIGHTYSITES_ERROR_DOMAIN_EXISTS', $this->domain)); + return false; + } + + // Check for unique table prefix + $db->setQuery('SELECT `id` FROM `#__mightysites` WHERE `dbprefix` LIKE '.$db->quote('%'.str_replace('_', '\_', $this->dbprefix).'%'), 0, 1); + $id = $db->loadResult(); + if ($id && $id != $this->id) { + //$this->setError(JText::sprintf('COM_MIGHTYSITES_ERROR_PREFIX_EXISTS', $this->dbprefix)); + //return false; + JFactory::getApplication()->enqueueMessage(JText::sprintf('COM_MIGHTYSITES_NOTICE_PREFIX_EXISTS', $this->dbprefix), 'notice'); + } + + // Virtual subfolder via symlink + if (strpos($this->domain, '/') !== false) { + $parts = explode('/', $this->domain); + array_shift($parts); + + // Only site.com/test, not site.com/test/test2/, todo - check parent folder + /* + if (sizeof($parts) > 1) { + $this->setError(JText::sprintf('COM_MIGHTYSITES_ERROR_SYMLINK_LEVEL', $this->domain)); + return false; + } + */ + + $path = implode('/', $parts); + $file = JPATH_SITE.'/'.$path; + $symlink = false; + + // New site + if (!$this->id) { + // Already exists? + if (file_exists($file)) { + // Link? + if (is_link($file)) { + JFactory::getApplication()->enqueueMessage(JText::sprintf('COM_MIGHTYSITES_NOTICE_SYMLINK_EXISTS', $file), 'notice'); + } + // File or folder? + else { + $this->setError(JText::sprintf('COM_MIGHTYSITES_ERROR_SYMLINK_EXISTS', $file)); + return false; + } + } + else { + $symlink = true; + } + } + // Current site + else { + // Absent link? Recreate! + if (!file_exists($file)) { + $symlink = true; + } + } + + // Create symlink + if ($symlink) { + $result = @symlink(JPATH_SITE, $file); + if (!$result) { + $this->setError(JText::sprintf('COM_MIGHTYSITES_ERROR_SYMLINK_FAILED', $file, JPATH_SITE)); + return false; + } + } + } + + return true; + } + +} \ No newline at end of file diff --git a/deployed/mightysites/administrator/components/com_mightysites/views/about/index.html b/deployed/mightysites/administrator/components/com_mightysites/views/about/index.html new file mode 100644 index 00000000..2efb97f3 --- /dev/null +++ b/deployed/mightysites/administrator/components/com_mightysites/views/about/index.html @@ -0,0 +1 @@ + diff --git a/deployed/mightysites/administrator/components/com_mightysites/views/about/tmpl/default.php b/deployed/mightysites/administrator/components/com_mightysites/views/about/tmpl/default.php new file mode 100644 index 00000000..92ce7c2c --- /dev/null +++ b/deployed/mightysites/administrator/components/com_mightysites/views/about/tmpl/default.php @@ -0,0 +1,72 @@ +sidebar = JHtmlSidebar::render(); + +$component = JTable::getInstance('extension'); +$component->load(JComponentHelper::getComponent('com_mightysites')->id); +if (strlen($component->manifest_cache)) { + $data = json_decode($component->manifest_cache); + if ($data) { + foreach($data as $key => $value) { + $component->$key = $value; + } + } +} +?> + + + +
+sidebar)): ?> +
+ sidebar; ?> +
+
+ +
+ + + + + + + + + + + + + + +
version;?>
+ + +
+ +
+ diff --git a/deployed/mightysites/administrator/components/com_mightysites/views/about/tmpl/default_25.php b/deployed/mightysites/administrator/components/com_mightysites/views/about/tmpl/default_25.php new file mode 100644 index 00000000..07b467e3 --- /dev/null +++ b/deployed/mightysites/administrator/components/com_mightysites/views/about/tmpl/default_25.php @@ -0,0 +1,59 @@ +load(JComponentHelper::getComponent('com_mightysites')->id); +if (strlen($component->manifest_cache)) { + $data = json_decode($component->manifest_cache); + if ($data) { + foreach($data as $key => $value) { + $component->$key = $value; + } + } +} +?> + + + +
+
+
+ + + + + + + + + + + +
version;?>
+   + +
+
+
+
diff --git a/deployed/mightysites/administrator/components/com_mightysites/views/about/tmpl/index.html b/deployed/mightysites/administrator/components/com_mightysites/views/about/tmpl/index.html new file mode 100644 index 00000000..2efb97f3 --- /dev/null +++ b/deployed/mightysites/administrator/components/com_mightysites/views/about/tmpl/index.html @@ -0,0 +1 @@ + diff --git a/deployed/mightysites/administrator/components/com_mightysites/views/about/view.html.php b/deployed/mightysites/administrator/components/com_mightysites/views/about/view.html.php new file mode 100644 index 00000000..092c0467 --- /dev/null +++ b/deployed/mightysites/administrator/components/com_mightysites/views/about/view.html.php @@ -0,0 +1,35 @@ +addToolbar(); + + $version = new JVersion; + if ($version->RELEASE == '2.5') { + $tpl = '25'; + } + + parent::display($tpl); + } + + protected function addToolbar() + { + // Title + if (version_compare(JVERSION, '3.2', 'ge')) { + JToolBarHelper::title(JText::_('COM_MIGHTYSITES_TITLE_ABOUT'), 'help'); + } else { + JToolBarHelper::title(JText::_('COM_MIGHTYSITES_TITLE_ABOUT'), 'systeminfo.png'); + } + + MightysitesHelper::topmenu(); + } +} diff --git a/deployed/mightysites/administrator/components/com_mightysites/views/database/index.html b/deployed/mightysites/administrator/components/com_mightysites/views/database/index.html new file mode 100644 index 00000000..2efb97f3 --- /dev/null +++ b/deployed/mightysites/administrator/components/com_mightysites/views/database/index.html @@ -0,0 +1 @@ + diff --git a/deployed/mightysites/administrator/components/com_mightysites/views/database/tmpl/edit.php b/deployed/mightysites/administrator/components/com_mightysites/views/database/tmpl/edit.php new file mode 100644 index 00000000..8c3ab322 --- /dev/null +++ b/deployed/mightysites/administrator/components/com_mightysites/views/database/tmpl/edit.php @@ -0,0 +1,144 @@ + + + + +
+
+
+ +
+ + +
+ +
+
+
form->getLabel('domain'); ?>
+
form->getInput('domain'); ?>
+
+ + item->id) {?> +
+
form->getLabel('source_db'); ?>
+
form->getInput('source_db'); ?>
+
+ +
+ +
+
+
form->getLabel('db'); ?>
+
form->getInput('db'); ?> + item->id) {?> + +   + + + + +
+
+
+
form->getLabel('dbprefix'); ?>
+
form->getInput('dbprefix'); ?>
+
+ +
+
+
+ +   + + +
+
+
+ +
+
+ +
+
+ + + + + +
\ No newline at end of file diff --git a/deployed/mightysites/administrator/components/com_mightysites/views/database/tmpl/edit_25.php b/deployed/mightysites/administrator/components/com_mightysites/views/database/tmpl/edit_25.php new file mode 100644 index 00000000..5884ad7f --- /dev/null +++ b/deployed/mightysites/administrator/components/com_mightysites/views/database/tmpl/edit_25.php @@ -0,0 +1,146 @@ +item); + +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHTML::_('behavior.keepalive'); + +$pane = JPane::getInstance('tabs'); +?> + + + +
+startPane("domain-pane"); + + echo $pane->startPanel(JText::_('COM_MIGHTYSITES_TAB_SETTINGS'), 'common-page'); + ?> +
+
+
    +
  • form->getLabel('domain'); ?> + form->getInput('domain'); ?>
  • + + item->id) {?> +
  • form->getLabel('source_db'); ?> + form->getInput('source_db'); ?>
  • + +
+
+
+ endPanel(); + + echo $pane->startPanel(JText::_('COM_MIGHTYSITES_TAB_DATABASE'), 'database-page'); + ?> +
+ +
+ +
+
    +
  • form->getLabel('db'); ?> + form->getInput('db'); ?> + + item->id) {?> + +   + +
    + +
  • + +
  • form->getLabel('dbprefix'); ?> + form->getInput('dbprefix'); ?>
  • + +
  • +   + +
    +
  • +
+
+
+
+ endPanel(); + +echo $pane->endPane(); +?> + + + + + + + +
diff --git a/deployed/mightysites/administrator/components/com_mightysites/views/database/tmpl/index.html b/deployed/mightysites/administrator/components/com_mightysites/views/database/tmpl/index.html new file mode 100644 index 00000000..2efb97f3 --- /dev/null +++ b/deployed/mightysites/administrator/components/com_mightysites/views/database/tmpl/index.html @@ -0,0 +1 @@ + diff --git a/deployed/mightysites/administrator/components/com_mightysites/views/database/view.html.php b/deployed/mightysites/administrator/components/com_mightysites/views/database/view.html.php new file mode 100644 index 00000000..ec828d8f --- /dev/null +++ b/deployed/mightysites/administrator/components/com_mightysites/views/database/view.html.php @@ -0,0 +1,68 @@ +state = $this->get('State'); + $this->item = $this->get('Item'); + $this->form = $this->get('Form'); + + $this->params = new JRegistry($this->item->params); + + // Check for errors. + if (count($errors = $this->get('Errors'))) { + JError::raiseError(500, implode("\n", $errors)); + return false; + } + + $this->addToolbar(); + + $version = new JVersion; + if ($version->RELEASE == '2.5') { + $tpl = '25'; + } + + parent::display($tpl); + } + + protected function addToolbar() + { + JRequest::setVar('hidemainmenu', true); + + $user = JFactory::getUser(); + $userId = $user->get('id'); + $isNew = ($this->item->id == 0); + $checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $user->get('id')); + + if (version_compare(JVERSION, '3.2', 'ge')) { + JToolBarHelper::title(JText::_($isNew ? 'COM_MIGHTYSITES_TITLE_DATABASE_ADD' : 'COM_MIGHTYSITES_TITLE_DATABASE_EDIT'), 'database'); + } else { + JToolBarHelper::title(JText::_($isNew ? 'COM_MIGHTYSITES_TITLE_DATABASE_ADD' : 'COM_MIGHTYSITES_TITLE_DATABASE_EDIT')); + } + + // If not checked out, can save the item. + if (!$checkedOut && $user->authorise('core.edit', 'com_mightysites')) + { + JToolBarHelper::apply('database.apply'); + JToolBarHelper::save('database.save'); + } + if (empty($this->item->id)) { + JToolBarHelper::cancel('database.cancel'); + } + else { + JToolBarHelper::cancel('database.cancel', 'JTOOLBAR_CLOSE'); + } + } + +} diff --git a/deployed/mightysites/administrator/components/com_mightysites/views/databases/index.html b/deployed/mightysites/administrator/components/com_mightysites/views/databases/index.html new file mode 100644 index 00000000..2efb97f3 --- /dev/null +++ b/deployed/mightysites/administrator/components/com_mightysites/views/databases/index.html @@ -0,0 +1 @@ + diff --git a/deployed/mightysites/administrator/components/com_mightysites/views/databases/tmpl/default.php b/deployed/mightysites/administrator/components/com_mightysites/views/databases/tmpl/default.php new file mode 100644 index 00000000..4b8884b1 --- /dev/null +++ b/deployed/mightysites/administrator/components/com_mightysites/views/databases/tmpl/default.php @@ -0,0 +1,165 @@ +escape($this->state->get('list.ordering')); +$listDirn = $this->escape($this->state->get('list.direction')); + +$this->sidebar = JHtmlSidebar::render(); +?> + + + +
+sidebar)): ?> +
+ sidebar; ?> +
+
+ +
+ +
+ +
+ + +
+
+ + pagination->getLimitBox(); ?> +
+
+ + +
+
+ + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + items as $i => $item) { + $canEdit = $user->authorise('core.edit', 'com_mightysites'); + $canCheckin = $user->authorise('core.manage', 'com_checkin') || $item->checked_out==$user->get('id') || $item->checked_out==0; + $canChange = $user->authorise('core.edit.state', 'com_mightysites') && $canCheckin; + + // Sites are edited via own link! + if ($item->type == 1) { + $link = 'index.php?option=com_mightysites&task=site.edit&id='.(int) $item->id; + } else { + $link = 'index.php?option=com_mightysites&task=database.edit&id='.(int) $item->id; + } + + ?> + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ diff --git a/deployed/mightysites/administrator/components/com_mightysites/views/databases/tmpl/default_25.php b/deployed/mightysites/administrator/components/com_mightysites/views/databases/tmpl/default_25.php new file mode 100644 index 00000000..df21be04 --- /dev/null +++ b/deployed/mightysites/administrator/components/com_mightysites/views/databases/tmpl/default_25.php @@ -0,0 +1,131 @@ +escape($this->state->get('list.ordering')); +$listDirn = $this->escape($this->state->get('list.direction')); + +JHtml::_('behavior.tooltip'); +?> + + + +
+ + + + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + +items)) { +foreach ($this->items as $i => $item) { + $canEdit = $user->authorise('core.edit', 'com_mightysites'); + $canCheckin = $user->authorise('core.manage', 'com_checkin') || $item->checked_out==$user->get('id') || $item->checked_out==0; + $canChange = $user->authorise('core.edit.state', 'com_mightysites') && $canCheckin; + + // Sites are edited via own link! + if ($item->type == 1) { + $link = 'index.php?option=com_mightysites&task=site.edit&id='.(int) $item->id; + } else { + $link = 'index.php?option=com_mightysites&task=database.edit&id='.(int) $item->id; + } + + ?> + + + + + + + + + + + + + + + + + + + +
+ pagination->getListFooter();?> +
pagination->getRowOffset($i);?>type == 2) {?> + id);?> + + checked_out) : ?> + editor, $item->checked_out_time, 'databases.', $canCheckin);?> + + + + + domain;?> + + domain;?> + + + type == 1) { + echo JText::_('COM_MIGHTYSITES_DATABASE_ORIGIN_SITE'); + } else { + echo JText::_('COM_MIGHTYSITES_DATABASE_ORIGIN_DATABASE'); + }?> + db;?>dbprefix;?>id;?>
+ + + + + + + + +
diff --git a/deployed/mightysites/administrator/components/com_mightysites/views/databases/tmpl/index.html b/deployed/mightysites/administrator/components/com_mightysites/views/databases/tmpl/index.html new file mode 100644 index 00000000..2efb97f3 --- /dev/null +++ b/deployed/mightysites/administrator/components/com_mightysites/views/databases/tmpl/index.html @@ -0,0 +1 @@ + diff --git a/deployed/mightysites/administrator/components/com_mightysites/views/databases/view.html.php b/deployed/mightysites/administrator/components/com_mightysites/views/databases/view.html.php new file mode 100644 index 00000000..1c8731c7 --- /dev/null +++ b/deployed/mightysites/administrator/components/com_mightysites/views/databases/view.html.php @@ -0,0 +1,78 @@ +state = $this->get('State'); + $this->items = $this->get('Items'); + $this->pagination = $this->get('Pagination'); + + // Check for errors. + if (count($errors = $this->get('Errors'))) { + JError::raiseError(500, implode("\n", $errors)); + return false; + } + + $this->addToolbar(); + + $version = new JVersion; + if ($version->RELEASE == '2.5') { + $tpl = '25'; + } + + parent::display($tpl); + } + + protected function addToolbar() + { + // Load the submenu. + MightysitesHelper::topMenu(); + + // Title + if (version_compare(JVERSION, '3.2', 'ge')) { + JToolBarHelper::title(JText::_('COM_MIGHTYSITES_TITLE_DATABASES'), 'database'); + } else { + JToolBarHelper::title(JText::_('COM_MIGHTYSITES_TITLE_DATABASES')); + } + + $user = JFactory::getUser(); + + // Toolbar + if ($user->authorise('core.create', 'com_mightysites')) { + JToolBarHelper::addNew('database.add'); + } + if ($user->authorise('core.edit', 'com_mightysites')) { + JToolBarHelper::editList('database.edit'); + } + if ($user->authorise('core.edit.state', 'com_mightysites')) { + JToolbarHelper::checkin('databases.checkin'); + } + if ($user->authorise('core.delete', 'com_mightysites')) { + JToolBarHelper::divider(); + JToolBarHelper::deleteList(JText::_('COM_MIGHTYSITES_REALLY_DELETE_DATABASES'), 'databases.remove'); + } + if ($user->authorise('core.admin', 'com_mightysites')) { + JToolBarHelper::divider(); + JToolBarHelper::preferences('com_mightysites', '300'); + } + } + + protected function getSortFields() + { + return array( + 'a.domain' => JText::_('COM_MIGHTYSITES_HEADING_DATABASE_TITLE'), + 'a.type' => JText::_('COM_MIGHTYSITES_HEADING_DATABASE_ORIGIN'), + 'a.db' => JText::_('COM_MIGHTYSITES_HEADING_DATABASE_NAME'), + 'a.dbprefix' => JText::_('COM_MIGHTYSITES_HEADING_DATABASE_PREFIX'), + 'a.id' => JText::_('ID'), + ); + } + +} \ No newline at end of file diff --git a/deployed/mightysites/administrator/components/com_mightysites/views/index.html b/deployed/mightysites/administrator/components/com_mightysites/views/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/deployed/mightysites/administrator/components/com_mightysites/views/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/deployed/mightysites/administrator/components/com_mightysites/views/site/index.html b/deployed/mightysites/administrator/components/com_mightysites/views/site/index.html new file mode 100644 index 00000000..2efb97f3 --- /dev/null +++ b/deployed/mightysites/administrator/components/com_mightysites/views/site/index.html @@ -0,0 +1 @@ + diff --git a/deployed/mightysites/administrator/components/com_mightysites/views/site/tmpl/edit.php b/deployed/mightysites/administrator/components/com_mightysites/views/site/tmpl/edit.php new file mode 100644 index 00000000..9b29359f --- /dev/null +++ b/deployed/mightysites/administrator/components/com_mightysites/views/site/tmpl/edit.php @@ -0,0 +1,374 @@ + + + + +
+ +
+
+ +
+ + +
+ +
+
+
form->getLabel('domain'); ?>
+
form->getInput('domain'); ?>
+
+
+
form->getLabel('aliases'); ?>
+
form->getInput('aliases'); ?>
+
+ + item->id) {?> +
+
form->getLabel('source_config'); ?>
+
form->getInput('source_config'); ?>
+
+
+
form->getLabel('source_db'); ?>
+
form->getInput('source_db'); ?>
+
+ +
+ +
+
+
form->getLabel('db'); ?>
+
form->getInput('db'); ?> + item->id) {?> + +   + + + + +
+
+
+
form->getLabel('dbprefix'); ?>
+
form->getInput('dbprefix'); ?>
+
+
+
form->getLabel('user'); ?>
+
form->getInput('user'); ?>
+
+
+
form->getLabel('password'); ?>
+
form->getInput('password'); ?>
+
+
+
form->getLabel('dbtype'); ?>
+
form->getInput('dbtype'); ?>
+
+ +
+
+
+ +   + + +
+
+
+ +
+ item->id) { + echo JText::_('COM_MIGHTYSITES_APPLY_SETTINGS'); + } else {?> + + form->getFieldset('replacements') as $field) : ?> +
+
label; ?>
+
input; ?>
+
+ + +
+
+ +
+
+
+ item->domain, JText::_('COM_MIGHTYSITES_SELECT_ALL_TO'), false, '-1', JText::_('COM_MIGHTYSITES_OWN_DATA'), '');?> +
+
+
+ + synchs_core as $synch => $input) {?> +
+
+
+
+ +
+ +
+ +
+
+
+ item->domain, JText::_('COM_MIGHTYSITES_SELECT_ALL_TO'), false, '-1', JText::_('COM_MIGHTYSITES_OWN_DATA'), '');?> +
+
+
+ + synchs_custom as $synch => $input) {?> +
+
+
+
+ +
+ +
+ + +
+ +   + + + params->toArray() as $key => $value) { + if (strpos($key, 'table_') !== false) { + echo ''; + $tables++; + } + }?> +

+

+
+
+ +
+ +
+ +
+ item->id) { + echo JText::_('COM_MIGHTYSITES_APPLY_SETTINGS'); + } else {?> + + form->getFieldset('single') as $field) : ?> +
+
label; ?>
+
input; ?>
+
+ + + + + + + + + + + + params->get('single_domain'.(string)$i)) {?> + + + + + + + + + +
+ +

+

+ +
+ +
+ item->id) { + echo JText::_('COM_MIGHTYSITES_APPLY_SETTINGS'); + } else {?> + + form->getFieldset('overrides') as $field) : ?> +
+
label; ?>
+
input; ?>
+
+ + +
+ +
+ item->id) { + echo JText::_('COM_MIGHTYSITES_APPLY_SETTINGS'); + } else {?> + + form->getFieldset('advanced') as $field) : ?> +
+
label; ?>
+
input; ?>
+
+ + +
+
+
+ +
+
+ + + + + +
diff --git a/deployed/mightysites/administrator/components/com_mightysites/views/site/tmpl/edit_25.php b/deployed/mightysites/administrator/components/com_mightysites/views/site/tmpl/edit_25.php new file mode 100644 index 00000000..d369c9ee --- /dev/null +++ b/deployed/mightysites/administrator/components/com_mightysites/views/site/tmpl/edit_25.php @@ -0,0 +1,403 @@ +item); + +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHTML::_('behavior.keepalive'); + +$pane = JPane::getInstance('tabs'); +?> + + + + + +
+startPane("domain-pane"); + + echo $pane->startPanel(JText::_('COM_MIGHTYSITES_TAB_BASIC'), 'common-page'); + ?> +
+
+
    +
  • form->getLabel('domain'); ?> + form->getInput('domain'); ?>
  • +
  • form->getLabel('aliases'); ?> + form->getInput('aliases'); ?>
  • + + item->id) {?> +
  • form->getLabel('source_config'); ?> + form->getInput('source_config'); ?>
  • +
  • form->getLabel('source_db'); ?> + form->getInput('source_db'); ?>
  • + +
+
+
+ endPanel(); + + echo $pane->startPanel(JText::_('COM_MIGHTYSITES_TAB_DATABASE'), 'database-page'); + ?> +
+ +
+ +
+
    +
  • form->getLabel('db'); ?> + form->getInput('db'); ?> + + item->id) {?> + +   + +
    + +
  • + +
  • form->getLabel('dbprefix'); ?> + form->getInput('dbprefix'); ?>
  • + +
  • form->getLabel('user'); ?> + form->getInput('user'); ?>
  • + +
  • form->getLabel('password'); ?> + form->getInput('password'); ?>
  • + +
  • +   + +
    +
  • + +
  • form->getLabel('dbtype'); ?> + form->getInput('dbtype'); ?>
  • +
+
+
+
+ endPanel(); + + echo $pane->startPanel(JText::_('COM_MIGHTYSITES_TAB_CONTENT_SHARING'), 'content-sharing-page'); + + if (!$this->item->id) { + echo JText::_('COM_MIGHTYSITES_APPLY_SETTINGS'); + } else {?> + +
+ +
+
+
    + form->getFieldset('replacements') as $field) : ?> +
  • label; ?> + input; ?>
  • + +
+
+
+ +
+
+ +
    +
  • + item->domain, JText::_('COM_MIGHTYSITES_SELECT_ALL_TO'), false, '-1', JText::_('COM_MIGHTYSITES_OWN_DATA'), '');?> +
  • + synchs_core as $synch => $input) {?> +
  • + +
  • + +
+
+
+ +
+
+ +
    +
  • + item->domain, JText::_('COM_MIGHTYSITES_SELECT_ALL_TO'), false, '-1', JText::_('COM_MIGHTYSITES_OWN_DATA'), '');?> +
  • + synchs_custom as $synch => $input) {?> +
  • + +
  • + +
+
+
+
+ +
+
+ + +
+ +   + + + params->toArray() as $key => $value) { + if (strpos($key, 'table_') !== false) { + echo ''; + $tables++; + } + }?> +

+

+
+ +
+
+ +
+ endPanel(); + } + + echo $pane->startPanel(JText::_('COM_MIGHTYSITES_TAB_SINGLE'), 'single-page'); + + if (!$this->item->id) { + echo JText::_('COM_MIGHTYSITES_APPLY_SETTINGS'); + } else {?> +
+
+
    + form->getFieldset('single') as $field) : ?> +
  • label; ?> + input; ?>
  • + +
+
+ +
+ + + + + + + + + + params->get('single_domain'.(string)$i)) {?> + + + + + + + + + +
+ +

+

+
+ +
+ endPanel(); + } + + if ($this->item->id) { + echo $pane->startPanel(JText::_('COM_MIGHTYSITES_TAB_OVERRIDES'), 'overrides-page'); + ?> +
+
+
    + form->getFieldset('overrides') as $field) : ?> +
  • label; ?> + input; ?>
  • + +
+
+
+ endPanel(); + } + + if ($this->item->id) { + echo $pane->startPanel(JText::_('COM_MIGHTYSITES_TAB_ADVANCED'), 'advanced-page'); + ?> +
+
+
    + form->getFieldset('advanced') as $field) : ?> +
  • label; ?> + input; ?>
  • + +
+
+
+ endPanel(); + } + +echo $pane->endPane(); +?> + + + + + + + +
diff --git a/deployed/mightysites/administrator/components/com_mightysites/views/site/tmpl/index.html b/deployed/mightysites/administrator/components/com_mightysites/views/site/tmpl/index.html new file mode 100644 index 00000000..2efb97f3 --- /dev/null +++ b/deployed/mightysites/administrator/components/com_mightysites/views/site/tmpl/index.html @@ -0,0 +1 @@ + diff --git a/deployed/mightysites/administrator/components/com_mightysites/views/site/tmpl/tables.php b/deployed/mightysites/administrator/components/com_mightysites/views/site/tmpl/tables.php new file mode 100644 index 00000000..c33be375 --- /dev/null +++ b/deployed/mightysites/administrator/components/com_mightysites/views/site/tmpl/tables.php @@ -0,0 +1,26 @@ + + +
+
+
+ item->domain, JText::_('COM_MIGHTYSITES_SELECT_ALL_TO'), false, '-1', JText::_('COM_MIGHTYSITES_OWN_DATA'), '');?> +
+
+
+ +tables as $table => $input) {?> +
+
+
+
+ + + + + + + + + tables as $table => $input) {?> + + + + +
item->domain, JText::_('COM_MIGHTYSITES_SELECT_ALL_TO'), false, '-1', JText::_('COM_MIGHTYSITES_OWN_DATA'), '');?>
+state = $this->get('State'); + $this->item = $this->get('Item'); + $this->form = $this->get('Form'); + + $this->params = new JRegistry($this->item->params); + + // load tables + if ($this->getLayout() == 'tables') { + $this->tables = $this->getTables(); + } else { + $this->synchs_core = $this->getSynchs('core'); + $this->synchs_custom = $this->getSynchs('custom'); + } + + // Check for errors. + if (count($errors = $this->get('Errors'))) { + JError::raiseError(500, implode("\n", $errors)); + return false; + } + + $this->addToolbar(); + + $version = new JVersion; + if ($version->RELEASE == '2.5') { + $tpl = '25'; + } + + parent::display($tpl); + } + + protected function addToolbar() + { + JRequest::setVar('hidemainmenu', true); + + $user = JFactory::getUser(); + $userId = $user->get('id'); + $isNew = ($this->item->id == 0); + $checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $user->get('id')); + + if (version_compare(JVERSION, '3.2', 'ge')) { + JToolBarHelper::title(JText::_($isNew ? 'COM_MIGHTYSITES_TITLE_SITE_ADD' : 'COM_MIGHTYSITES_TITLE_SITE_EDIT'), 'health'); + } else { + JToolBarHelper::title(JText::_($isNew ? 'COM_MIGHTYSITES_TITLE_SITE_ADD' : 'COM_MIGHTYSITES_TITLE_SITE_EDIT')); + } + + // If not checked out, can save the item. + if (!$checkedOut && $user->authorise('core.edit', 'com_mightysites')) + { + JToolBarHelper::apply('site.apply'); + JToolBarHelper::save('site.save'); + } + if (empty($this->item->id)) { + JToolBarHelper::cancel('site.cancel'); + } + else { + JToolBarHelper::cancel('site.cancel', 'JTOOLBAR_CLOSE'); + } + } + + + protected function getTables() + { + $tables = array(); + + if ($this->item->id) { + $db = MightysitesHelper::getDBO($this->item); + if ($db && $db->connected()) { + // We display both Tables & Views + foreach($db->getTableList() as $table) { + if (strpos($table, $this->item->dbprefix) === 0) { + $name = substr($table, strlen($this->item->dbprefix)); + $tables[$name] = MightysitesHelper::sitesList('jform[tables]['.$name.']', $this->params->get('table_'.$name), null, $this->item->domain, JText::_('COM_MIGHTYSITES_OWN_DATA')); + } + } + } + } + return $tables; + } + + + // Synchs + protected function getSynchs($type) + { + $synchs = array(); + foreach(MightysitesHelper::getSynchs($type) as $synch) { + $synchs[$synch] = MightysitesHelper::sitesList('jform[content]['.$synch.']', $this->params->get($synch), null, $this->item->domain, JText::_('COM_MIGHTYSITES_OWN_DATA')); + } + + return $synchs; + } +} diff --git a/deployed/mightysites/administrator/components/com_mightysites/views/sites/index.html b/deployed/mightysites/administrator/components/com_mightysites/views/sites/index.html new file mode 100644 index 00000000..2efb97f3 --- /dev/null +++ b/deployed/mightysites/administrator/components/com_mightysites/views/sites/index.html @@ -0,0 +1 @@ + diff --git a/deployed/mightysites/administrator/components/com_mightysites/views/sites/tmpl/default.php b/deployed/mightysites/administrator/components/com_mightysites/views/sites/tmpl/default.php new file mode 100644 index 00000000..50e94545 --- /dev/null +++ b/deployed/mightysites/administrator/components/com_mightysites/views/sites/tmpl/default.php @@ -0,0 +1,232 @@ +escape($this->state->get('list.ordering')); +$listDirn = $this->escape($this->state->get('list.direction')); +$sortFields = $this->getSortFields(); + +$this->sidebar = JHtmlSidebar::render(); +?> + + + + +
+sidebar)): ?> +
+ sidebar; ?> +
+
+ +
+ +
+ +
+ + +
+
+ + pagination->getLimitBox(); ?> +
+
+ + +
+
+ + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + items as $i => $item) { + $canEdit = $user->authorise('core.edit', 'com_mightysites'); + $canCheckin = $user->authorise('core.manage', 'com_checkin') || $item->checked_out==$user->get('id') || $item->checked_out==0; + $canChange = $user->authorise('core.edit.state', 'com_mightysites') && $canCheckin; + + $published = JHtml::_('jgrid.published', !@$item->offline, $i, 'sites.', $canChange, 'cb'); + + ?> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +items as $i => $item) : ?> + showForm($item->link, 'siteFormConfig'.$item->id); ?> + showForm($item->link2, 'siteFormAdmin'.$item->id); ?> + + diff --git a/deployed/mightysites/administrator/components/com_mightysites/views/sites/tmpl/default_25.php b/deployed/mightysites/administrator/components/com_mightysites/views/sites/tmpl/default_25.php new file mode 100644 index 00000000..c397ffae --- /dev/null +++ b/deployed/mightysites/administrator/components/com_mightysites/views/sites/tmpl/default_25.php @@ -0,0 +1,180 @@ +escape($this->state->get('list.ordering')); +$listDirn = $this->escape($this->state->get('list.direction')); + +JHtml::_('behavior.tooltip'); +?> + + + +
+ + + + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +items)) { +foreach ($this->items as $i => $item) { + $canEdit = $user->authorise('core.edit', 'com_mightysites'); + $canCheckin = $user->authorise('core.manage', 'com_checkin') || $item->checked_out==$user->get('id') || $item->checked_out==0; + $canChange = $user->authorise('core.edit.state', 'com_mightysites') && $canCheckin; + + $published = JHtml::_('jgrid.published', !@$item->offline, $i, 'sites.', $canChange, 'cb'); + + ?> + + + + + + + + + + + + + + + + + + + + + + + + +
+ pagination->getListFooter(); ?> +
pagination->getRowOffset($i); ?>id); ?>checked_out) : ?> + editor, $item->checked_out_time, 'sites.', $canCheckin); ?> + + + + + title; ?> + + title; ?> + +

escape(@$item->sitename); ?>

+
+ authorise('core.edit', 'com_mightysites')) : ?> + link; ?>" rel="{handler: 'iframe', size: {x: 1200, y: 550}}">*/?> + + + +    + + + + +    + + + + + + + mighty_enable) && $item->mighty_enable) : ?> + + + +    + + + mighty_enable) || !$item->mighty_enable) : ?> + + + +    + + + singleTip) : ?> + + + +    + + + aliases) : ?> + + + +    + + db; ?>user; ?>dbprefix; ?>mighty_language) && $item->mighty_language) ? $item->mighty_language : JText::_('JDEFAULT'); ?>id; ?>
+ + + + + + + + +
+ +items as $i => $item) : ?> + showForm($item->link, 'siteFormConfig'.$item->id); ?> + showForm($item->link2, 'siteFormAdmin'.$item->id); ?> + diff --git a/deployed/mightysites/administrator/components/com_mightysites/views/sites/tmpl/index.html b/deployed/mightysites/administrator/components/com_mightysites/views/sites/tmpl/index.html new file mode 100644 index 00000000..2efb97f3 --- /dev/null +++ b/deployed/mightysites/administrator/components/com_mightysites/views/sites/tmpl/index.html @@ -0,0 +1 @@ + diff --git a/deployed/mightysites/administrator/components/com_mightysites/views/sites/view.html.php b/deployed/mightysites/administrator/components/com_mightysites/views/sites/view.html.php new file mode 100644 index 00000000..06938ded --- /dev/null +++ b/deployed/mightysites/administrator/components/com_mightysites/views/sites/view.html.php @@ -0,0 +1,172 @@ +getModel()->setState('filter.type', 1); + + $this->state = $this->get('State'); + $this->items = $this->get('Items'); + $this->pagination = $this->get('Pagination'); + + // Check for errors. + if (count($errors = $this->get('Errors'))) { + JError::raiseError(500, implode("\n", $errors)); + return false; + } + + // Add some data, yes - here, not in model! + foreach ($this->items as &$item) { + // Title + if ($item->id == 1) { + $item->title = ''.$item->domain.''; + } else { + $item->title = $item->domain; + } + + // Links + $mighty = base64_encode(JFactory::getURI()->toString()); + //$item->link = $this->_getLink($item, 'index.php?option=com_config&tmpl=component&mighty='.$mighty); + $item->link = $this->_getLink($item, 'index.php?option=com_config'); + $item->link2 = $this->_getLink($item, 'index.php'); + + // Infotip + $item->contentTip = $this->_getContentInfo($item); + $item->singleTip = $this->_getSingleInfo($item); + } + + $this->addToolbar(); + + $version = new JVersion; + if ($version->RELEASE == '2.5') { + $tpl = '25'; + } + + parent::display($tpl); + } + + protected function addToolbar() + { + // Load the submenu. + MightysitesHelper::topMenu(); + + // Title + if (version_compare(JVERSION, '3.2', 'ge')) { + JToolBarHelper::title(JText::_('COM_MIGHTYSITES_TITLE_SITES'), 'health'); + } else { + JToolBarHelper::title(JText::_('COM_MIGHTYSITES_TITLE_SITES')); + } + + $user = JFactory::getUser(); + + // Toolbar + if ($user->authorise('core.create', 'com_mightysites')) { + JToolBarHelper::addNew('site.add'); + } + if ($user->authorise('core.edit', 'com_mightysites')) { + JToolBarHelper::editList('site.edit'); + JToolBarHelper::divider(); + } + if ($user->authorise('core.edit.state', 'com_mightysites')) { + JToolBarHelper::publishList('sites.publish', 'COM_MIGHTYSITES_ONLINE'); + JToolBarHelper::unpublishList('sites.unpublish', 'COM_MIGHTYSITES_OFFLINE'); + JToolbarHelper::checkin('sites.checkin'); + } + if ($user->authorise('core.delete', 'com_mightysites')) { + JToolBarHelper::divider(); + JToolBarHelper::deleteList(JText::_('COM_MIGHTYSITES_REALLY_DELETE_SITES'), 'sites.remove'); + } + if ($user->authorise('core.admin', 'com_mightysites')) { + JToolBarHelper::divider(); + JToolBarHelper::preferences('com_mightysites', '300'); + } + } + + protected function getSortFields() + { + return array( + 'a.domain' => JText::_('COM_MIGHTYSITES_HEADING_SITE'), + 'a.id' => JText::_('ID'), + ); + } + + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + protected function _getContentInfo($row) + { + $i = 0; + $s = ''; + foreach(MightysitesHelper::getSynchs() as $synch) { + if ($row->params->get($synch)) { + $s .= ''; + $i++; + } + } + $s2 = ''; + foreach($row->params->toArray() as $key => $value) { + if (strpos($key, 'table_') === 0) { + $s2 .= ''; + $i++; + } + } + if ($s2) { + $s .= '' . $s2; + } + $s .= '
'.JText::_('COM_MIGHTYSITES_SYNCH_LABEL_'.$synch).':'.MightysitesHelper::getSite($row->params->get($synch))->domain.'
#__'.substr($key, 6).':'.MightysitesHelper::getSite($value)->domain.'

'; + return $i ? htmlspecialchars($s, ENT_COMPAT, 'UTF-8') : null; + } + + protected function _getSingleInfo($row) + { + if (isset($row->mighty_sdomains) && $row->mighty_sdomains) { + $s = ''; + $s .= ''; + $s .= ''; + $s .= ''; + foreach($row->mighty_sdomains as $key => $value) { + $s .= ''; + } + $s .= '
'.JText::_('COM_MIGHTYSITES_FIELD_SINGLE_LOGIN').':'.((isset($row->mighty_slogin) && $row->mighty_slogin) ? JText::_('JENABLED') : JText::_('JDISABLED')).'
'.JText::_('COM_MIGHTYSITES_FIELD_SINGLE_LOGOUT').':'.((isset($row->mighty_slogout) && $row->mighty_slogout) ? JText::_('JENABLED') : JText::_('JDISABLED')).'

'.$key.'
'; + return htmlspecialchars($s, ENT_COMPAT, 'UTF-8'); + } + } + + protected function _getLink(&$row, $link) + { + if ($row->domain != MightysitesHelper::getHost()) { + $link = 'index.php?option=com_mightysites&task=site.login&domain='.base64_encode($row->domain).'&return='.base64_encode($link); + } + return JRoute::_($link); + } + + // Mod_security - that's for you, my dear! + protected function showForm($link, $name = null) + { + $link = str_replace('&', '&', $link); + + $parts = parse_url($link); + + $hiddens = array(); + + if (isset($parts['query'])) { + parse_str($parts['query'], $vars); + foreach($vars as $key => $value) { + $hiddens[] = ''; + } + } + + $html = ''; + + return $html; + } + +} diff --git a/deployed/mightysites/components/com_mightysites/configuration/configuration_archline_hu.php b/deployed/mightysites/components/com_mightysites/configuration/configuration_archline_hu.php new file mode 100644 index 00000000..4b471069 --- /dev/null +++ b/deployed/mightysites/components/com_mightysites/configuration/configuration_archline_hu.php @@ -0,0 +1,119 @@ + Kérjük, látogasson vissza hozzánk minél előbb.'; + public $display_offline_message = '1'; + public $offline_image = ''; + public $sitename = 'www.archline.hu'; + public $editor = 'jckeditor'; + public $captcha = '0'; + public $list_limit = '20'; + public $access = '1'; + public $debug = '0'; + public $debug_lang = '0'; + public $dbtype = 'mysqli'; + public $host = 'localhost'; + public $user = 'cadline'; + public $password = 'Shea6hoo'; + public $db = 'www_archline_hu'; + public $dbprefix = 'jml_'; + public $live_site = ''; + public $secret = 'tWlnivpYpEaejpEd'; + public $gzip = '0'; + public $error_reporting = 'default'; + public $helpurl = 'https://help.joomla.org/proxy?keyref=Help{major}{minor}:{keyref}&lang={langcode}'; + public $ftp_host = ''; + public $ftp_port = ''; + public $ftp_user = ''; + public $ftp_pass = ''; + public $ftp_root = ''; + public $ftp_enable = '0'; + public $offset = 'UTC'; + public $mailonline = '1'; + public $mailer = 'mail'; + public $mailfrom = 'office@cadline.hu'; + public $fromname = 'www.archline.hu'; + public $sendmail = '/usr/sbin/sendmail'; + public $smtpauth = '0'; + public $smtpuser = ''; + public $smtppass = ''; + public $smtphost = 'localhost'; + public $smtpsecure = 'none'; + public $smtpport = '25'; + public $caching = '0'; + public $cache_handler = 'file'; + public $cachetime = '15'; + public $cache_platformprefix = '0'; + public $MetaDesc = ''; + public $MetaKeys = ''; + public $MetaTitle = '1'; + public $MetaAuthor = '1'; + public $MetaVersion = '0'; + public $robots = ''; + public $sef = '1'; + public $sef_rewrite = '1'; + public $sef_suffix = '0'; + public $unicodeslugs = '0'; + public $feed_limit = '10'; + public $feed_email = 'none'; + public $log_path = '/var/www/hosting/archline.hu/sub/logs'; + public $tmp_path = '/var/www/hosting/archline.hu/sub/tmp'; + public $lifetime = '30'; + public $session_handler = 'database'; + public $mighty = array("0" => array("0" => "/`?#__assets[` \\n]+/u", "1" => "/`?#__usergroups[` \\n]+/u", "2" => "/`?#__users[` \\n]+/u", "3" => "/`?#__user_notes[` \\n]+/u", "4" => "/`?#__user_profiles[` \\n]+/u", "5" => "/`?#__user_usergroup_map[` \\n]+/u", "6" => "/`?#__user_keys[` \\n]+/u", "7" => "/`?#__viewlevels[` \\n]+/u", "8" => "/`?#__mightysites[` \\n]+/u"), "1" => array("0" => "`oldeng_assets` ", "1" => "`oldeng_usergroups` ", "2" => "`oldeng_users` ", "3" => "`oldeng_user_notes` ", "4" => "`oldeng_user_profiles` ", "5" => "`oldeng_user_usergroup_map` ", "6" => "`oldeng_user_keys` ", "7" => "`oldeng_viewlevels` ", "8" => "`jml_mightysites` ")); + public $mighty_enable = '0'; + public $mighty_language = 'hu-HU'; + public $mighty_template = ''; + public $mighty_home = ''; + public $mighty_langoverride = '0'; + public $mighty_slogin = '1'; + public $mighty_slogout = '1'; + public $mighty_sdomains = array(); + public $mighty_css = array(); + public $mighty_js = ''; + public $mighty_hidemenus = array(); + public $mighty_hidemodules = array(); + public $mighty_favicon = ''; + public $mighty_mijoshopid = ''; + public $mighty_file_path = ''; + public $mighty_image_path = ''; + public $mighty_new_usertype = ''; + public $memcache_persist = '1'; + public $memcache_compress = '0'; + public $memcache_server_host = 'localhost'; + public $memcache_server_port = '11211'; + public $memcached_persist = '1'; + public $memcached_compress = '0'; + public $memcached_server_host = 'localhost'; + public $memcached_server_port = '11211'; + public $redis_persist = '1'; + public $redis_server_host = 'localhost'; + public $redis_server_port = '6379'; + public $redis_server_auth = ''; + public $redis_server_db = '0'; + public $proxy_enable = '0'; + public $proxy_host = ''; + public $proxy_port = ''; + public $proxy_user = ''; + public $proxy_pass = ''; + public $massmailoff = '0'; + public $MetaRights = ''; + public $sitename_pagetitles = '0'; + public $force_ssl = '0'; + public $session_memcache_server_host = 'localhost'; + public $session_memcache_server_port = '11211'; + public $session_memcached_server_host = 'localhost'; + public $session_memcached_server_port = '11211'; + public $frontediting = '1'; + public $cookie_domain = ''; + public $cookie_path = ''; + public $asset_id = '1'; + public $replyto = ''; + public $replytoname = ''; + public $session_redis_persist = '1'; + public $session_redis_server_host = 'localhost'; + public $session_redis_server_port = '6379'; + public $session_redis_server_auth = ''; + public $session_redis_server_db = '0'; + public $shared_session = '0'; +} \ No newline at end of file diff --git a/deployed/mightysites/components/com_mightysites/configuration/configuration_archlinexp_com.php b/deployed/mightysites/components/com_mightysites/configuration/configuration_archlinexp_com.php new file mode 100644 index 00000000..b758890b --- /dev/null +++ b/deployed/mightysites/components/com_mightysites/configuration/configuration_archlinexp_com.php @@ -0,0 +1,119 @@ + Please, check back later.'; + public $display_offline_message = '1'; + public $offline_image = ''; + public $sitename = 'archlinexp.com'; + public $editor = 'jckeditor'; + public $captcha = '0'; + public $list_limit = '20'; + public $access = '1'; + public $debug = '0'; + public $debug_lang = '0'; + public $dbtype = 'mysqli'; + public $host = 'localhost'; + public $user = 'cadline'; + public $password = 'Shea6hoo'; + public $db = 'www_archline_hu'; + public $dbprefix = 'eng_'; + public $live_site = ''; + public $secret = 'tWlnivpYpEaejpEd'; + public $gzip = '0'; + public $error_reporting = 'default'; + public $helpurl = 'https://help.joomla.org/proxy?keyref=Help{major}{minor}:{keyref}&lang={langcode}'; + public $ftp_host = ''; + public $ftp_port = ''; + public $ftp_user = ''; + public $ftp_pass = ''; + public $ftp_root = ''; + public $ftp_enable = '0'; + public $offset = 'UTC'; + public $mailonline = '1'; + public $mailer = 'mail'; + public $mailfrom = 'info@archlinexp.com'; + public $fromname = 'www.archlinexp.com'; + public $sendmail = '/usr/sbin/sendmail'; + public $smtpauth = '0'; + public $smtpuser = ''; + public $smtppass = ''; + public $smtphost = 'localhost'; + public $smtpsecure = 'none'; + public $smtpport = '25'; + public $caching = '0'; + public $cache_handler = 'file'; + public $cachetime = '15'; + public $cache_platformprefix = '0'; + public $MetaDesc = ''; + public $MetaKeys = ''; + public $MetaTitle = '1'; + public $MetaAuthor = '1'; + public $MetaVersion = '0'; + public $robots = ''; + public $sef = '1'; + public $sef_rewrite = '0'; + public $sef_suffix = '0'; + public $unicodeslugs = '0'; + public $feed_limit = '10'; + public $feed_email = 'none'; + public $log_path = '/var/www/hosting/archline.hu/sub/logs'; + public $tmp_path = '/var/www/hosting/archline.hu/sub/tmp'; + public $lifetime = '30'; + public $session_handler = 'database'; + public $mighty = array("0" => array("0" => "/`?#__assets[` \\n]+/u", "1" => "/`?#__usergroups[` \\n]+/u", "2" => "/`?#__users[` \\n]+/u", "3" => "/`?#__user_notes[` \\n]+/u", "4" => "/`?#__user_profiles[` \\n]+/u", "5" => "/`?#__user_usergroup_map[` \\n]+/u", "6" => "/`?#__user_keys[` \\n]+/u", "7" => "/`?#__viewlevels[` \\n]+/u", "8" => "/`?#__mightysites[` \\n]+/u"), "1" => array("0" => "`jml_assets` ", "1" => "`jml_usergroups` ", "2" => "`jml_users` ", "3" => "`jml_user_notes` ", "4" => "`jml_user_profiles` ", "5" => "`jml_user_usergroup_map` ", "6" => "`jml_user_keys` ", "7" => "`jml_viewlevels` ", "8" => "`jml_mightysites` ")); + public $mighty_enable = '1'; + public $mighty_language = 'en-GB'; + public $mighty_template = ''; + public $mighty_home = ''; + public $mighty_langoverride = '0'; + public $mighty_slogin = '1'; + public $mighty_slogout = '1'; + public $mighty_sdomains = array("archline.hu" => "tWlnivpYpEaejpEd"); + public $mighty_css = array(); + public $mighty_js = ''; + public $mighty_hidemenus = array(); + public $mighty_hidemodules = array(); + public $mighty_favicon = ''; + public $mighty_mijoshopid = ''; + public $mighty_file_path = ''; + public $mighty_image_path = ''; + public $mighty_new_usertype = ''; + public $cookie_domain = ''; + public $memcache_persist = '1'; + public $memcache_compress = '0'; + public $memcache_server_host = 'localhost'; + public $memcache_server_port = '11211'; + public $memcached_persist = '1'; + public $memcached_compress = '0'; + public $memcached_server_host = 'localhost'; + public $memcached_server_port = '11211'; + public $redis_persist = '1'; + public $redis_server_host = 'localhost'; + public $redis_server_port = '6379'; + public $redis_server_auth = ''; + public $redis_server_db = '0'; + public $proxy_enable = '0'; + public $proxy_host = ''; + public $proxy_port = ''; + public $proxy_user = ''; + public $proxy_pass = ''; + public $massmailoff = '0'; + public $MetaRights = ''; + public $sitename_pagetitles = '0'; + public $force_ssl = '2'; + public $session_memcache_server_host = 'localhost'; + public $session_memcache_server_port = '11211'; + public $session_memcached_server_host = 'localhost'; + public $session_memcached_server_port = '11211'; + public $frontediting = '1'; + public $cookie_path = ''; + public $asset_id = '1'; + public $replyto = ''; + public $replytoname = ''; + public $session_redis_persist = '1'; + public $session_redis_server_host = 'localhost'; + public $session_redis_server_port = '6379'; + public $session_redis_server_auth = ''; + public $session_redis_server_db = '0'; + public $shared_session = '0'; +} \ No newline at end of file diff --git a/deployed/mightysites/components/com_mightysites/configuration/configuration_old_archline_hu.php b/deployed/mightysites/components/com_mightysites/configuration/configuration_old_archline_hu.php new file mode 100644 index 00000000..6eb1a6e3 --- /dev/null +++ b/deployed/mightysites/components/com_mightysites/configuration/configuration_old_archline_hu.php @@ -0,0 +1,105 @@ + array("0" => "/`?#__assets[` \\n]+/u", "1" => "/`?#__usergroups[` \\n]+/u", "2" => "/`?#__users[` \\n]+/u", "3" => "/`?#__user_notes[` \\n]+/u", "4" => "/`?#__user_profiles[` \\n]+/u", "5" => "/`?#__user_usergroup_map[` \\n]+/u", "6" => "/`?#__user_keys[` \\n]+/u", "7" => "/`?#__viewlevels[` \\n]+/u", "8" => "/`?#__mightysites[` \\n]+/u"), "1" => array("0" => "`jml_assets` ", "1" => "`jml_usergroups` ", "2" => "`jml_users` ", "3" => "`jml_user_notes` ", "4" => "`jml_user_profiles` ", "5" => "`jml_user_usergroup_map` ", "6" => "`jml_user_keys` ", "7" => "`jml_viewlevels` ", "8" => "`jml_mightysites` ")); + public $mighty_enable = '1'; + public $mighty_language = 'hu-HU'; + public $mighty_template = ''; + public $mighty_home = ''; + public $mighty_langoverride = '0'; + public $cache_path = ''; + public $mighty_slogin = '1'; + public $mighty_slogout = '1'; + public $mighty_sdomains = array("archline.hu" => "tWlnivpYpEaejpEd"); + public $mighty_css = array(); + public $mighty_js = ''; + public $mighty_hidemenus = array(); + public $mighty_hidemodules = array(); + public $mighty_favicon = ''; + public $mighty_mijoshopid = ''; + public $mighty_file_path = ''; + public $mighty_image_path = ''; + public $mighty_new_usertype = ''; +} \ No newline at end of file diff --git a/deployed/mightysites/components/com_mightysites/configuration/configuration_old_archlinexp_com.php b/deployed/mightysites/components/com_mightysites/configuration/configuration_old_archlinexp_com.php new file mode 100644 index 00000000..1000a58f --- /dev/null +++ b/deployed/mightysites/components/com_mightysites/configuration/configuration_old_archlinexp_com.php @@ -0,0 +1,112 @@ + Kérjük, látogasson vissza hozzánk minél előbb.'; + public $display_offline_message = '1'; + public $offline_image = ''; + public $sitename = 'old.archlinexp.com'; + public $editor = 'jckeditor'; + public $captcha = '0'; + public $list_limit = '20'; + public $access = '1'; + public $debug = '0'; + public $debug_lang = '0'; + public $dbtype = 'mysqli'; + public $host = 'localhost'; + public $user = 'cadline'; + public $password = 'Shea6hoo'; + public $db = 'www_archline_hu'; + public $dbprefix = 'oldeng_'; + public $live_site = ''; + public $secret = 'tWlnivpYpEaejpEd'; + public $gzip = '0'; + public $error_reporting = 'default'; + public $helpurl = 'https://help.joomla.org/proxy/index.php?option=com_help&keyref=Help{major}{minor}:{keyref}'; + public $ftp_host = ''; + public $ftp_port = ''; + public $ftp_user = ''; + public $ftp_pass = ''; + public $ftp_root = ''; + public $ftp_enable = '0'; + public $offset = 'UTC'; + public $mailonline = '1'; + public $mailer = 'mail'; + public $mailfrom = 'zsolt.fekete@cadline.hu'; + public $fromname = 'lakberendezo.archline.hu'; + public $sendmail = '/usr/sbin/sendmail'; + public $smtpauth = '0'; + public $smtpuser = ''; + public $smtppass = ''; + public $smtphost = 'localhost'; + public $smtpsecure = 'none'; + public $smtpport = '25'; + public $caching = '0'; + public $cache_handler = 'file'; + public $cachetime = '15'; + public $cache_platformprefix = '0'; + public $MetaDesc = ''; + public $MetaKeys = ''; + public $MetaTitle = '1'; + public $MetaAuthor = '1'; + public $MetaVersion = '0'; + public $robots = ''; + public $sef = '1'; + public $sef_rewrite = '1'; + public $sef_suffix = '0'; + public $unicodeslugs = '0'; + public $feed_limit = '10'; + public $feed_email = 'none'; + public $log_path = '/var/www/hosting/archline.hu/sub/logs'; + public $tmp_path = '/var/www/hosting/archline.hu/sub/tmp'; + public $lifetime = '15'; + public $session_handler = 'database'; + public $mighty = array("0" => array("0" => "/`?#__usergroups[` \\n]+/u", "1" => "/`?#__users[` \\n]+/u", "2" => "/`?#__user_notes[` \\n]+/u", "3" => "/`?#__user_profiles[` \\n]+/u", "4" => "/`?#__user_usergroup_map[` \\n]+/u", "5" => "/`?#__user_keys[` \\n]+/u", "6" => "/`?#__viewlevels[` \\n]+/u", "7" => "/`?#__mightysites[` \\n]+/u"), "1" => array("0" => "`jml_usergroups` ", "1" => "`jml_users` ", "2" => "`jml_user_notes` ", "3" => "`jml_user_profiles` ", "4" => "`jml_user_usergroup_map` ", "5" => "`jml_user_keys` ", "6" => "`jml_viewlevels` ", "7" => "`jml_mightysites` ")); + public $mighty_enable = '1'; + public $mighty_language = 'en-GB'; + public $mighty_template = ''; + public $mighty_home = ''; + public $mighty_langoverride = '0'; + public $cache_path = ''; + public $mighty_slogin = '1'; + public $mighty_slogout = '1'; + public $mighty_sdomains = array("archline.hu" => "tWlnivpYpEaejpEd"); + public $mighty_css = array(); + public $mighty_js = ''; + public $mighty_hidemenus = array(); + public $mighty_hidemodules = array(); + public $mighty_favicon = ''; + public $mighty_mijoshopid = ''; + public $mighty_file_path = ''; + public $mighty_image_path = ''; + public $mighty_new_usertype = ''; + public $memcache_persist = '1'; + public $memcache_compress = '0'; + public $memcache_server_host = 'localhost'; + public $memcache_server_port = '11211'; + public $memcached_persist = '1'; + public $memcached_compress = '0'; + public $memcached_server_host = 'localhost'; + public $memcached_server_port = '11211'; + public $redis_persist = '1'; + public $redis_server_host = 'localhost'; + public $redis_server_port = '6379'; + public $redis_server_auth = ''; + public $redis_server_db = '0'; + public $proxy_enable = '0'; + public $proxy_host = ''; + public $proxy_port = ''; + public $proxy_user = ''; + public $proxy_pass = ''; + public $massmailoff = '0'; + public $MetaRights = ''; + public $sitename_pagetitles = '0'; + public $force_ssl = '0'; + public $session_memcache_server_host = 'localhost'; + public $session_memcache_server_port = '11211'; + public $session_memcached_server_host = 'localhost'; + public $session_memcached_server_port = '11211'; + public $frontediting = '1'; + public $cookie_domain = ''; + public $cookie_path = ''; + public $asset_id = '1'; +} \ No newline at end of file diff --git a/deployed/mightysites/components/com_mightysites/configuration/default.php b/deployed/mightysites/components/com_mightysites/configuration/default.php new file mode 100644 index 00000000..e37eb850 --- /dev/null +++ b/deployed/mightysites/components/com_mightysites/configuration/default.php @@ -0,0 +1,4 @@ + \ No newline at end of file diff --git a/deployed/mightysites/components/com_mightysites/format_25.php b/deployed/mightysites/components/com_mightysites/format_25.php new file mode 100644 index 00000000..c2a0160e --- /dev/null +++ b/deployed/mightysites/components/com_mightysites/format_25.php @@ -0,0 +1,140 @@ + $v) + { + if (is_scalar($v)) + { + $vars .= "\tpublic $" . $k . " = '" . addcslashes($v, '\\\'') . "';\n"; + } + elseif (is_array($v) || is_object($v)) + { + $vars .= "\tpublic $" . $k . " = " . $this->getArrayString((array) $v) . ";\n"; + } + } + + $str = ""; + } + + // default behavior + if ($params['class'] != 'JConfig') { + return $str; + } + // our behavior + else { + $app = JFactory::getApplication(); + // get domain + require_once(JPATH_ADMINISTRATOR.'/components/com_mightysites/helpers/helper.php'); + + $mighty = $app->input->getString('mighty'); + $file = MightysitesHelper::getConfigFilename(); + + // Get the new FTP credentials. + jimport('joomla.client.helper'); + $ftp = JClientHelper::getCredentials('ftp', true); + + // Attempt to make the file writeable if using FTP. + if (!$ftp['enabled'] && JPath::isOwner($file) && !JPath::setPermissions($file, '0644')) { + $link = $mighty ? 'index.php?option=com_config&tmpl=component&mighty='.$mighty : 'index.php?option=com_config'; + $app->redirect($link, JText::_('COM_CONFIG_ERROR_CONFIGURATION_PHP_NOTWRITABLE'), 'error'); + } + + // Attempt to write the configuration file as a PHP class named JConfig. + if (!JFile::write($file, $str)) { + $link = $mighty ? 'index.php?option=com_config&tmpl=component&mighty='.$mighty : 'index.php?option=com_config'; + $app->redirect($link, JText::_('COM_CONFIG_ERROR_WRITE_FAILED'), 'error'); + } + + MightysitesHelper::patchConfiguration(); + + // Get the new FTP credentials. + $ftp = JClientHelper::getCredentials('ftp', true); + + // Attempt to make the file unwriteable if using FTP. + if (JFactory::getConfig()->get('ftp_enable') == 0 && !$ftp['enabled'] && JPath::isOwner($file) && !JPath::setPermissions($file, '0444')) { + JError::raiseNotice('SOME_ERROR_CODE', JText::_('COM_CONFIG_ERROR_CONFIGURATION_PHP_NOTUNWRITABLE')); + } + + // Redirect appropriately + $task = $app->input->get('task'); + + // Set the success message. + $message = JText::_('COM_CONFIG_SAVE_SUCCESS'); + + if ($mighty) { + switch ($task) { + case 'apply' : + $app->redirect('index.php?option=com_config&tmpl=component&mighty='.$mighty, $message); + break; + + case 'save' : + default : + ?> + +
+ +
+ + + redirect('index.php?option=com_config', $message); + break; + case 'save' : + default : + $app->redirect('index.php', $message); + break; + } + } + } + } + + public function stringToObject($data, $options = array()) + { + return true; + } + + protected function getArrayString($a) + { + $s = 'array('; + $i = 0; + foreach ($a as $k => $v) + { + $s .= ($i) ? ', ' : ''; + $s .= '"' . $k . '" => '; + if (is_array($v) || is_object($v)) + { + $s .= $this->getArrayString((array) $v); + } + else + { + $s .= '"' . addslashes($v) . '"'; + } + $i++; + } + $s .= ')'; + return $s; + } +} diff --git a/deployed/mightysites/components/com_mightysites/format_30.php b/deployed/mightysites/components/com_mightysites/format_30.php new file mode 100644 index 00000000..c52a1d2b --- /dev/null +++ b/deployed/mightysites/components/com_mightysites/format_30.php @@ -0,0 +1,145 @@ + $v) + { + if (is_scalar($v)) + { + $vars .= "\tpublic $" . $k . " = '" . addcslashes($v, '\\\'') . "';\n"; + } + elseif (is_array($v) || is_object($v)) + { + $vars .= "\tpublic $" . $k . " = " . $this->getArrayString((array) $v) . ";\n"; + } + } + + $str = ""; + } + + // default behavior + if ($params['class'] != 'JConfig') { + return $str; + } + // our behavior + else { + $app = JFactory::getApplication(); + // get domain + require_once(JPATH_ADMINISTRATOR.'/components/com_mightysites/helpers/helper.php'); + + $mighty = $app->input->getString('mighty'); + $file = MightysitesHelper::getConfigFilename(); + + // Get the new FTP credentials. + jimport('joomla.client.helper'); + $ftp = JClientHelper::getCredentials('ftp', true); + + // Attempt to make the file writeable if using FTP. + if (!$ftp['enabled'] && JPath::isOwner($file) && !JPath::setPermissions($file, '0644')) { + $link = $mighty ? 'index.php?option=com_config&tmpl=component&mighty='.$mighty : 'index.php?option=com_config'; + $app->redirect($link, JText::_('COM_CONFIG_ERROR_CONFIGURATION_PHP_NOTWRITABLE'), 'error'); + } + + // Attempt to write the configuration file as a PHP class named JConfig. + if (!JFile::write($file, $str)) { + $link = $mighty ? 'index.php?option=com_config&tmpl=component&mighty='.$mighty : 'index.php?option=com_config'; + $app->redirect($link, JText::_('COM_CONFIG_ERROR_WRITE_FAILED'), 'error'); + } + + MightysitesHelper::patchConfiguration(); + + // Get the new FTP credentials. + $ftp = JClientHelper::getCredentials('ftp', true); + + // Attempt to make the file unwriteable if using FTP. + if (JFactory::getConfig()->get('ftp_enable') == 0 && !$ftp['enabled'] && JPath::isOwner($file) && !JPath::setPermissions($file, '0444')) { + JError::raiseNotice('SOME_ERROR_CODE', JText::_('COM_CONFIG_ERROR_CONFIGURATION_PHP_NOTUNWRITABLE')); + } + + // Redirect appropriately + $task = $app->input->get('task'); + + // Set the success message. + $message = JText::_('COM_CONFIG_SAVE_SUCCESS'); + + if ($mighty) { + switch ($task) { + case 'apply': + case 'config.save.application.apply': + $app->redirect('index.php?option=com_config&tmpl=component&mighty='.$mighty, $message, 'message'); + break; + + case 'save': + case 'config.save.application.save': + default: + ?> + +
+ +
+ + + redirect('index.php?option=com_config', $message, 'message'); + break; + + case 'save' : + case 'config.save.application.save': + default : + $app->redirect('index.php', $message, 'message'); + break; + } + } + } + } + + public function stringToObject($data, array $options = array()) + { + return true; + } + + protected function getArrayString($a) + { + $s = 'array('; + $i = 0; + foreach ($a as $k => $v) + { + $s .= ($i) ? ', ' : ''; + $s .= '"' . $k . '" => '; + if (is_array($v) || is_object($v)) + { + $s .= $this->getArrayString((array) $v); + } + else + { + $s .= '"' . addslashes($v) . '"'; + } + $i++; + } + $s .= ')'; + return $s; + } +} diff --git a/deployed/mightysites/components/com_mightysites/format_33.php b/deployed/mightysites/components/com_mightysites/format_33.php new file mode 100644 index 00000000..2208b427 --- /dev/null +++ b/deployed/mightysites/components/com_mightysites/format_33.php @@ -0,0 +1,174 @@ + $v) + { + if (is_scalar($v)) + { + $vars .= "\tpublic $" . $k . " = '" . addcslashes($v, '\\\'') . "';\n"; + } + elseif (is_array($v) || is_object($v)) + { + $vars .= "\tpublic $" . $k . " = " . $this->getArrayString((array) $v) . ";\n"; + } + } + + $str = ""; + } + + // default behavior + if ($params['class'] != 'JConfig') { + return $str; + } + // our behavior + else { + $app = \JFactory::getApplication(); + // get domain + require_once(JPATH_ADMINISTRATOR.'/components/com_mightysites/helpers/helper.php'); + + $file = \MightysitesHelper::getConfigFilename(); + + // Get the new FTP credentials. + jimport('joomla.client.helper'); + $ftp = \JClientHelper::getCredentials('ftp', true); + + // Attempt to make the file writeable if using FTP. + if (!$ftp['enabled'] && \JPath::isOwner($file) && !\JPath::setPermissions($file, '0644')) { + $link = 'index.php?option=com_config'; + $app->redirect($link, \JText::_('COM_CONFIG_ERROR_CONFIGURATION_PHP_NOTWRITABLE'), 'error'); + } + + // Attempt to write the configuration file as a PHP class named JConfig. + if (!\JFile::write($file, $str)) { + $link = 'index.php?option=com_config'; + $app->redirect($link, \JText::_('COM_CONFIG_ERROR_WRITE_FAILED'), 'error'); + } + + \MightysitesHelper::patchConfiguration(); + + // Get the new FTP credentials. + $ftp = \JClientHelper::getCredentials('ftp', true); + + // Attempt to make the file unwriteable if using FTP. + if (\JFactory::getConfig()->get('ftp_enable') == 0 && !$ftp['enabled'] && \JPath::isOwner($file) && !\JPath::setPermissions($file, '0444')) { + JError::raiseNotice('SOME_ERROR_CODE', \JText::_('COM_CONFIG_ERROR_CONFIGURATION_PHP_NOTUNWRITABLE')); + } + + // Redirect appropriately + $task = $app->input->get('task'); + + // Set the success message. + $message = \JText::_('COM_CONFIG_SAVE_SUCCESS'); + + // Save the data in the session. + $app->setUserState('com_config.config.global.data', (array)$object); + + + // Set the success message. + $app->enqueueMessage(\JText::_('COM_CONFIG_SAVE_SUCCESS')); + + // Set the redirect based on the task. + switch ($task) + { + case 'config.save.application.apply': + $app->redirect(\JRoute::_('index.php?option=com_config', false)); + break; + + case 'config.save.application.save': + default: + $app->redirect(\JRoute::_('index.php', false)); + break; + } + } + } + + /** + * Parse a PHP class formatted string and convert it into an object. + * + * @param string $data PHP Class formatted string to convert. + * @param array $options Options used by the formatter. + * + * @return object Data object. + * + * @since 1.0 + */ + public function stringToObject($data, array $options = array()) + { + return true; + } + + /** + * Method to get an array as an exported string. + * + * @param array $a The array to get as a string. + * + * @return array + * + * @since 1.0 + */ + protected function getArrayString($a) + { + $s = 'array('; + $i = 0; + + foreach ($a as $k => $v) + { + $s .= ($i) ? ', ' : ''; + $s .= '"' . $k . '" => '; + + if (is_array($v) || is_object($v)) + { + $s .= $this->getArrayString((array) $v); + } + else + { + $s .= '"' . addslashes($v) . '"'; + } + + $i++; + } + + $s .= ')'; + + return $s; + } +} diff --git a/deployed/mightysites/components/com_mightysites/index.html b/deployed/mightysites/components/com_mightysites/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/deployed/mightysites/components/com_mightysites/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/deployed/mightysites/components/com_mightysites/mightysites.php b/deployed/mightysites/components/com_mightysites/mightysites.php new file mode 100644 index 00000000..aa1f68c1 --- /dev/null +++ b/deployed/mightysites/components/com_mightysites/mightysites.php @@ -0,0 +1,261 @@ +mighty_enable) && $config->mighty_enable && isset($config->mighty[0][0])) +{ + // Remove legacy + if ($config->dbtype == 'mightysites') { + $config->dbtype = 'mysql'; + } + + if (version_compare(JVERSION, '3.0', 'ge')) { + require_once(JPATH_SITE.'/libraries/joomla/database/database.php'); + require_once(JPATH_SITE.'/libraries/joomla/database/driver.php'); + require_once(JPATH_SITE.'/libraries/joomla/database/driver/'.$config->dbtype.'.php'); + class_alias('JDatabaseDriver'.ucfirst($config->dbtype), 'JDatabaseMightysitesBase'); + } + else { + require_once(JPATH_SITE.'/libraries/joomla/database/database.php'); + require_once(JPATH_SITE.'/libraries/joomla/database/database/'.$config->dbtype.'.php'); + class_alias('JDatabase'.$config->dbtype, 'JDatabaseMightysitesBase'); + } + + class JDatabaseMightysites extends JDatabaseMightysitesBase + { + public $count = null; + public $log = null; + public $mighty = null; + + public function __construct($options) + { + parent::__construct($options); + + $this->mighty = JFactory::getConfig()->get('mighty'); + + // stupid IIS uses \r\n + if (PHP_EOL === "\r\n" && isset($this->mighty[0][0])) { + foreach($this->mighty[0] as &$tmp) { + $tmp = str_replace('\n', '\r\n', $tmp); + } + } + } + + // Not here, baby! + public function __destruct() {} + + public function replacePrefix($sql, $prefix = '#__') + { + // We need to allow parent usual method + if (isset($GLOBALS['no_mightysharing'])) { + return parent::replacePrefix($sql, $prefix); + } + + // Initialize variables. + $escaped = false; + $startPos = 0; + $quoteChar = ''; + $literal = ''; + + $sql = trim($sql); + $n = strlen($sql); + + while ($startPos < $n) + { + $ip = strpos($sql, $prefix, $startPos); + if ($ip === false) + { + break; + } + + $j = strpos($sql, "'", $startPos); + $k = strpos($sql, '"', $startPos); + if (($k !== false) && (($k < $j) || ($j === false))) + { + $quoteChar = '"'; + $j = $k; + } + else + { + $quoteChar = "'"; + } + + if ($j === false) + { + $j = $n; + } + + $literal .= str_replace($prefix, $this->tablePrefix, preg_replace($this->mighty[0], $this->mighty[1], substr($sql, $startPos, $j - $startPos).' ')); + $startPos = $j; + + $j = $startPos + 1; + + if ($j >= $n) + { + break; + } + + // quote comes first, find end of quote + while (true) + { + $k = strpos($sql, $quoteChar, $j); + $escaped = false; + if ($k === false) + { + break; + } + $l = $k - 1; + while ($l >= 0 && $sql{$l} == '\\') + { + $l--; + $escaped = !$escaped; + } + if ($escaped) + { + $j = $k + 1; + continue; + } + break; + } + if ($k === false) + { + // error in the query - no end quote; ignore it + break; + } + $literal .= substr($sql, $startPos, $k - $startPos + 1); + $startPos = $k + 1; + } + if ($startPos < $n) + { + $literal .= substr($sql, $startPos, $n - $startPos); + } + + return $literal; + } + + public static function changeHandler() + { + $db = JFactory::getDBO(); + $config = JFactory::getConfig(); + $debug = $config->get('debug'); + $debug ? $log = $db->getLog() : null; + + JFactory::$database = new JDatabaseMightysites(array( + 'driver' => 'mightysites', + 'host' => $config->get('host'), + 'user' => $config->get('user'), + 'password' => $config->get('password'), + 'database' => $config->get('db'), + 'prefix' => $config->get('dbprefix') + )); + + if ($debug) { + $db = JFactory::getDBO(); + $db->setDebug(($debug == 0) ? false : true); + $db->count = sizeof($log); + $db->log = $log; + } + } + } + + JDatabaseMightysites::changeHandler(); +} + +// Overload format +if (defined('JVERSION')) { + if (version_compare(JVERSION, '3.3', 'ge')) { + require_once(dirname(__FILE__).'/format_33.php'); + } + else if (version_compare(JVERSION, '3.0', 'ge')) { + require_once(dirname(__FILE__).'/format_30.php'); + } + else { + require_once(dirname(__FILE__).'/format_25.php'); + } +} diff --git a/deployed/mightysites/plugins/system/mightysites/index.html b/deployed/mightysites/plugins/system/mightysites/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/deployed/mightysites/plugins/system/mightysites/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/deployed/mightysites/plugins/system/mightysites/mightysites.php b/deployed/mightysites/plugins/system/mightysites/mightysites.php new file mode 100644 index 00000000..114a73b2 --- /dev/null +++ b/deployed/mightysites/plugins/system/mightysites/mightysites.php @@ -0,0 +1,579 @@ +isSite()) +{ + class plgSystemMightysites extends plgSystemMightysitesBase + { + // Start single login? + public function onUserLogin($user, $options = array()) + { + $app = JFactory::getApplication(); + + // Not used if we login via our SSI plugin! + if ($app->getCfg('mighty_slogin') && $app->getCfg('mighty_sdomains') && !isset($_REQUEST['mighty_login'])) + { + $_SESSION['mightylogin'] = array( + 'username' => $user['username'], + 'password' => $user['password'], + 'remember' => isset($options['remember']) ? $options['remember'] : 0, + ); + } + } + + // Start single logout? + public function onUserLogout($user, $options = array()) + { + $app = JFactory::getApplication(); + + // Not used if we logout via our SSI plugin! + if ($app->getCfg('mighty_slogout') && $app->getCfg('mighty_sdomains') && !isset($_REQUEST['mighty_logout'])) { + setcookie('mightylogout', 1, time()+3600, '/'); + + // No page cache! At all, othwerwise logout redirect will load cached page. + $this->disableCache(false); + } + } + + // Start single login/logout to other sites! + public function onBeforeCompileHead() + { + $config = JFactory::getConfig(); + $document = JFactory::getDocument(); + + if ($document->getType() == 'html' && isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == 'GET') + { + // Login there + if (isset($_SESSION['mightylogin'])) + { + $user = $_SESSION['mightylogin']; + unset($_SESSION['mightylogin']); + + jimport('joomla.utilities.simplecrypt'); + jimport('joomla.utilities.utility'); + + $domains = $config->get('mighty_sdomains'); + + foreach($domains as $domain => $secret) + { + $key = md5($secret . @$_SERVER['HTTP_USER_AGENT']); + $crypt = new JSimpleCrypt($key); + $hash = base64_encode($crypt->encrypt(serialize($user))); + // possible 'suhosin.get.max_value_length' issue, let's use array + $hash = implode('&mighty_login[]=', str_split($hash, 250)); + + $document->addScript('http://'.$domain.'/index.php?'.md5($_SERVER['REQUEST_TIME']).'=1&mighty_login[]='.$hash, 'text/javascript', true); + } + + // No page cache! + $this->disableCache(); + } + + // Logout there + if (isset($_COOKIE['mightylogout'])) { + setcookie('mightylogout', '', time()-86400, '/'); + + $domains = $config->get('mighty_sdomains'); + + foreach($domains as $domain => $secret) { + $document->addScript('http://'.$domain.'/index.php?mighty_logout=1&'.md5($_SERVER['REQUEST_TIME']).'=1', 'text/javascript', true); + } + + // No page cache! But enable it if previously disabled + $this->disableCache(true); + } + + // Custom CSS files + if ($config->get('mighty_css')) { + foreach((array)$config->get('mighty_css') as $css_file) { + $document->addStylesheet($css_file); + } + } + + // Custom JavaScript + if ($config->get('mighty_js')) { + $document->addScriptDeclaration($config->get('mighty_js')); + } + + // Custom Favicon + if ($config->get('mighty_favicon')) { + foreach($document->_links as $i => $link) { + if ($link['relation'] == 'shortcut icon') { + unset($document->_links[$i]); + } + } + $document->addFavicon($config->get('mighty_favicon')); + } + } + } + + public function onBeforeRender() + { + $config = JFactory::getConfig(); + $document = JFactory::getDocument(); + + if ($document->getType() == 'html') + { + // Remove modules + $mighty_modules = (array)$config->get('mighty_hidemodules'); + + if ($mighty_modules && $mighty_modules != array('')) + { + $mighty_modules = array_flip($mighty_modules); + + if (version_compare(JVERSION, '3.2', 'ge')) { + $rMethod = new ReflectionMethod('JModuleHelper', 'load'); + } else { + $rMethod = new ReflectionMethod('JModuleHelper', '_load'); + } + + $rMethod->setAccessible(true); + $items = $rMethod->invoke(null); + + foreach($items as &$item) { + if (isset($mighty_modules[$item->id]) || isset($mighty_modules[$item->id])) { + $mighty_modules[$item->id] = true; + $item->module = 'unknown'; // ;) + } + } + } + } + } + + public function onAfterDispatch() + { + // Lost database handler? + if (JFactory::getConfig()->get('config.mighty_enable') && get_class(JFactory::$database) != 'JDatabaseMightysites') { + JDatabaseMightysites::changeHandler(); + } + } + + protected function disableCache($plugin_status = null) + { + // Change plugin status + if (isset($plugin_status)) { + $db = JFactory::getDbo(); + + // Disable only if it's currently enabled + if ($plugin_status === false && class_exists('PlgSystemCache')) { + $db->setQuery('UPDATE #__extensions SET `enabled`=0 WHERE `type`="plugin" AND `element`="cache" AND `folder`="system"'); + $db->execute(); + setcookie('mightylogout_cache', 1, time()+3600, '/'); + } + + // Enable only if it was previously disabled + if ($plugin_status === true && isset($_COOKIE['mightylogout_cache'])) { + $db->setQuery('UPDATE #__extensions SET `enabled`=1 WHERE `type`="plugin" AND `element`="cache" AND `folder`="system"'); + $db->execute(); + setcookie('mightylogout_cache', '', time()-86400, '/'); + } + + // Clear system cache + if (JFactory::getConfig()->get('caching') > 0) { + $cache = JFactory::getCache(); + $cache->clean('com_plugins'); + } + } + + // Just disable caching of current page. + if (class_exists('PlgSystemCache')) { + $dispatcher = JDispatcher::getInstance(); + $_methods = $dispatcher->get('_methods'); + foreach($dispatcher->get('_observers') as $oId => $observer) { + if (is_object($observer) && strtolower(get_class($observer)) == 'plgsystemcache') { + foreach($_methods['onafterrender'] as $key => $value) { + if ($value == $oId) { + unset($_methods['onafterrender'][$key]); + $dispatcher->set('_methods', $_methods); + break; + } + } + } + } + } + } + } + + // Implicitely setup language, getLanguage() only next! + if ($lang_code = $config->get('mighty_language')) { + $config->set('language', $lang_code); + + if (version_compare(JVERSION, '3.2', 'ge')) { + // Build our language object + $lang = JLanguage::getInstance($config->get('language'), $config->get('debug_lang')); + + // Load the language to the API + $app->loadLanguage($lang); + + // Register the language object with JFactory + JFactory::$language = $app->getLanguage(); + } + + // Override language in params only if language filter plugin is enabled + if (class_exists('PlgSystemLanguageFilter')) + { + $lparams = JComponentHelper::getParams('com_languages'); + $lparams->set('site', $lang_code); + + $rProperty = new ReflectionProperty('PlgSystemLanguageFilter', 'default_lang'); + $rProperty->setAccessible(true); + $rProperty->setValue('PlgSystemLanguageFilter', $lang_code); + + $rProperty2 = new ReflectionProperty('PlgSystemLanguageFilter', 'default_sef'); + $rProperty2->setAccessible(true); + $rProperty2->setValue('PlgSystemLanguageFilter', substr($lang_code, 0, 2)); // simple, we don't use language->sef + + $rProperty3 = new ReflectionProperty('PlgSystemLanguageFilter', 'cookie'); + $rProperty3->setAccessible(true); + $rProperty3->setValue('PlgSystemLanguageFilter', true); // simple, we don't use language->sef + + // Create a cookie + $cookie_domain = $config->get('config.cookie_domain', ''); + $cookie_path = $config->get('config.cookie_path', '/'); + setcookie(JApplication::getHash('language'), $lang_code, time() + 365 * 86400, $cookie_path, $cookie_domain); + $app->input->cookie->set(JApplication::getHash('language'), $lang_code); + // set the request var + $app->input->set('language', $lang_code); + + // $uri = JFactory::getURI(); + // $uri->setVar('lang', $lang_code); + + } + } + + // Now we can load language, but override it first! + $lang = JFactory::getLanguage(); + + // Implicitely setup template + if ($config->get('mighty_template')) { + $app->input->set('templateStyle', $config->get('mighty_template')); + $app->getTemplate(); + } + + // Implicitely setup home menu item + if ($config->get('mighty_home')) + { + $menu = $app->getMenu(); + if ($menu->getDefault()) { + $menu->getDefault()->home = 0; + } + if ($menu->getDefault($lang->getTag())) { + $menu->getDefault($lang->getTag())->home = 0; + } + $menu->setDefault($config->get('mighty_home'), $lang->getTag()); + $menu->setDefault($config->get('mighty_home'), '*'); + $menu->getDefault()->home = 1; + } + + // Remove menu items + $mighty_menuitems = (array)$config->get('mighty_hidemenus'); + if ($mighty_menuitems && $mighty_menuitems != array('')) + { + $mighty_menuitems = array_flip($mighty_menuitems); + $menu = $app->getMenu(); + + // I hate Joomla sometimes... smbd is crazy on privates which are useless + $rProperty = new ReflectionProperty($menu, '_items'); + $rProperty->setAccessible(true); + $items = $rProperty->getValue($menu); + + foreach($items as $key => &$item) { + if (isset($mighty_menuitems[$item->id]) || isset($mighty_menuitems[$item->id])) { + $mighty_menuitems[$item->id] = true; + unset($items[$key]); + } + } + + $rProperty->setValue($menu, $items); + } + + // Load language overrides, + if ($config->get('mighty_langoverride')) + { + $domain = $_SERVER['HTTP_HOST'] ? $_SERVER['HTTP_HOST'] : $_SERVER['SERVER_NAME']; + $domain = (substr($domain, 0, 4) == 'www.') ? substr($domain, 4) : $domain; + $domain = preg_replace('#([^A-Z0-9])#i', '_', $domain); + + $override_file = JPATH_SITE.'/language/overrides/'.$domain.'.'.$lang->getTag().'.override.ini'; + if (file_exists($override_file)) { + $rProperty = new ReflectionProperty($lang, 'override'); + $rProperty->setAccessible(true); + $override = $rProperty->getValue($lang); + + $rMethod = new ReflectionMethod($lang, 'parse'); + $rMethod->setAccessible(true); + $contents = $rMethod->invoke($lang, $override_file); + + if (is_array($contents)) { + $override = array_merge($override, $contents); + } + + $lang->set('override', $override); + } + } + + // MijoShop ID + if ($config->get('mighty_mijoshopid') !== '') { + $app->input->set('mijoshop_store_id', $config->get('mighty_mijoshopid')); + } +} + +// Backend options +if (JFactory::getApplication()->isAdmin()) +{ + class plgSystemMightysites extends plgSystemMightysitesBase + { + public function onAfterRoute() + { + $app = JFactory::getApplication(); + + if (isset($_REQUEST['mighty_token']) && strlen($_REQUEST['mighty_token'])) { + $token = $app->input->getString('mighty_token'); + $folder = $app->getCfg('tmp_path'); + + jimport('joomla.filesystem.folder'); + jimport('joomla.filesystem.file'); + + $files = JFolder::files($folder, '\.mighty$'); + + if (sizeof($files)) { + $data = false; + foreach($files as $file) { + if ($file == md5($token.$app->getCfg('secret')).'.mighty') { + jimport('joomla.filesystem.file'); + $data = JFile::read($folder.'/'.$file); + } + JFile::delete($folder.'/'.$file); + } + + if ($data) { + $data = unserialize($data); + + if (!JFactory::getUser()->id) { + $user = new JUser(); + $user->load($data['user_id']); + + // try load by username next + if (!$user->id) { + // remove "JUser: :_load: Unable to load user with id: 42" message + $session = JFactory::getSession(); + $session->set('application.queue', null); + + // load other admin by username + $db = JFactory::getDBO(); + $db->setQuery('SELECT id FROM #__users WHERE `username`='.$db->quote($data['username'])); + $user->load($db->loadResult()); + } + + if ($user->id) { + // Mark the user as logged in + $user->set('guest', 0); + + // Register the needed session variables + $session = JFactory::getSession(); + $session->set('user', $user); + + $db = JFactory::getDBO(); + + // Check to see the the session already exists. + $app = JFactory::getApplication(); + $app->checkSession(); + + // Update the user related fields for the Joomla sessions table. + $db->setQuery( + 'UPDATE `#__session`' . + ' SET `guest` = '.$db->quote($user->get('guest')).',' . + ' `username` = '.$db->quote($user->get('username')).',' . + ' `userid` = '.(int) $user->get('id') . + ' WHERE `session_id` = '.$db->quote($session->getId()) + ); + $db->query(); + + // Hit the user last visit field + $user->setLastVisit(); + } + } + + if (strpos($data['return'], 'index.php') === 0) { + $data['return'] = JUri::base(true) . '/' . ltrim($data['return'], '/'); + } + + $app->redirect($data['return']); + } + } + } + } + + public function onAfterDispatch() + { + $app = JFactory::getApplication(); + + // our message from saving modal config + if ($app->input->get('option') == 'com_mightysites') { + if ($app->input->get('mighty_saved')) { + $app->enqueueMessage(JText::sprintf('COM_MIGHTYSITES_CONFIG_UPDATED', $app->input->get('mighty_saved'))); + } + } + + // let's rock + else if ($app->input->get('option') == 'com_config') { + if ($app->input->get('controller') != 'component' && $app->input->get('view') != 'component' && $app->input->get('tmpl') == 'component') { + require_once(JPATH_ADMINISTRATOR.'/components/com_mightysites/helpers/helper.php'); + + $document = JFactory::getDocument(); + + $version = new JVersion; + if ($version->RELEASE == '2.5') { + JToolBarHelper::title(JText::_('COM_CONFIG') . ' :: ' . MightysitesHelper::getHost(), 'config.png'); + + $html = ' +
+
'; + + $toolbar = $document->getBuffer('modules', 'toolbar', array('name'=>'toolbar')); + $toolbar = strtr($toolbar, array( + 'Joomla.submitbutton(\'application.cancel\')' => 'try {window.parent.SqueezeBox.close()} catch(e){self.top.location=\''.base64_decode($app->input->getString('mighty')).'\';}; return false;', + )); + $html .= $toolbar; + + + $html .= $document->getBuffer('modules', 'title', array('name'=>'title')); + $html .= '
+
'; + $html .= $document->getBuffer('modules', 'submenu', array('name'=>'submenu', 'style'=>'rounded', 'id'=>'submenu-box')); + $html .= '
+
'; + + $contents = $document->getBuffer('component'); + $contents = strtr($contents, array( + 'index.php?option=com_config" ' => 'index.php?option=com_config&tmpl=component&mighty='.$app->input->getString('mighty').'" ' + )); + + $html .= $contents; + + $html .= '
+
+
+ '; + } + else { + $html = + ''.JText::_('TPL_ISIS_TOOLBAR').' +
+
+
+
+
+
+ '.JToolBar::getInstance('toolbar')->render('toolbar').' +
+
+
+
+
+ +
+
+

'.JText::_('COM_CONFIG') . ' : ' . MightysitesHelper::getHost().'

+
+
' . + $document->getBuffer('component') . + '
+
+
+
'; + + $html = strtr($html, array( + 'Joomla.submitbutton(\'application.cancel\')' => 'try {window.parent.SqueezeBox.close()} catch(e){self.top.location=\''.base64_decode($app->input->getString('mighty')).'\';}; return false;', // < 3.2 + 'Joomla.submitbutton(\'config.cancel.application\')' => 'try {window.parent.SqueezeBox.close()} catch(e){self.top.location=\''.base64_decode($app->input->getString('mighty')).'\';}; return false;', // 3.2 + JRoute::_('index.php?option=com_config') => JRoute::_('index.php?option=com_config&tmpl=component&mighty='.$app->input->getString('mighty')), + )); + + // Prettify + $document->addStyleDeclaration('html, body {padding:0; margin:0; height:auto;} #sidebar.span2 {display:none;} div.container-fluid.container-main {padding:0;}'); + } + + $document->setBuffer($html, 'component'); + } + } + } + + // Let's run the install queries for the component which already exists. + public function onExtensionBeforeInstall($method, $type, $manifest, $extension) + { + if ($method == 'install' && $type == 'component') { + $element = $this->getComponentName($manifest); + + if (file_exists(JPATH_SITE.'/components/'.$element) || file_exists(JPATH_ADMINISTRATOR.'/components/'.$element)) { + if (isset($manifest->install->sql)) { + $installer = JInstaller::getInstance(); + // Pre-create path to use for getting SQL files + $installer->setPath('extension_root', JPath::clean(JPATH_ADMINISTRATOR . '/components/' . $element)); + + // Don't use rewrite! + $GLOBALS['no_mightysharing'] = true; + + $installer->parseSQLFiles($manifest->install->sql); + + unset($GLOBALS['no_mightysharing']); + } + } + } + } + + protected function getComponentName($manifest) + { + $name = strtolower(JFilterInput::getInstance()->clean((string) $manifest->name, 'cmd')); + + if (substr($name, 0, 4) == 'com_') { + $element = $name; + } else { + $element = 'com_' . $name; + } + + return $element; + } + } +} + +// Shared options. + +// Media Manager overrides. +if ($app->input->get('option') == 'com_media') +{ + $mparams = JComponentHelper::getParams('com_media'); + + if ($config->get('mighty_file_path')) { + $mparams->set('file_path', $config->get('mighty_file_path')); + } + if ($config->get('mighty_image_path')) { + $mparams->set('image_path', $config->get('mighty_image_path')); + } +} + +// Users Manager overrides. +if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == 'POST' && in_array($app->input->get('option'), array('com_users', 'com_comprofiler', 'com_community', 'com_easysocial', 'com_k2'))) +{ + $uparams = JComponentHelper::getParams('com_users'); + + if ($config->get('mighty_new_usertype')) { + $uparams->set('new_usertype', $config->get('mighty_new_usertype')); + } +} diff --git a/deployed/mightysites/plugins/system/mightysites/mightysites.script.php b/deployed/mightysites/plugins/system/mightysites/mightysites.script.php new file mode 100644 index 00000000..592bf183 --- /dev/null +++ b/deployed/mightysites/plugins/system/mightysites/mightysites.script.php @@ -0,0 +1,24 @@ +enqueueMessage(JText::_('Successfully installed "System - MightySites" plugin!')); + } + + function uninstall($parent) { + JFactory::getApplication()->enqueueMessage(JText::_('Successfully uninstalled "System - MightySites" plugin!')); + } + + function update($parent) { + JFactory::getApplication()->enqueueMessage(JText::_('Successfully updated "System - MightySites" plugin!')); + } + +} \ No newline at end of file diff --git a/deployed/mightysites/plugins/system/mightysites/mightysites.xml b/deployed/mightysites/plugins/system/mightysites/mightysites.xml new file mode 100644 index 00000000..936b7627 --- /dev/null +++ b/deployed/mightysites/plugins/system/mightysites/mightysites.xml @@ -0,0 +1,28 @@ + + + PLG_SYSTEM_MIGHTYSITES + + AlterBrains + (C) 2009-2012 AlterBrains. All rights reserved. + GNU General Public License version 2 or later; see LICENSE.txt + alterbrains@gmail.com + http://alterbrains.com + + 12/03/2012 + 2.1.5 + PLG_SYSTEM_MIGHTYSITES_DESC + + + mightysites.php + index.html + + + mightysites.script.php + + + en-GB.plg_system_mightysites.ini + en-GB.plg_system_mightysites.sys.ini + + + + \ No newline at end of file diff --git a/deployed/mightysites/plugins/system/mightysites_single/index.html b/deployed/mightysites/plugins/system/mightysites_single/index.html new file mode 100644 index 00000000..2efb97f3 --- /dev/null +++ b/deployed/mightysites/plugins/system/mightysites_single/index.html @@ -0,0 +1 @@ + diff --git a/deployed/mightysites/plugins/system/mightysites_single/mightysites_single.php b/deployed/mightysites/plugins/system/mightysites_single/mightysites_single.php new file mode 100644 index 00000000..21126a03 --- /dev/null +++ b/deployed/mightysites/plugins/system/mightysites_single/mightysites_single.php @@ -0,0 +1,55 @@ +isAdmin()) { + return; +} + +class plgSystemMightysites_single extends JPlugin +{ + public function onAfterRoute() + { + $app = JFactory::getApplication(); + + if (isset($_GET['mighty_login'])) { + if (!JFactory::getUser()->id) { + ob_start(); + jimport('joomla.utilities.simplecrypt'); + jimport('joomla.utilities.utility'); + + $key = md5(JFactory::getConfig()->get('secret') . @$_SERVER['HTTP_USER_AGENT']); + $crypt = new JSimpleCrypt($key); + $str = $crypt->decrypt(base64_decode(implode('', $app->input->get('mighty_login', array(), 'array')))); + + $credentials = @unserialize($str); + + $app->login($credentials, array( + 'silent' => true, + 'remember' => isset($credentials['remember']) ? $credentials['remember'] : false, + )); + ob_end_clean(); + + header('P3P: CP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM"'); + } + echo '// ', JFactory::getUser()->id; + exit(); + } + + if (isset($_GET['mighty_logout'])) { + if (JFactory::getUser()->id) { + ob_start(); + $result = $app->logout(); + ob_end_clean(); + } + echo '// ', JFactory::getUser()->id; + exit(); + } + } +} + diff --git a/deployed/mightysites/plugins/system/mightysites_single/mightysites_single.script.php b/deployed/mightysites/plugins/system/mightysites_single/mightysites_single.script.php new file mode 100644 index 00000000..31653243 --- /dev/null +++ b/deployed/mightysites/plugins/system/mightysites_single/mightysites_single.script.php @@ -0,0 +1,22 @@ +enqueueMessage(JText::_('Successfully installed "System - MightySites single login/logout" plugin!')); + } + + function uninstall($parent) { + JFactory::getApplication()->enqueueMessage(JText::_('Successfully uninstalled "System - MightySites single login/logout" plugin!')); + } + + function update($parent) { + JFactory::getApplication()->enqueueMessage(JText::_('Successfully updated "System - MightySites single login/logout" plugin!')); + } + +} \ No newline at end of file diff --git a/deployed/mightysites/plugins/system/mightysites_single/mightysites_single.xml b/deployed/mightysites/plugins/system/mightysites_single/mightysites_single.xml new file mode 100644 index 00000000..c155d828 --- /dev/null +++ b/deployed/mightysites/plugins/system/mightysites_single/mightysites_single.xml @@ -0,0 +1,27 @@ + + + PLG_SYSTEM_MIGHTYSITES_SINGLE + + AlterBrains + (C) 2009-2013 AlterBrains. All rights reserved. + GNU General Public License version 2 or later; see LICENSE.txt + alterbrains@gmail.com + http://alterbrains.com + + 12/03/2012 + 2.1.5 + PLG_SYSTEM_MIGHTYSITES_SINGLE_DESC + + + mightysites_single.php + index.html + + + mightysites_single.script.php + + + en-GB.plg_system_mightysites_single.sys.ini + + + + \ No newline at end of file