feat(deployed): add MightySites (no-source, vetted live)

MightySites (AlterBrains, com 3.2.5 / plg 2.1.5); subscription-only, no public download -> deployed files.

Signed-off-by: LÁZÁR Imre <imre@illusion.hu>
Assisted-by: claude-code@claude-opus-4-8
This commit is contained in:
LÁZÁR Imre AI Agent 2026-07-16 11:24:44 +02:00
parent 236e3bf5b6
commit b0ebd8bce3
82 changed files with 8020 additions and 0 deletions

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<access component="com_mightysites">
<section name="component">
<action name="core.admin" title="JACTION_ADMIN" description="JACTION_ADMIN_COMPONENT_DESC" />
<action name="core.manage" title="JACTION_MANAGE" description="JACTION_MANAGE_COMPONENT_DESC" />
<action name="core.create" title="JACTION_CREATE" description="JACTION_CREATE_COMPONENT_DESC" />
<action name="core.delete" title="JACTION_DELETE" description="JACTION_DELETE_COMPONENT_DESC" />
<action name="core.edit" title="JACTION_EDIT" description="JACTION_EDIT_COMPONENT_DESC" />
<action name="core.edit.state" title="JACTION_EDITSTATE" description="JACTION_EDITSTATE_COMPONENT_DESC" />
</section>
</access>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<config>
<fieldset name="permissions" description="JCONFIG_PERMISSIONS_DESC" label="JCONFIG_PERMISSIONS_LABEL">
<field name="rules" type="rules" component="com_mightysites" filter="rules" validate="rules" label="JCONFIG_PERMISSIONS_LABEL" section="component" />
</fieldset>
</config>

View File

@ -0,0 +1,57 @@
<?php
/**
* @package Mightysites
* @copyright Copyright (C) 2009-2013 AlterBrains.com. All rights reserved.
* @license GNU/GPL, see LICENSE.php
*/
defined('_JEXEC') or die;
class MightysitesController extends JControllerLegacy
{
protected $default_view = 'sites';
public function display($cachable = false, $urlparams = false)
{
$app = JFactory::getApplication();
$view = $app->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;
}
}

View File

@ -0,0 +1,36 @@
<?php
/**
* @package Mightysites
* @copyright Copyright (C) 2009-2013 AlterBrains.com. All rights reserved.
* @license GNU/GPL, see LICENSE.php
*/
defined('_JEXEC') or die('Restricted access');
class MightysitesControllerAbout extends JControllerLegacy
{
public function version()
{
$app = JFactory::getApplication();
$current = str_replace('.', '', $app->input->get('current'));
$version = new JVersion();
$url = 'http://alterbrains.com/version?id=pkg_mightysites&release='.$version->RELEASE;
if (!($latest = @file_get_contents($url))) {
echo '<span style="color:red">', JText::_('COM_MIGHTYSITES_VERSION_ERROR'), '</span>';
}
else {
if (str_replace('.', '', $latest) == $current) {
echo '<span style="color:green">', JText::_('COM_MIGHTYSITES_VERSION_CURRENT'), '</span>';
}
else {
echo '<span style="color:red">', JText::sprintf('COM_MIGHTYSITES_VERSION_LATEST', $latest), '</span><br /><br />', JText::sprintf('COM_MIGHTYSITES_VISIT_DADDY', '<a href="http://alterbrains.com" target="_blank">http://alterbrains.com</a>.');
}
}
jexit();
}
}

View File

@ -0,0 +1,312 @@
<?php
/**
* @package Mightysites
* @copyright Copyright (C) 2009-2013 AlterBrains.com. All rights reserved.
* @license GNU/GPL, see LICENSE.php
*/
defined('_JEXEC') or die('Restricted access');
jimport('joomla.application.component.controllerform');
class MightysitesControllerDatabase extends JControllerForm
{
public function getModel($name = 'Database', $prefix = 'MightysitesModel', $config = array('ignore_request' => 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 '<span style="color:red">', JText::_('COM_MIGHTYSITES_ERROR_INVALID_USER'), '</span>';
}
else {
$db->setQuery('CREATE DATABASE `'.$dbname.'` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci');
try {
$db->execute();
}
catch (RuntimeException $e) {
echo '<span style="color:red">', JText::sprintf('COM_MIGHTYSITES_ERROR_CUSTOM', $db->getErrorMsg()), '</span>';
exit();
}
echo '<span style="color:green">', JText::sprintf('COM_MIGHTYSITES_DATABASE_CREATED', $dbname), '</span>';
}
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 '<span style="color:red">', JText::_('COM_MIGHTYSITES_ERROR_INVALID_USER'), '</span>';
} else {
if (!mysql_select_db($db, $link)) {
echo '<span style="color:red">', JText::sprintf('COM_MIGHTYSITES_ERROR_CUSTOM', mysql_error($link)), '</span>';
} else {
if ($type == 1) {
if ($id) {
echo '<span style="color:green">', JText::_('COM_MIGHTYSITES_CONNECTED'), '</span>';
} else {
if (mysql_query('SELECT COUNT(*) FROM '.$dbprefix.'users', $link)) {
echo '<span style="color:red">', JText::sprintf('COM_MIGHTYSITES_ERROR_TABLES_EXIST', $dbprefix, $db), '</span>';
} else {
echo '<span style="color:green">', JText::_('COM_MIGHTYSITES_CONNECTED'), '</span>';
}
}
}
if ($type == 2) {
if (!mysql_query('SELECT COUNT(*) FROM '.$dbprefix.'users', $link)) {
echo '<span style="color:red">', JText::sprintf('COM_MIGHTYSITES_ERROR_NO_TABLES_EXIST', $dbprefix, $db), '</span>';
} else {
echo '<span style="color:green">', JText::_('COM_MIGHTYSITES_CONNECTED'), '</span>';
}
}
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 '<h1>', JText::sprintf('COM_MIGHTYSITES_CREATING_TABLE', ($table+1), sizeof($tables_views), $dest_table), '</h1>';
echo '<h3>', JText::sprintf('COM_MIGHTYSITES_SOURCE_DATABASE', $from->db, $from->dbprefix), '</h3>';
echo '<h3>', JText::sprintf('COM_MIGHTYSITES_DEST_DATABASE', $to->db, $to->dbprefix), '</h3>';
echo '<h3 style="text-decoration:blink">', JText::_('COM_MIGHTYSITES_PLEASE_WAIT', $to->db, $to->dbprefix), '</h3>';
$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().'<br/>';
}
if (!$db2->execute()) {
die('<span style="color:red">'.$db2->getErrorMsg().'</span>');
}
// 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().'<br/>';
}
if (!$db2->execute()) {
// can't copy view
if ($db2->getErrorNum() == 1347) {
// todo - probably do smth here
}
echo '<p style="color:red">'.$db2->getErrorMsg().'</p>';
$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().'<br/>';
}
if (!$db2->execute()) {
echo '<span style="color:red">'.$db2->getErrorMsg().'</span>';
$error = true;
}
}
}
$table++;
// Finish
if ($table == sizeof($tables_views)) {
if ($tmpl == 'component') {?>
<script type="text/javascript" language="javascript">
window.parent.SqueezeBox.close();
alert('<?php echo JText::sprintf('COM_MIGHTYSITES_TABLES_CREATED', $to->db, $to->dbprefix);?>');
</script>
<?php
exit();
} else {
$this->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 '<a href="', $link, '">', JText::_('COM_MIGHTYSITES_CONTINUE'), '</a>';
}
}
}
protected function restoreDB()
{
JFactory::$database = null;
}
}

View File

@ -0,0 +1,99 @@
<?php
/**
* @package Mightysites
* @copyright Copyright (C) 2009-2013 AlterBrains.com. All rights reserved.
* @license GNU/GPL, see LICENSE.php
*/
defined('_JEXEC') or die('Restricted access');
jimport('joomla.application.component.controlleradmin');
class MightysitesControllerDatabases extends JControllerAdmin
{
protected $text_prefix = 'COM_MIGHTYSITES_DATABASES';
public function getModel($name = 'Database', $prefix = 'MightysitesModel', $config = array('ignore_request' => 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();
}
}

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,68 @@
<?php
/**
* @package Mightysites
* @copyright Copyright (C) 2009-2013 AlterBrains.com. All rights reserved.
* @license GNU/GPL, see LICENSE.php
*/
defined('_JEXEC') or die('Restricted access');
jimport('joomla.application.component.controllerform');
class MightysitesControllerSite extends JControllerForm
{
public function getModel($name = 'Site', $prefix = 'MightysitesModel', $config = array('ignore_request' => 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 '<h1>', JText::_('COM_MIGHTYSITES_ERROR'), '</h1>';
echo '<p>', JText::sprintf('COM_MIGHTYSITES_CANT_WRITE_FILE', $fname), '</p>';
die;
}
$link = 'http://'.$domain.'/administrator/index.php?mighty_token='.$token;
$this->setRedirect($link);
}
}

View File

@ -0,0 +1,209 @@
<?php
/**
* @package Mightysites
* @copyright Copyright (C) 2009-2013 AlterBrains.com. All rights reserved.
* @license GNU/GPL, see LICENSE.php
*/
defined('_JEXEC') or die('Restricted access');
jimport('joomla.application.component.controlleradmin');
jimport('joomla.filesystem.file');
jimport('joomla.filesystem.path');
jimport('joomla.client.helper');
class MightysitesControllerSites extends JControllerAdmin
{
protected $text_prefix = 'COM_MIGHTYSITES_SITES';
public function getModel($name = 'Site', $prefix = 'MightysitesModel', $config = array('ignore_request' => 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();
}
}

View File

@ -0,0 +1,629 @@
<?php
/**
* @package Mightysites
* @copyright Copyright (C) 2009-2013 AlterBrains.com. All rights reserved.
* @license GNU/GPL, see LICENSE.php
*/
defined('_JEXEC') or die('Restricted access');
jimport('joomla.filesystem.file');
abstract class MightysitesHelper
{
private static $dbo;
public static function getHost()
{
static $domain;
if (!$domain) {
$domain = $_SERVER['HTTP_HOST'] ? $_SERVER['HTTP_HOST'] : $_SERVER['SERVER_NAME'];
$domain = (substr($domain, 0, 4) == 'www.') ? substr($domain, 4) : $domain;
if (strpos($domain, ':') !== false) {
list($domain, $tmp) = explode(':', $domain);
}
}
return $domain;
}
public static function getSynchs($type = null)
{
$custom = array(
'js',
'cb',
'mtree',
'sobi2',
'sobipro',
'gridiron',
'uddeim',
'zoo',
'dtregister',
'easyblog',
'joomsport',
'rsform',
'rsfiles',
'acymailing',
'jce',
'adsmanager',
'joomshopping',
'kunena',
'k2',
'pf',
'jcp',
'enmasse',
'phocadownload',
'phocagallery',
'jreviews',
'virtuemart',
'virtuemart_no_config',
'jevents',
'hwdms',
'admintools',
'ak',
'akeebasubs',
'feedgator',
'jxtc_ezimg',
'invitex',
'jbolo',
'jxtc_appbook',
'jxtc_albumplayer',
'geo',
'jxtc_powertabs',
'payplans',
'jxtc_readinglist',
'ad',
'locator',
'pin',
'hikashop',
'docman',
'swmenu',
'virtueuploads',
'djcf',
'chronoforms',
'eventlist',
'fpss',
'imageshow',
'uniform',
'widgetkit',
'listbingo',
'redshop',
'jvle',
'bfstop',
'komento',
'jsn_poweradmin',
'securitycheck',
'expautos',
'mijosearch',
'advancedmodules',
'jck',
'rereplacer',
'magebridge',
'preachit',
'osmembership',
'mijosef',
'osemsc',
'easydiscuss',
'hsusers',
'quiz',
'muscol',
'allvideoshare',
'fua',
'joaktree',
'rsticketspro',
'acesef',
'aup',
'vq',
'fsf_faq',
'spidercalendar',
'jcomments',
'mem',
'paidsystem',
'hikamarket',
'rsmembership',
'jfbconnect',
'adagency',
'fw_realestate',
'iproperty',
'mijoshop',
'snippets',
'zhgooglemap',
'cddir',
'ajaxregister',
'jmap',
'emerald',
'rseventspro',
'jblance',
'xmap',
'j2store',
'js_no_config',
'lovefactory',
'social',
'auctionfactory',
'hdwplayer',
'jomcl',
'regreminder',
'flexicontact',
'comment',
'xtdir',
'offlajn',
'jobsfactory',
'vmvendor',
'eshop',
'flexicontent',
'cmgroupbuying',
'joomgallery',
'joomgalaxy',
'jdownloads',
'jsn',
'icagenda',
'booking',
'cobalt',
'vikappointments',
'joomcareer',
'kart',
'tjfields',
'guru',
// to be continued...
);
// Apply plugins
JFactory::getApplication()->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(
'<?php'."\n" => "\n",
'<?php'."\r\n" => "\r\n",
'<?php'."\r" => "\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 = '<?php require_once(__DIR__.\'/components/com_mightysites/mightysites.php\');';
if (file_get_contents($file) != $str)
{
$app = JFactory::getApplication();
// Load our language, it can be missed if we call method in com_config
JFactory::getLanguage()->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 = '<?php
define(\'MIGHTY_DOMAIN\', \''.self::prepareDomain($master_domain).'\');
define(\'MIGHTY_CONFIG\', __DIR__ . \'/configuration_'.self::prepareDomain($master_domain).'.php\');
require_once(MIGHTY_CONFIG);';
if (!JFile::write($default_file, $default_str))
{
$app->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');
}
}
}

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 217 B

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,35 @@
<?php
/**
* @package Mightysites
* @copyright Copyright (C) 2009-2013 AlterBrains.com. All rights reserved.
* @license GNU/GPL, see LICENSE.php
*/
defined('_JEXEC') or die;
@ini_set('max_execution_time', '10000');
@set_time_limit(10000);
@ignore_user_abort(true);
// Access check.
if (!JFactory::getUser()->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();

View File

@ -0,0 +1,139 @@
<?php
/**
* @package MightySites
* @copyright Copyright (C) 2009-2013 AlterBrains.com. All rights reserved.
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
defined('JPATH_BASE') or die;
class com_MightysitesInstallerScript
{
function postflight($type, $parent)
{
$db = JFactory::getDBO();
// Check PHP version
if (version_compare(PHP_VERSION, '5.3.0') < 0) {
JFactory::getApplication()->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');
}
}
}
}

View File

@ -0,0 +1,54 @@
<?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="2.5" method="upgrade">
<name>MightySites</name>
<description>Joomla multi-site manager.</description>
<author>AlterBrains</author>
<copyright>(C) 2009-2014 AlterBrains. All rights reserved.</copyright>
<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
<authorEmail>alterbrains@gmail.com</authorEmail>
<authorUrl>http://alterbrains.com</authorUrl>
<creationDate>09/03/2014</creationDate>
<version>3.2.5</version>
<install>
<sql>
<file driver="mysql" charset="utf8">sql/install.mysql.utf8.sql</file>
</sql>
</install>
<files folder="site">
<filename>index.html</filename>
<filename>format_25.php</filename>
<filename>format_30.php</filename>
<filename>format_33.php</filename>
<filename>mightysites.php</filename>
<folder>configuration</folder>
</files>
<administration>
<menu img="components/com_mightysites/images/icon_16.png">MightySites</menu>
<files folder="admin">
<folder>controllers</folder>
<folder>helpers</folder>
<folder>images</folder>
<folder>models</folder>
<folder>sql</folder>
<folder>tables</folder>
<folder>views</folder>
<filename>index.html</filename>
<filename>controller.php</filename>
<filename>mightysites.php</filename>
<filename>access.xml</filename>
<filename>config.xml</filename>
</files>
<languages>
<language tag="en-GB">admin/language/en-GB.com_mightysites.ini</language>
<language tag="en-GB">admin/language/en-GB.com_mightysites.sys.ini</language>
</languages>
</administration>
<scriptfile>mightysites.script.php</scriptfile>
</extension>

View File

@ -0,0 +1,125 @@
<?php
/**
* @package Mightysites
* @copyright Copyright (C) 2009-2013 AlterBrains.com. All rights reserved.
* @license GNU/GPL, see LICENSE.php
*/
defined('_JEXEC') or die;
jimport('joomla.application.component.modeladmin');
class MightysitesModelDatabase extends JModelAdmin
{
protected $text_prefix = 'COM_MIGHTYSITES_DATABASES_';
protected function canDelete($record)
{
if (!empty($record->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;
}
}

View File

@ -0,0 +1,123 @@
<?php
/**
* @package Mightysites
* @copyright Copyright (C) 2009-2013 AlterBrains.com. All rights reserved.
* @license GNU/GPL, see LICENSE.php
*/
defined('_JEXEC') or die;
jimport('joomla.application.component.modellist');
class MightysitesModelDatabases extends JModelList
{
public function __construct($config = array())
{
if (empty($config['filter_fields'])) {
$config['filter_fields'] = array(
'id', 'a.id',
'domain', 'a.domain',
'db', 'a.db',
'dbprefix', 'a.dbprefix',
);
}
parent::__construct($config);
}
protected function populateState($ordering = null, $direction = null)
{
$app = JFactory::getApplication('administrator');
// Load the filter state.
$search = $this->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;
}
}

View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>

View File

@ -0,0 +1,32 @@
<?php
/**
* @package Mightysites
* @copyright Copyright (C) 2009-2013 AlterBrains.com. All rights reserved.
* @license GNU/GPL, see LICENSE.php
*/
defined('JPATH_PLATFORM') or die;
JFormHelper::loadFieldClass('list');
class JFormFieldMightydatabase extends JFormFieldList
{
protected $type = 'Mightydatabase';
protected function getOptions()
{
$options = array();
$sites = MightysitesHelper::getDatabases();
foreach ($sites as $site) {
$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;
}
}

View File

@ -0,0 +1,34 @@
<?php
/**
* @package Mightysites
* @copyright Copyright (C) 2009-2013 AlterBrains.com. All rights reserved.
* @license GNU/GPL, see LICENSE.php
*/
defined('JPATH_PLATFORM') or die;
JFormHelper::loadFieldClass('list');
class JFormFieldMightysite extends JFormFieldList
{
protected $type = 'Mightysite';
protected function getOptions()
{
$options = array();
$sites = MightysitesHelper::getSites();
foreach ($sites as $site) {
if ($site->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;
}
}

View File

@ -0,0 +1,66 @@
<?php
/**
* @package Mightysites
* @copyright Copyright (C) 2009-2013 AlterBrains.com. All rights reserved.
* @license GNU/GPL, see LICENSE.php
*/
defined('JPATH_PLATFORM') or die;
JFormHelper::loadFieldClass('list');
/**
* Form Field class for the Joomla Platform.
* Supports a list of installed application languages
*
* @package Joomla.Platform
* @subpackage Form
* @see JFormFieldContentLanguage for a select list of content languages.
* @since 11.1
*/
class JFormFieldTemplatestyle extends JFormFieldList
{
/**
* The form field type.
*
* @var string
* @since 11.1
*/
protected $type = 'Templatestyle';
/**
* Method to get the field options.
*
* @return array The field option objects.
*
* @since 11.1
*/
protected function getOptions()
{
$options = array();
$db = JFactory::getDBO();
$query = 'SELECT id, template, title FROM #__template_styles WHERE client_id=0 ORDER BY template, title';
$db->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;
}
}

View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<form>
<fieldset addfieldpath="/administrator/components/com_mightysites/models/fields">
<field name="id" type="text" default="0" label="JGLOBAL_FIELD_ID_LABEL"
readonly="true" class="readonly"
description="JGLOBAL_FIELD_ID_DESC"/>
<field name="domain" type="text" size="40" required="true"
label="COM_MIGHTYSITES_FIELD_DATABASE_TITLE" description="COM_MIGHTYSITES_FIELD_DATABASE_TITLE_DESC" />
<field name="source_db" type="mightydatabase"
label="COM_MIGHTYSITES_FIELD_SOURCE_DB" description="COM_MIGHTYSITES_FIELD_SOURCE_DB_DESC"
>
<option value="">COM_MIGHTYSITES_SELECT_DATABASE</option>
</field>
</fieldset>
<fieldset name="database">
<field name="db" type="text" size="40" required="true"
label="COM_MIGHTYSITES_FIELD_DB" description="COM_MIGHTYSITES_FIELD_DB_DESC" />
<field name="dbprefix" type="text" size="40" required="true"
label="COM_MIGHTYSITES_FIELD_DBPREFIX" description="COM_MIGHTYSITES_FIELD_DBPREFIX_DESC" />
</fieldset>
<fields name="params">
</fields>
</form>

View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>

View File

@ -0,0 +1,144 @@
<?xml version="1.0" encoding="utf-8"?>
<form>
<fieldset addfieldpath="/administrator/components/com_mightysites/models/fields">
<field name="id" type="text" default="0" label="JGLOBAL_FIELD_ID_LABEL"
readonly="true" class="readonly"
description="JGLOBAL_FIELD_ID_DESC"/>
<field name="domain" type="text" size="40" required="true"
label="COM_MIGHTYSITES_FIELD_DOMAIN" description="COM_MIGHTYSITES_FIELD_DOMAIN_DESC" />
<field name="aliases" type="textarea" default="" cols="40" rows="5" class="input-xxlarge" filter="raw"
label="COM_MIGHTYSITES_FIELD_ALIASES" description="COM_MIGHTYSITES_FIELD_ALIASES_DESC" />
<field name="source_config" type="mightysite" database="false" required="true"
label="COM_MIGHTYSITES_FIELD_SOURCE_CONFIG" description="COM_MIGHTYSITES_FIELD_SOURCE_CONFIG_DESC">
<option value="">COM_MIGHTYSITES_SELECT_SITE</option>
</field>
<field name="source_db" type="mightydatabase"
label="COM_MIGHTYSITES_FIELD_SOURCE_DB" description="COM_MIGHTYSITES_FIELD_SOURCE_DB_DESC">
<option value="">COM_MIGHTYSITES_SELECT_DATABASE</option>
</field>
</fieldset>
<fieldset name="database">
<field name="db" type="text" size="40" required="true"
label="COM_MIGHTYSITES_FIELD_DB" description="COM_MIGHTYSITES_FIELD_DB_DESC" />
<field name="dbprefix" type="text" size="40" required="true"
label="COM_MIGHTYSITES_FIELD_DBPREFIX" description="COM_MIGHTYSITES_FIELD_DBPREFIX_DESC" />
<field name="user" type="text" size="40" required="true"
label="COM_MIGHTYSITES_FIELD_USER" description="COM_MIGHTYSITES_FIELD_USER_DESC" />
<field name="password" type="password" size="40" autocomplete="off" filter="raw"
label="COM_MIGHTYSITES_FIELD_PASSWORD" description="COM_MIGHTYSITES_FIELD_PASSWORD_DESC" />
<field name="dbtype" type="databaseconnection" class="input-medium" filter="string" required="true" default="mysql"
label="COM_MIGHTYSITES_FIELD_DBTYPE" description="COM_MIGHTYSITES_FIELD_DBTYPE_DESC" />
</fieldset>
<fields name="params">
<fieldset name="overrides">
<field name="language" type="language" default="" client="client"
label="COM_MIGHTYSITES_FIELD_LANGUAGE" description="COM_MIGHTYSITES_FIELD_LANGUAGE_DESC"
>
<option value="">JOPTION_USE_DEFAULT</option>
</field>
<field name="template" type="text" default="" size="6" class="input-mini"
label="COM_MIGHTYSITES_FIELD_TEMPLATE" description="COM_MIGHTYSITES_FIELD_TEMPLATE_DESC"
>
<option value="">JOPTION_USE_DEFAULT</option>
</field>
<field name="home" type="text" default="" size="6" class="input-mini"
label="COM_MIGHTYSITES_FIELD_HOMEPAGE" description="COM_MIGHTYSITES_FIELD_HOMEPAGE_DESC"
>
<option value="">JOPTION_USE_DEFAULT</option>
</field>
<field name="langoverride" type="radio" default="0" class="btn-group"
label="COM_MIGHTYSITES_FIELD_LANGOVERRIDE" description="COM_MIGHTYSITES_FIELD_LANGOVERRIDE_DESC"
>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field name="favicon" type="text" default="" size="50" class="input-xxlarge"
label="COM_MIGHTYSITES_FIELD_FAVICON" description="COM_MIGHTYSITES_FIELD_FAVICON_DESC" />
<field name="hidemenus" type="menuitem" size="15" multiple="true" class="input-xxlarge"
label="COM_MIGHTYSITES_FIELD_REMOVE_MENUITEMS" description="COM_MIGHTYSITES_FIELD_REMOVE_MENUITEMS_DESC">
<option value="">JNONE</option>
</field>
<field name="hidemodules" type="sql" size="15" multiple="true" class="input-xxlarge" query="SELECT id, CONCAT(position, ' :: ', title) AS name FROM #__modules WHERE position != '' AND client_id=0 ORDER BY position, title" key_field="id" value_field="name"
label="COM_MIGHTYSITES_FIELD_REMOVE_MODULES" description="COM_MIGHTYSITES_FIELD_REMOVE_MODULES_DESC">
<option value="">JNONE</option>
</field>
<field name="custom_css" type="textarea" default="" cols="40" rows="5" class="input-xxlarge" filter="raw"
label="COM_MIGHTYSITES_FIELD_CSS" description="COM_MIGHTYSITES_FIELD_CSS_DESC" />
<field name="custom_js" type="textarea" default="" cols="40" rows="5" class="input-xxlarge" filter="raw"
label="COM_MIGHTYSITES_FIELD_JS" description="COM_MIGHTYSITES_FIELD_JS_DESC" />
<field name="cache_path" type="text" default="" size="50" class="input-xxlarge"
label="COM_MIGHTYSITES_FIELD_CACHE_PATH" description="COM_MIGHTYSITES_FIELD_CACHE_PATH_DESC" />
<field name="file_path" type="text" default="" size="50" class="input-xxlarge"
label="COM_MIGHTYSITES_FIELD_FILE_PATH" description="COM_MIGHTYSITES_FIELD_FILE_PATH_DESC" />
<field name="image_path" type="text" default="" size="50" class="input-xxlarge"
label="COM_MIGHTYSITES_FIELD_IMAGE_PATH" description="COM_MIGHTYSITES_FIELD_IMAGE_PATH_DESC" />
<field name="new_usertype" type="sql" default="" query="SELECT id, title FROM #__usergroups ORDER BY lft" key_field="id" value_field="title"
label="COM_MIGHTYSITES_FIELD_NEW_USERTYPE" description="COM_MIGHTYSITES_FIELD_NEW_USERTYPE_DESC">
<option value="">JOPTION_USE_DEFAULT</option>
</field>
</fieldset>
<fieldset name="replacements">
<field name="enable_replacements" type="radio" default="0" class="btn-group"
label="COM_MIGHTYSITES_FIELD_ENABLE_REPLACEMENTS" description="COM_MIGHTYSITES_FIELD_ENABLE_REPLACEMENTS_DESC">
<option value="0">JDISABLED</option>
<option value="1">JENABLED</option>
</field>
</fieldset>
<fieldset name="single">
<field name="single_login" type="radio" default="0" class="btn-group"
label="COM_MIGHTYSITES_FIELD_SINGLE_LOGIN" description="COM_MIGHTYSITES_FIELD_SINGLE_LOGIN_DESC" >
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field name="single_logout" type="radio" default="0" class="btn-group"
label="COM_MIGHTYSITES_FIELD_SINGLE_LOGOUT" description="COM_MIGHTYSITES_FIELD_SINGLE_LOGOUT_DESC">
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
</fieldset>
<fieldset name="advanced">
<field name="secret" type="text" size="40"
label="COM_MIGHTYSITES_FIELD_SECRET" description="COM_MIGHTYSITES_FIELD_SECRET_DESC" />
<field name="cookie_domain" type="text" size="40"
label="COM_MIGHTYSITES_FIELD_COOKIE_DOMAIN" description="COM_MIGHTYSITES_FIELD_COOKIE_DOMAIN_DESC" />
<field name="mijoshopid" type="text" size="5" class="input-mini"
label="COM_MIGHTYSITES_FIELD_MIJOSHOPID" description="COM_MIGHTYSITES_FIELD_MIJOSHOPID_DESC" />
</fieldset>
</fields>
</form>

View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,121 @@
<?php
/**
* @package Mightysites
* @copyright Copyright (C) 2009-2013 AlterBrains.com. All rights reserved.
* @license GNU/GPL, see LICENSE.php
*/
defined('_JEXEC') or die;
jimport('joomla.application.component.modellist');
class MightysitesModelSites extends JModelList
{
public function __construct($config = array())
{
if (empty($config['filter_fields'])) {
$config['filter_fields'] = array(
'id', 'a.id',
'domain', 'a.domain',
'db', 'a.db',
'dbprefix', 'a.dbprefix',
);
}
parent::__construct($config);
}
protected function populateState($ordering = null, $direction = null)
{
$app = JFactory::getApplication('administrator');
// Load the filter state.
$search = $this->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;
}
}

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -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 ;

View File

@ -0,0 +1,51 @@
<?php
/**
* @package Mightysites
* @copyright Copyright (C) 2009-2013 AlterBrains.com. All rights reserved.
* @license GNU/GPL, see LICENSE.php
*/
defined('_JEXEC') or die('Restricted access');
class MightysitesTableDatabase extends JTable
{
public function __construct(&$db)
{
parent::__construct('#__mightysites', 'id', $db);
}
public function bind($array, $ignore = '')
{
if (isset($array['params']) && is_array($array['params'])) {
$registry = new JRegistry();
$registry->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;
}
}

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,113 @@
<?php
/**
* @package Mightysites
* @copyright Copyright (C) 2009-2013 AlterBrains.com. All rights reserved.
* @license GNU/GPL, see LICENSE.php
*/
defined('_JEXEC') or die('Restricted access');
class MightysitesTableSite extends JTable
{
public function __construct(&$db)
{
parent::__construct('#__mightysites', 'id', $db);
}
public function bind($array, $ignore = '')
{
if (isset($array['params']) && is_array($array['params'])) {
$registry = new JRegistry();
$registry->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;
}
}

View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>

View File

@ -0,0 +1,72 @@
<?php
/**
* @package Mightysites
* @copyright Copyright (C) 2009-2013 AlterBrains.com. All rights reserved.
* @license GNU/GPL, see LICENSE.php
*/
defined('_JEXEC') or die('Restricted access');
JHTML::_('behavior.tooltip');
$this->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;
}
}
}
?>
<script type="text/javascript">
function checkVersion() {
document.id('versionButton').disabled = true;
document.id('versionSpinner').style.display = 'block';
document.id('versionDiv').innerHTML = '';
new Request.HTML({
url: 'index.php?option=com_mightysites&task=about.version&current=<?php echo $component->version;?>',
method: 'get',
update: document.id('versionDiv'),
onComplete: function(resp) {
document.id('versionSpinner').style.display = 'none';
document.id('versionButton').disabled = false;
}
}).send();
}
</script>
<form name="adminForm">
<?php if(!empty( $this->sidebar)): ?>
<div id="j-sidebar-container" class="span2">
<?php echo $this->sidebar; ?>
</div>
<div id="j-main-container" class="span10">
<?php else : ?>
<div id="j-main-container">
<?php endif;?>
<img src="components/com_mightysites/images/mightysites.png" alt="" align="left" />
<table cellpadding="10" cellspacing="0">
<tr valign="top">
<td width="1%" nowrap="nowrap"><b><?php echo JText::_('COM_MIGHTYSITES_YOUR_VERSION');?></b></td>
<td><?php echo $component->version;?></td>
</tr>
<tr valign="top">
<td><input type="button" class="btn" value="<?php echo JText::_('COM_MIGHTYSITES_CHECK_LATEST_VERSION');?>" onclick="checkVersion()" id="versionButton" /></td>
<td>
<div class="progress progress-striped active" id="versionSpinner" style="display:none; width:100px;">
<div class="bar" style="width: 100%;"></div>
</div>
<span id="versionDiv"></span>
</td>
</tr>
</table>
</div>
</form>

View File

@ -0,0 +1,59 @@
<?php
/**
* @package Mightysites
* @copyright Copyright (C) 2009-2013 AlterBrains.com. All rights reserved.
* @license GNU/GPL, see LICENSE.php
*/
defined('_JEXEC') or die('Restricted access');
JHTML::_('behavior.tooltip');
$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;
}
}
}
?>
<script type="text/javascript">
function checkVersion() {
document.id('versionButton').disabled = true;
document.id('versionSpinner').style.visibility = 'visible';
new Request.HTML({
url: 'index.php?option=com_mightysites&task=about.version&current=<?php echo $component->version;?>',
method: 'get',
update: document.id('versionDiv'),
onComplete: function(resp) {
document.id('versionSpinner').style.visibility = 'hidden';
document.id('versionButton').disabled = false;
}
}).send();
}
</script>
<form name="adminForm">
<div class="width-60">
<fieldset class="adminform">
<img src="components/com_mightysites/images/mightysites.png" alt="" align="left" />
<table cellpadding="10" cellspacing="0">
<tr valign="top">
<td width="1%" nowrap="nowrap"><b><?php echo JText::_('COM_MIGHTYSITES_YOUR_VERSION');?></b></td>
<td><?php echo $component->version;?></td>
</tr>
<tr valign="top">
<td><input type="button" class="button" value="<?php echo JText::_('COM_MIGHTYSITES_CHECK_LATEST_VERSION');?>" onclick="checkVersion()" id="versionButton" />
&nbsp;
<img src="../media/system/images/mootree_loader.gif" alt="" id="versionSpinner" style="visibility:hidden" align="top" />
</td>
<td><span id="versionDiv"></span></td>
</tr>
</table>
</fieldset>
</div>
</form>

View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>

View File

@ -0,0 +1,35 @@
<?php
/**
* @package Mightysites
* @copyright Copyright (C) 2009-2013 AlterBrains.com. All rights reserved.
* @license GNU/GPL, see LICENSE.php
*/
defined('_JEXEC') or die();
class MightySitesViewAbout extends JViewLegacy
{
public function display($tpl = null)
{
$this->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();
}
}

View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>

View File

@ -0,0 +1,144 @@
<?php
/**
* @package Mightysites
* @copyright Copyright (C) 2009-2013 AlterBrains.com. All rights reserved.
* @license GNU/GPL, see LICENSE.php
*/
defined('_JEXEC') or die;
JHtml::_('behavior.tooltip');
JHtml::_('behavior.formvalidation');
JHtml::_('formbehavior.chosen', 'select');
JHtml::_('behavior.tabstate');
?>
<script language="javascript" type="text/javascript">
Joomla.submitbutton = function(task)
{
if (task == 'database.cancel' || document.formvalidator.isValid(document.id('database-form'))) {
Joomla.submitform(task, document.id('database-form'));
}
else {
alert('<?php echo $this->escape(JText::_('JGLOBAL_VALIDATION_FORM_FAILED'));?>');
}
}
function checkConnection(type) {
var form = document.id('database-form');
document.id('checkWaiter').style.visibility = 'visible';
document.id('checkButton').disabled = true;
document.id('createInfo') ? document.id('createInfo').innerHTML = '' : null;
new Request.HTML({
url: '<?php echo JRoute::_('index.php'); ?>',
update: 'checkInfo',
noCache: true,
data: {
option: 'com_mightysites',
task: 'database.check',
db: document.id('jform_db').value,
dbprefix: document.id('jform_dbprefix').value,
id: <?php echo (int)$this->item->id;?>,
type: type,
'<?php echo JSession::getFormToken();?>': '1'
},
onSuccess: function() {
document.id('checkWaiter').style.visibility = 'hidden';
document.id('checkButton').disabled = false;
}
}).send();
}
function createDatabase() {
var form = document.id('database-form');
var text = '<?php echo JText::sprintf('COM_MIGHTYSITES_REALLY_CREATE_DB', '________');?>';
if (confirm(text.replace(/________/, document.id('jform_db').value))) {
document.id('createWaiter').style.visibility = 'visible';
document.id('createButton').disabled = true;
document.id('createInfo').innerHTML = '';
new Request.HTML({
url: '<?php echo JRoute::_('index.php'); ?>',
update: 'createInfo',
noCache: true,
data: {
option: 'com_mightysites',
task: 'database.create',
db: document.id('jform_db').value,
'<?php echo JSession::getFormToken();?>': '1'
},
onSuccess: function() {
document.id('createWaiter').style.visibility = 'hidden';
document.id('createButton').disabled = false;
}
}).send();
}
}
</script>
<form action="<?php echo JRoute::_('index.php?option=com_mightysites&view=database&layout=edit&id='.(int) $this->item->id); ?>" method="post" name="database-form" id="database-form">
<div class="row-fluid">
<div class="span12 form-horizontal">
<fieldset>
<ul class="nav nav-tabs">
<li class="active"><a href="#tab-common" data-toggle="tab"><?php echo JText::_('COM_MIGHTYSITES_TAB_SETTINGS'); ?></a></li>
<li><a href="#tab-database" data-toggle="tab"><?php echo JText::_('COM_MIGHTYSITES_TAB_DATABASE');?></a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="tab-common">
<div class="control-group">
<div class="control-label"><?php echo $this->form->getLabel('domain'); ?></div>
<div class="controls"><?php echo $this->form->getInput('domain'); ?></div>
</div>
<?php if (!$this->item->id) {?>
<div class="control-group">
<div class="control-label"><?php echo $this->form->getLabel('source_db'); ?></div>
<div class="controls"><?php echo $this->form->getInput('source_db'); ?></div>
</div>
<?php }?>
</div>
<div class="tab-pane" id="tab-database">
<div class="control-group">
<div class="control-label"><?php echo $this->form->getLabel('db'); ?></div>
<div class="controls"><?php echo $this->form->getInput('db'); ?>
<?php if (!$this->item->id) {?>
<input class="btn" type="button" id="createButton" value="<?php echo JText::_('COM_MIGHTYSITES_CREATE_DATABASE');?>" onclick="createDatabase()" />
&nbsp;
<img align="top" src="../media/system/images/mootree_loader.gif" alt="<?php echo JText::_('COM_MIGHTYSITES_LOADING');?>" id="createWaiter" style="visibility:hidden" />
<span id="createInfo"></span>
<?php }?>
</div>
</div>
<div class="control-group">
<div class="control-label"><?php echo $this->form->getLabel('dbprefix'); ?></div>
<div class="controls"><?php echo $this->form->getInput('dbprefix'); ?></div>
</div>
<div class="control-group">
<div class="control-label"></div>
<div class="controls">
<input class="btn" type="button" id="checkButton" value="<?php echo JText::_('COM_MIGHTYSITES_CHECK_CONNECTION');?>" onclick="checkConnection(1)" />
&nbsp;
<img align="top" src="../media/system/images/mootree_loader.gif" alt="<?php echo JText::_('COM_MIGHTYSITES_LOADING');?>" id="checkWaiter" style="visibility:hidden" />
<span id="checkInfo"></span>
</div>
</div>
</div>
</div>
</fieldset>
</div>
</div>
<input type="hidden" name="type" value="<?php echo $this->item->type;?>" />
<input type="hidden" name="task" value="" />
<?php echo JHtml::_('form.token'); ?>
</form>

View File

@ -0,0 +1,146 @@
<?php
/**
* @package Mightysites
* @copyright Copyright (C) 2009-2013 AlterBrains.com. All rights reserved.
* @license GNU/GPL, see LICENSE.php
*/
defined('_JEXEC') or die;
jimport('joomla.html.pane');
JFilterOutput::objectHTMLSafe($this->item);
JHtml::_('behavior.tooltip');
JHtml::_('behavior.formvalidation');
JHTML::_('behavior.keepalive');
$pane = JPane::getInstance('tabs');
?>
<script language="javascript" type="text/javascript">
Joomla.submitbutton = function(task)
{
if (task == 'database.cancel' || document.formvalidator.isValid(document.id('database-form'))) {
Joomla.submitform(task, document.id('database-form'));
}
else {
alert('<?php echo $this->escape(JText::_('JGLOBAL_VALIDATION_FORM_FAILED'));?>');
}
}
function checkConnection(type) {
var form = document.id('database-form');
document.id('checkWaiter').style.visibility = 'visible';
document.id('checkButton').disabled = true;
document.id('createInfo') ? document.id('createInfo').innerHTML = '' : null;
new Request.HTML({
url: '<?php echo JRoute::_('index.php'); ?>',
update: 'checkInfo',
noCache: true,
data: {
option: 'com_mightysites',
task: 'database.check',
db: document.id('jform_db').value,
dbprefix: document.id('jform_dbprefix').value,
id: <?php echo (int)$this->item->id;?>,
type: type,
'<?php echo JUtility::getToken();?>': '1'
},
onSuccess: function() {
document.id('checkWaiter').style.visibility = 'hidden';
document.id('checkButton').disabled = false;
}
}).send();
}
function createDatabase() {
var form = document.id('database-form');
var text = '<?php echo JText::sprintf('COM_MIGHTYSITES_REALLY_CREATE_DB', '________');?>';
if (confirm(text.replace(/________/, document.id('jform_db').value))) {
document.id('createWaiter').style.visibility = 'visible';
document.id('createButton').disabled = true;
document.id('createInfo').innerHTML = '';
new Request.HTML({
url: '<?php echo JRoute::_('index.php'); ?>',
update: 'createInfo',
noCache: true,
data: {
option: 'com_mightysites',
task: 'database.create',
db: document.id('jform_db').value,
'<?php echo JUtility::getToken();?>': '1'
},
onSuccess: function() {
document.id('createWaiter').style.visibility = 'hidden';
document.id('createButton').disabled = false;
}
}).send();
}
}
</script>
<form action="<?php echo JRoute::_('index.php?option=com_mightysites&view=database&layout=edit&id='.(int) $this->item->id); ?>" method="post" name="database-form" id="database-form">
<?php
echo $pane->startPane("domain-pane");
echo $pane->startPanel(JText::_('COM_MIGHTYSITES_TAB_SETTINGS'), 'common-page');
?>
<div class="width-100" style="overflow:hidden">
<fieldset class="adminform">
<ul class="adminformlist">
<li><?php echo $this->form->getLabel('domain'); ?>
<?php echo $this->form->getInput('domain'); ?></li>
<?php if (!$this->item->id) {?>
<li><?php echo $this->form->getLabel('source_db'); ?>
<?php echo $this->form->getInput('source_db'); ?></li>
<?php }?>
</ul>
</fieldset>
</div>
<?php
echo $pane->endPanel();
echo $pane->startPanel(JText::_('COM_MIGHTYSITES_TAB_DATABASE'), 'database-page');
?>
<div class="width-100" style="overflow:hidden">
<div id="databaseData">
<fieldset class="adminform">
<ul class="adminformlist">
<li><?php echo $this->form->getLabel('db'); ?>
<?php echo $this->form->getInput('db'); ?>
<?php if (!$this->item->id) {?>
<input class="button" type="button" id="createButton" value="<?php echo JText::_('COM_MIGHTYSITES_CREATE_DATABASE');?>" onclick="createDatabase()" />
&nbsp;
<img align="top" src="../media/system/images/mootree_loader.gif" alt="<?php echo JText::_('COM_MIGHTYSITES_LOADING');?>" id="createWaiter" style="visibility:hidden" />
<fieldset class="radio"><span id="createInfo"></span></fieldset>
<?php }?>
</li>
<li><?php echo $this->form->getLabel('dbprefix'); ?>
<?php echo $this->form->getInput('dbprefix'); ?></li>
<li><input class="button" type="button" id="checkButton" value="<?php echo JText::_('COM_MIGHTYSITES_CHECK_CONNECTION');?>" onclick="checkConnection(1)" />
&nbsp;
<img align="top" src="../media/system/images/mootree_loader.gif" alt="<?php echo JText::_('COM_MIGHTYSITES_LOADING');?>" id="checkWaiter" style="visibility:hidden" />
<fieldset class="radio"><span id="checkInfo"></span></fieldset>
</li>
</ul>
</fieldset>
</div>
</div>
<?php
echo $pane->endPanel();
echo $pane->endPane();
?>
<input type="hidden" name="id" value="<?php echo $this->item->id;?>" />
<input type="hidden" name="type" value="<?php echo $this->item->type;?>" />
<input type="hidden" name="option" value="com_mightysites" />
<input type="hidden" name="task" value="" />
<?php echo JHTML::_('form.token');?>
</form>

View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>

View File

@ -0,0 +1,68 @@
<?php
/**
* @package Mightysites
* @copyright Copyright (C) 2009-2013 AlterBrains.com. All rights reserved.
* @license GNU/GPL, see LICENSE.php
*/
defined('_JEXEC') or die('Restricted access');
class MightysitesViewDatabase extends JViewLegacy
{
protected $state;
protected $item;
protected $form;
public function display($tpl = null)
{
$this->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');
}
}
}

View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>

View File

@ -0,0 +1,165 @@
<?php
/**
* @package Mightysites
* @copyright Copyright (C) 2009-2013 AlterBrains.com. All rights reserved.
* @license GNU/GPL, see LICENSE.php
*/
defined('_JEXEC') or die('Restricted access');
JHtml::_('bootstrap.tooltip');
JHtml::_('behavior.multiselect');
JHtml::_('formbehavior.chosen', 'select');
JHtml::_('behavior.modal');
$user = JFactory::getUser();
$listOrder = $this->escape($this->state->get('list.ordering'));
$listDirn = $this->escape($this->state->get('list.direction'));
$this->sidebar = JHtmlSidebar::render();
?>
<script language="javascript" type="text/javascript">
Joomla.orderTable = function() {
table = document.getElementById("sortTable");
direction = document.getElementById("directionTable");
order = table.options[table.selectedIndex].value;
if (order != '<?php echo $listOrder; ?>') {
dirn = 'asc';
} else {
dirn = direction.options[direction.selectedIndex].value;
}
Joomla.tableOrdering(order, dirn, '');
}
Joomla.submitbutton = function(task) {
var form = document.adminForm;
if (task == 'databases.remove' && window.confirm('<?php echo JText::_('COM_MIGHTYSITES_REALLY_DELETE_DB', true);?>')) {
form.delete_tables.value = 'true';
}
Joomla.submitform(task, document.getElementById('adminForm'));
}
</script>
<form action="<?php echo JRoute::_('index.php?option=com_mightysites&view=databases');?>" method="post" name="adminForm" id="adminForm">
<?php if(!empty( $this->sidebar)): ?>
<div id="j-sidebar-container" class="span2">
<?php echo $this->sidebar; ?>
</div>
<div id="j-main-container" class="span10">
<?php else : ?>
<div id="j-main-container">
<?php endif;?>
<div id="filter-bar" class="btn-toolbar">
<div class="filter-search btn-group pull-left">
<label for="filter_search" class="element-invisible"><?php echo JText::_('JSEARCH_FILTER');?></label>
<input type="text" name="filter_search" id="filter_search" placeholder="<?php echo JText::_('JSEARCH_FILTER'); ?>" value="<?php echo $this->escape($this->state->get('filter.search')); ?>" title="<?php echo JText::_('JSEARCH_FILTER'); ?>" />
</div>
<div class="btn-group pull-left">
<button class="btn hasTooltip" type="submit" title="<?php echo JText::_('JSEARCH_FILTER_SUBMIT'); ?>"><i class="icon-search"></i></button>
<button class="btn hasTooltip" type="button" title="<?php echo JText::_('JSEARCH_FILTER_CLEAR'); ?>" onclick="document.id('filter_search').value='';this.form.submit();"><i class="icon-remove"></i></button>
</div>
<div class="btn-group pull-right hidden-phone">
<label for="limit" class="element-invisible"><?php echo JText::_('JFIELD_PLG_SEARCH_SEARCHLIMIT_DESC');?></label>
<?php echo $this->pagination->getLimitBox(); ?>
</div>
<div class="btn-group pull-right hidden-phone">
<label for="directionTable" class="element-invisible"><?php echo JText::_('JFIELD_ORDERING_DESC');?></label>
<select name="directionTable" id="directionTable" class="input-medium" onchange="Joomla.orderTable()">
<option value=""><?php echo JText::_('JFIELD_ORDERING_DESC');?></option>
<option value="asc" <?php if ($listDirn == 'asc') echo 'selected="selected"'; ?>><?php echo JText::_('JGLOBAL_ORDER_ASCENDING');?></option>
<option value="desc" <?php if ($listDirn == 'desc') echo 'selected="selected"'; ?>><?php echo JText::_('JGLOBAL_ORDER_DESCENDING');?></option>
</select>
</div>
<div class="btn-group pull-right">
<label for="sortTable" class="element-invisible"><?php echo JText::_('JGLOBAL_SORT_BY');?></label>
<select name="sortTable" id="sortTable" class="input-medium" onchange="Joomla.orderTable()">
<option value=""><?php echo JText::_('JGLOBAL_SORT_BY');?></option>
<?php echo JHtml::_('select.options', $sortFields, 'value', 'text', $listOrder);?>
</select>
</div>
</div>
<div class="clearfix"> </div>
<table class="table table-striped" id="weblinkList">
<thead>
<tr>
<th class="nowrap hidden-phone" width="1%" align="left"><?php echo JText::_('Num');?></th>
<th class="nowrap" width="1%"><input type="checkbox" name="checkall-toggle" value="" title="<?php echo JText::_('JGLOBAL_CHECK_ALL'); ?>" onclick="Joomla.checkAll(this)" /></th>
<th class="nowrap" align="left"><?php echo JHTML::_('grid.sort', 'COM_MIGHTYSITES_HEADING_DATABASE_TITLE', 'a.domain', $listDirn, $listOrder);?></th>
<th class="nowrap center hidden-phone" width="15%"><?php echo JHTML::_('grid.sort', 'COM_MIGHTYSITES_HEADING_DATABASE_ORIGIN', 'a.type', $listDirn, $listOrder);?></th>
<th class="nowrap center" width="15%"><?php echo JHTML::_('grid.sort', 'COM_MIGHTYSITES_HEADING_DATABASE_NAME', 'a.db', $listDirn, $listOrder);?></th>
<!--<th class="nowrap center " width="15%"><?php echo JText::_('COM_MIGHTYSITES_HEADING_DATABASE_USER');?></th>-->
<th class="nowrap center" width="15%"><?php echo JHTML::_('grid.sort', 'COM_MIGHTYSITES_HEADING_DATABASE_PREFIX', 'a.dbprefix', $listDirn, $listOrder);?></th>
<th class="nowrap center" width="1%"><?php echo JHTML::_('grid.sort', 'ID', 'a.id', $listDirn, $listOrder);?></th>
</tr>
</thead>
<tfoot>
<tr>
<td colspan="15">
<?php echo $this->pagination->getListFooter();?>
</td>
</tr>
</tfoot>
<tbody>
<?php 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;
}
?>
<tr class="row<?php echo $i % 2;?>">
<td class="nowrap center hidden-phone"><?php echo $this->pagination->getRowOffset($i);?></td>
<td class="nowrap center"><?php if ($item->type == 2) {?>
<?php echo JHtml::_('grid.id', $i, $item->id);?>
<?php }?>
</td>
<td class="nowrap"><?php if ($item->checked_out) : ?>
<?php echo JHtml::_('jgrid.checkedout', $i, $item->editor, $item->checked_out_time, 'databases.', $canCheckin);?>
<?php endif;?>
<?php if ($canEdit) {?>
<a href="<?php echo JRoute::_($link);?>">
<?php echo $item->domain;?></a>
<?php } else {?>
<?php echo $item->domain;?>
<?php }?>
</td>
<td class="nowrap center hidden-phone">
<?php if ($item->type == 1) {
echo JText::_('COM_MIGHTYSITES_DATABASE_ORIGIN_SITE');
} else {
echo JText::_('COM_MIGHTYSITES_DATABASE_ORIGIN_DATABASE');
}?>
</td>
<td class="nowrap center"><?php echo @$item->db;?></td>
<!--<td align="center"><?php echo @$item->user;?></td>-->
<td class="nowrap center"><?php echo @$item->dbprefix;?></td>
<td class="nowrap center"><?php echo $item->id;?></td>
</tr>
<?php }?>
</tbody>
</table>
<input type="hidden" name="option" value="com_mightysites" />
<input type="hidden" name="task" value="" />
<input type="hidden" name="boxchecked" value="0" />
<input type="hidden" name="filter_order" value="<?php echo $listOrder;?>" />
<input type="hidden" name="filter_order_Dir" value="<?php echo $listDirn;?>" />
<input type="hidden" name="delete_tables" value="" />
<?php echo JHTML::_('form.token');?>
</div>
</form>

View File

@ -0,0 +1,131 @@
<?php
/**
* @package Mightysites
* @copyright Copyright (C) 2009-2013 AlterBrains.com. All rights reserved.
* @license GNU/GPL, see LICENSE.php
*/
defined('_JEXEC') or die('Restricted access');
$user = JFactory::getUser();
$listOrder = $this->escape($this->state->get('list.ordering'));
$listDirn = $this->escape($this->state->get('list.direction'));
JHtml::_('behavior.tooltip');
?>
<script language="javascript" type="text/javascript">
Joomla.submitbutton = function(task) {
var form = document.adminForm;
if (task == 'databases.remove' && window.confirm('<?php echo JText::_('COM_MIGHTYSITES_REALLY_DELETE_DB', true);?>')) {
form.delete_tables.value = 'true';
}
Joomla.submitform(task, document.getElementById('adminForm'));
}
</script>
<form action="<?php echo JRoute::_('index.php?option=com_mightysites&view=databases');?>" method="post" name="adminForm" id="adminForm">
<table>
<tr>
<td align="left" width="100%">
<?php echo JText::_('JSEARCH_FILTER_LABEL');?>
<input type="text" name="filter_search" id="filter_search" value="<?php echo $this->escape($this->state->get('filter.search'));?>" />
<button type="submit"><?php echo JText::_('JSEARCH_FILTER_SUBMIT');?></button>
<button type="button" onclick="document.id('filter_search').value='';this.form.submit();"><?php echo JText::_('JSEARCH_FILTER_CLEAR');?></button>
</td>
</tr>
</table>
<table class="adminlist">
<thead>
<tr>
<th nowrap="nowrap" width="1%" align="left"><?php echo JText::_('Num');?></th>
<th nowrap="nowrap" width="1%"><input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count($this->items);?>);" /></th>
<th nowrap="nowrap" align="left"><?php echo JHTML::_('grid.sort', 'COM_MIGHTYSITES_HEADING_DATABASE_TITLE', 'a.domain', $listDirn, $listOrder);?></th>
<th nowrap="nowrap" width="15%"><?php echo JHTML::_('grid.sort', 'COM_MIGHTYSITES_HEADING_DATABASE_ORIGIN', 'a.type', $listDirn, $listOrder);?></th>
<th nowrap="nowrap" width="15%"><?php echo JHTML::_('grid.sort', 'COM_MIGHTYSITES_HEADING_DATABASE_NAME', 'a.db', $listDirn, $listOrder);?></th>
<!--<th nowrap="nowrap" width="15%"><?php echo JText::_('COM_MIGHTYSITES_HEADING_DATABASE_USER');?></th>-->
<th nowrap="nowrap" width="15%"><?php echo JHTML::_('grid.sort', 'COM_MIGHTYSITES_HEADING_DATABASE_PREFIX', 'a.dbprefix', $listDirn, $listOrder);?></th>
<th nowrap="nowrap" width="1%"><?php echo JHTML::_('grid.sort', 'ID', 'a.id', $listDirn, $listOrder);?></th>
</tr>
</thead>
<tfoot>
<tr>
<td colspan="15">
<?php echo $this->pagination->getListFooter();?>
</td>
</tr>
</tfoot>
<tbody>
<?php
$k = 0;
if (count($this->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;
}
?>
<tr class="row<?php echo $i % 2;?>">
<td><?php echo $this->pagination->getRowOffset($i);?></td>
<td><?php if ($item->type == 2) {?>
<?php echo JHtml::_('grid.id', $i, $item->id);?>
<?php }?>
</td>
<td><?php if ($item->checked_out) : ?>
<?php echo JHtml::_('jgrid.checkedout', $i, $item->editor, $item->checked_out_time, 'databases.', $canCheckin);?>
<?php endif;?>
<?php if ($canEdit) {?>
<a href="<?php echo JRoute::_($link);?>">
<?php echo $item->domain;?></a>
<?php } else {?>
<?php echo $item->domain;?>
<?php }?>
</td>
<td align="center">
<?php if ($item->type == 1) {
echo JText::_('COM_MIGHTYSITES_DATABASE_ORIGIN_SITE');
} else {
echo JText::_('COM_MIGHTYSITES_DATABASE_ORIGIN_DATABASE');
}?>
</td>
<td align="center"><?php echo @$item->db;?></td>
<!--<td align="center"><?php echo @$item->user;?></td>-->
<td align="center"><?php echo @$item->dbprefix;?></td>
<td align="center"><?php echo $item->id;?></td>
</tr>
<?php
}
} else {
?>
<tr><td colspan="14" align="center"><?php echo JText::_('COM_MIGHTYSITES_NO_DATABASES');?></td></tr>
<?php
}
?>
</tbody>
</table>
<input type="hidden" name="option" value="com_mightysites" />
<input type="hidden" name="task" value="" />
<input type="hidden" name="boxchecked" value="0" />
<input type="hidden" name="filter_order" value="<?php echo $listOrder;?>" />
<input type="hidden" name="filter_order_Dir" value="<?php echo $listDirn;?>" />
<input type="hidden" name="delete_tables" value="" />
<?php echo JHTML::_('form.token');?>
</form>

View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>

View File

@ -0,0 +1,78 @@
<?php
/**
* @package Mightysites
* @copyright Copyright (C) 2009-2013 AlterBrains.com. All rights reserved.
* @license GNU/GPL, see LICENSE.php
*/
defined('_JEXEC') or die('Restricted access');
class MightysitesViewDatabases extends JViewLegacy {
public function display($tpl = null)
{
$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;
}
$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'),
);
}
}

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>

View File

@ -0,0 +1,374 @@
<?php
/**
* @package Mightysites
* @copyright Copyright (C) 2009-2013 AlterBrains.com. All rights reserved.
* @license GNU/GPL, see LICENSE.php
*/
defined('_JEXEC') or die;
JHtml::_('behavior.tooltip');
JHtml::_('behavior.formvalidation');
JHtml::_('formbehavior.chosen', 'select');
JHtml::_('behavior.tabstate');
?>
<script language="javascript" type="text/javascript">
Joomla.submitbutton = function(task)
{
if (task == 'site.cancel' || document.formvalidator.isValid(document.getElementById('site-form'))) {
Joomla.submitform(task, document.getElementById('site-form'));
}
else {
alert('<?php echo $this->escape(JText::_('JGLOBAL_VALIDATION_FORM_FAILED'));?>');
}
}
function checkConnection(type) {
var form = document.getElementById('site-form');
document.getElementById('checkWaiter').style.visibility = 'visible';
document.getElementById('checkButton').disabled = true;
document.getElementById('createInfo') ? document.getElementById('createInfo').innerHTML = '' : null;
new Request.HTML({
url: '<?php echo JRoute::_('index.php'); ?>',
update: 'checkInfo',
noCache: true,
data: {
option: 'com_mightysites',
task: 'database.check',
db: document.getElementById('jform_db').value,
dbprefix: document.getElementById('jform_dbprefix').value,
user: document.getElementById('jform_user').value,
password: document.getElementById('jform_password').value,
id: <?php echo (int)$this->item->id;?>,
type: type,
'<?php echo JSession::getFormToken();?>': '1'
},
onSuccess: function() {
document.getElementById('checkWaiter').style.visibility = 'hidden';
document.getElementById('checkButton').disabled = false;
}
}).send();
}
function createDatabase() {
var form = document.getElementById('site-form');
var text = '<?php echo JText::sprintf('COM_MIGHTYSITES_REALLY_CREATE_DB', '________');?>';
if (confirm(text.replace(/________/, document.getElementById('jform_db').value))) {
document.getElementById('createWaiter').style.visibility = 'visible';
document.getElementById('createButton').disabled = true;
document.getElementById('createInfo').innerHTML = '';
new Request.HTML({
url: '<?php echo JRoute::_('index.php'); ?>',
update: 'createInfo',
noCache: true,
data: {
option: 'com_mightysites',
task: 'database.create',
db: document.getElementById('jform_db').value,
'<?php echo JSession::getFormToken();?>': '1'
},
onSuccess: function() {
document.getElementById('createWaiter').style.visibility = 'hidden';
document.getElementById('createButton').disabled = false;
}
}).send();
}
}
function loadTables() {
document.getElementById('tablesWaiter').style.visibility = 'visible';
new Request.HTML({
url: '<?php echo JRoute::_('index.php'); ?>',
update: 'tablesArea',
noCache: true,
data: {
option: 'com_mightysites',
view: 'site',
layout: 'tables',
id: <?php echo (int) $this->item->id;?>
},
onSuccess: function() {
jQuery('#tablesArea select').chosen({
disable_search_threshold : 10,
allow_single_deselect : true
});
}
}).send();
}
function selectAllTo(scope, val) {
if (val >= 0) {
jQuery('#'+scope+' select').each(function(i, e) {
jQuery(e).val(val)
jQuery(e).trigger("liszt:updated");
});
}
}
function firstChildOf(el) {
for (var i=0; i<el.childNodes.length; i++) {
if (el.childNodes[i].nodeType == 1) {
return el.childNodes[i];
}
}
}
function getChildNode(el, num) {
nn=-1;
for (var i=0; i<el.childNodes.length; i++) {
if (el.childNodes[i].nodeType == 1) {
nn++;
if (nn == num) return el.childNodes[i];
}
}
}
function addSingleDomain() {
var table = document.getElementById('singleDomainsTable').tBodies[0];
var newTr = table.rows[table.rows.length-1].cloneNode(true);
table.appendChild(newTr);
var newTr = table.rows[table.rows.length-1];
firstChildOf(getChildNode(newTr, 0)).value = '';
firstChildOf(getChildNode(newTr, 1)).value = '';
return false;
}
</script>
<form action="<?php echo JRoute::_('index.php?option=com_mightysites&view=site&layout=edit&id='.(int) $this->item->id); ?>" method="post" name="site-form" id="site-form">
<div class="row-fluid">
<div class="span12 form-horizontal">
<fieldset>
<ul class="nav nav-tabs">
<li class="active"><a href="#tab-common" data-toggle="tab"><?php echo JText::_('COM_MIGHTYSITES_TAB_BASIC'); ?></a></li>
<li><a href="#tab-database" data-toggle="tab"><?php echo JText::_('COM_MIGHTYSITES_TAB_DATABASE');?></a></li>
<li><a href="#tab-sharing" data-toggle="tab"><?php echo JText::_('COM_MIGHTYSITES_TAB_CONTENT_SHARING');?></a></li>
<li><a href="#tab-single" data-toggle="tab"><?php echo JText::_('COM_MIGHTYSITES_TAB_SINGLE');?></a></li>
<li><a href="#tab-overrides" data-toggle="tab"><?php echo JText::_('COM_MIGHTYSITES_TAB_OVERRIDES');?></a></li>
<li><a href="#tab-advanced" data-toggle="tab"><?php echo JText::_('COM_MIGHTYSITES_TAB_ADVANCED');?></a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="tab-common">
<div class="control-group">
<div class="control-label"><?php echo $this->form->getLabel('domain'); ?></div>
<div class="controls"><?php echo $this->form->getInput('domain'); ?></div>
</div>
<div class="control-group">
<div class="control-label"><?php echo $this->form->getLabel('aliases'); ?></div>
<div class="controls"><?php echo $this->form->getInput('aliases'); ?></div>
</div>
<?php if (!$this->item->id) {?>
<div class="control-group">
<div class="control-label"><?php echo $this->form->getLabel('source_config'); ?></div>
<div class="controls"><?php echo $this->form->getInput('source_config'); ?></div>
</div>
<div class="control-group">
<div class="control-label"><?php echo $this->form->getLabel('source_db'); ?></div>
<div class="controls"><?php echo $this->form->getInput('source_db'); ?></div>
</div>
<?php }?>
</div>
<div class="tab-pane" id="tab-database">
<div class="control-group">
<div class="control-label"><?php echo $this->form->getLabel('db'); ?></div>
<div class="controls"><?php echo $this->form->getInput('db'); ?>
<?php if (!$this->item->id) {?>
<input class="btn" type="button" id="createButton" value="<?php echo JText::_('COM_MIGHTYSITES_CREATE_DATABASE');?>" onclick="createDatabase()" />
&nbsp;
<img align="top" src="../media/system/images/mootree_loader.gif" alt="<?php echo JText::_('COM_MIGHTYSITES_LOADING');?>" id="createWaiter" style="visibility:hidden" />
<span id="createInfo"></span>
<?php }?>
</div>
</div>
<div class="control-group">
<div class="control-label"><?php echo $this->form->getLabel('dbprefix'); ?></div>
<div class="controls"><?php echo $this->form->getInput('dbprefix'); ?></div>
</div>
<div class="control-group">
<div class="control-label"><?php echo $this->form->getLabel('user'); ?></div>
<div class="controls"><?php echo $this->form->getInput('user'); ?></div>
</div>
<div class="control-group">
<div class="control-label"><?php echo $this->form->getLabel('password'); ?></div>
<div class="controls"><?php echo $this->form->getInput('password'); ?></div>
</div>
<div class="control-group">
<div class="control-label"><?php echo $this->form->getLabel('dbtype'); ?></div>
<div class="controls"><?php echo $this->form->getInput('dbtype'); ?></div>
</div>
<div class="control-group">
<div class="control-label"></div>
<div class="controls">
<input class="btn" type="button" id="checkButton" value="<?php echo JText::_('COM_MIGHTYSITES_CHECK_CONNECTION');?>" onclick="checkConnection(1)" />
&nbsp;
<img align="top" src="../media/system/images/mootree_loader.gif" alt="<?php echo JText::_('COM_MIGHTYSITES_LOADING');?>" id="checkWaiter" style="visibility:hidden" />
<span id="checkInfo"></span>
</div>
</div>
</div>
<div class="tab-pane" id="tab-sharing">
<?php if (!$this->item->id) {
echo JText::_('COM_MIGHTYSITES_APPLY_SETTINGS');
} else {?>
<?php foreach ($this->form->getFieldset('replacements') as $field) : ?>
<div class="control-group">
<div class="control-label"><?php echo $field->label; ?></div>
<div class="controls"><?php echo $field->input; ?></div>
</div>
<?php endforeach; ?>
<div class="row-fluid">
<div class="span4" id="coreComponents">
<legend><?php echo JText::_('COM_MIGHTYSITES_FIELDSET_CORE_COMPONENTS');?></legend>
<div class="control-group">
<div class="control-label"></div>
<div class="controls">
<?php echo MightysitesHelper::sitesList('coreComponentsSelect', -1, ' onchange="selectAllTo(\'coreComponents\', this.options[this.selectedIndex].value)"', $this->item->domain, JText::_('COM_MIGHTYSITES_SELECT_ALL_TO'), false, '-1', JText::_('COM_MIGHTYSITES_OWN_DATA'), '');?>
</div>
</div>
<hr/>
<?php foreach($this->synchs_core as $synch => $input) {?>
<div class="control-group">
<div class="control-label"><label class="hasTip" title="<?php echo JText::_('COM_MIGHTYSITES_SYNCH_LABEL_'.$synch);?>::<?php echo JText::_('COM_MIGHTYSITES_SYNCH_DESC_'.$synch);?>"><?php echo JText::_('COM_MIGHTYSITES_SYNCH_LABEL_'.$synch);?></label></div>
<div class="controls"><?php echo $input;?></div>
</div>
<?php }?>
</div>
<div class="span4" id="customComponents">
<legend><?php echo JText::_('COM_MIGHTYSITES_FIELDSET_CUSTOM_COMPONENTS');?></legend>
<div class="control-group">
<div class="control-label"></div>
<div class="controls">
<?php echo MightysitesHelper::sitesList('customComponentsSelect', -1, ' onchange="selectAllTo(\'customComponents\', this.options[this.selectedIndex].value)"', $this->item->domain, JText::_('COM_MIGHTYSITES_SELECT_ALL_TO'), false, '-1', JText::_('COM_MIGHTYSITES_OWN_DATA'), '');?>
</div>
</div>
<hr/>
<?php foreach($this->synchs_custom as $synch => $input) {?>
<div class="control-group">
<div class="control-label"><label class="hasTip" title="<?php echo JText::_('COM_MIGHTYSITES_SYNCH_LABEL_'.$synch);?>::<?php echo JText::_('COM_MIGHTYSITES_SYNCH_DESC_'.$synch);?>"><?php echo JText::_('COM_MIGHTYSITES_SYNCH_LABEL_'.$synch);?></label></div>
<div class="controls"><?php echo $input;?></div>
</div>
<?php }?>
</div>
<div class="span4" id="tableComponents">
<legend><?php echo JText::_('COM_MIGHTYSITES_FIELDSET_DATABASE_TABLES');?></legend>
<div id="tablesArea">
<input type="button" class="btn" onclick="loadTables()" value="<?php echo JText::_('COM_MIGHTYSITES_LOAD_TABLES');?>" />
&nbsp;
<img align="top" src="../media/system/images/mootree_loader.gif" alt="<?php echo JText::_('COM_MIGHTYSITES_LOADING');?>" id="tablesWaiter" style="visibility:hidden" />
<?php // Keep current settings
$tables = 0;
foreach($this->params->toArray() as $key => $value) {
if (strpos($key, 'table_') !== false) {
echo '<input type="hidden" name="jform[tables]['.substr($key, 6).']" value="'.$value.'" />';
$tables++;
}
}?>
<p> </p>
<p><?php echo JText::plural('COM_MIGHTYSITES_N_TABLES_ASSIGNED', $tables); ?></p>
</div>
</div>
</div>
<?php }?>
</div>
<div class="tab-pane" id="tab-single">
<?php if (!$this->item->id) {
echo JText::_('COM_MIGHTYSITES_APPLY_SETTINGS');
} else {?>
<?php foreach ($this->form->getFieldset('single') as $field) : ?>
<div class="control-group">
<div class="control-label"><?php echo $field->label; ?></div>
<div class="controls"><?php echo $field->input; ?></div>
</div>
<?php endforeach; ?>
<legend><?php echo JText::_('COM_MIGHTYSITES_FIELDSET_SINGLE_SITES');?></legend>
<table class="table table-striped" style="width:auto" id="singleDomainsTable">
<thead>
<tr><th><?php echo JText::_('COM_MIGHTYSITES_DOMAIN');?></th>
<th><?php echo JText::_('COM_MIGHTYSITES_SECRET_KEY');?></th>
</tr>
</thead>
<tbody>
<?php
$i = 0;
while ($this->params->get('single_domain'.(string)$i)) {?>
<tr><td><input type="text" class="inputbox" name="single_domain[]" value="<?php echo $this->params->get('single_domain'.(string)$i)?>" /></td>
<td><input type="text" class="inputbox" name="single_key[]" value="<?php echo $this->params->get('single_key'.(string)$i)?>" /></td>
</tr>
<?php
$i++;
}
if (!$i) {?>
<tr><td><input type="text" class="inputbox" name="single_domain[]" value="" /></td>
<td><input type="text" class="inputbox" name="single_key[]" value="" /></td>
</tr>
<?php }?>
</tbody>
</table>
<p></p>
<p><input type="button" class="btn" onClick="return addSingleDomain()" value="<?php echo JText::_('COM_MIGHTYSITES_ADD_SINGLE_SITE');?>" /></p>
<?php }?>
</div>
<div class="tab-pane" id="tab-overrides">
<?php if (!$this->item->id) {
echo JText::_('COM_MIGHTYSITES_APPLY_SETTINGS');
} else {?>
<?php foreach ($this->form->getFieldset('overrides') as $field) : ?>
<div class="control-group">
<div class="control-label"><?php echo $field->label; ?></div>
<div class="controls"><?php echo $field->input; ?></div>
</div>
<?php endforeach; ?>
<?php }?>
</div>
<div class="tab-pane" id="tab-advanced">
<?php if (!$this->item->id) {
echo JText::_('COM_MIGHTYSITES_APPLY_SETTINGS');
} else {?>
<?php foreach ($this->form->getFieldset('advanced') as $field) : ?>
<div class="control-group">
<div class="control-label"><?php echo $field->label; ?></div>
<div class="controls"><?php echo $field->input; ?></div>
</div>
<?php endforeach; ?>
<?php }?>
</div>
</div>
</fieldset>
</div>
</div>
<input type="hidden" name="type" value="<?php echo $this->item->type;?>" />
<input type="hidden" name="task" value="" />
<?php echo JHtml::_('form.token'); ?>
</form>

View File

@ -0,0 +1,403 @@
<?php
/**
* @package Mightysites
* @copyright Copyright (C) 2009-2013 AlterBrains.com. All rights reserved.
* @license GNU/GPL, see LICENSE.php
*/
defined('_JEXEC') or die;
jimport('joomla.html.pane');
JFilterOutput::objectHTMLSafe($this->item);
JHtml::_('behavior.tooltip');
JHtml::_('behavior.formvalidation');
JHTML::_('behavior.keepalive');
$pane = JPane::getInstance('tabs');
?>
<script language="javascript" type="text/javascript">
Joomla.submitbutton = function(task)
{
if (task == 'site.cancel' || document.formvalidator.isValid(document.id('site-form'))) {
Joomla.submitform(task, document.id('site-form'));
}
else {
alert('<?php echo $this->escape(JText::_('JGLOBAL_VALIDATION_FORM_FAILED'));?>');
}
}
function checkConnection(type) {
var form = document.id('site-form');
document.id('checkWaiter').style.visibility = 'visible';
document.id('checkButton').disabled = true;
document.id('createInfo') ? document.id('createInfo').innerHTML = '' : null;
new Request.HTML({
url: '<?php echo JRoute::_('index.php'); ?>',
update: 'checkInfo',
noCache: true,
data: {
option: 'com_mightysites',
task: 'database.check',
db: document.id('jform_db').value,
dbprefix: document.id('jform_dbprefix').value,
user: document.id('jform_user').value,
password: document.id('jform_password').value,
id: <?php echo (int)$this->item->id;?>,
type: type,
'<?php echo JUtility::getToken();?>': '1'
},
onSuccess: function() {
document.id('checkWaiter').style.visibility = 'hidden';
document.id('checkButton').disabled = false;
}
}).send();
}
function createDatabase() {
var form = document.id('site-form');
var text = '<?php echo JText::sprintf('COM_MIGHTYSITES_REALLY_CREATE_DB', '________');?>';
if (confirm(text.replace(/________/, document.id('jform_db').value))) {
document.id('createWaiter').style.visibility = 'visible';
document.id('createButton').disabled = true;
document.id('createInfo').innerHTML = '';
new Request.HTML({
url: '<?php echo JRoute::_('index.php'); ?>',
update: 'createInfo',
noCache: true,
data: {
option: 'com_mightysites',
task: 'database.create',
db: document.id('jform_db').value,
'<?php echo JUtility::getToken();?>': '1'
},
onSuccess: function() {
document.id('createWaiter').style.visibility = 'hidden';
document.id('createButton').disabled = false;
}
}).send();
}
}
function loadTables() {
document.id('tablesWaiter').style.visibility = 'visible';
new Request.HTML({
url: '<?php echo JRoute::_('index.php'); ?>',
update: 'tablesArea',
noCache: true,
data: {
option: 'com_mightysites',
view: 'site',
layout: 'tables',
id: <?php echo (int) $this->item->id;?>
},
onSuccess: function() {
}
}).send();
}
function selectAllTo(scope, val) {
if (val >= 0) {
document.getElements('#'+scope+' option').each(function(o){
o.selected = (o.value == val);
})
}
}
function firstChildOf(el) {
for (var i=0; i<el.childNodes.length; i++) {
if (el.childNodes[i].nodeType == 1) {
return el.childNodes[i];
}
}
}
function getChildNode(el, num) {
nn=-1;
for (var i=0; i<el.childNodes.length; i++) {
if (el.childNodes[i].nodeType == 1) {
nn++;
if (nn == num) return el.childNodes[i];
}
}
}
function addSingleDomain() {
var table = document.getElementById('singleDomainsTable').tBodies[0];
var newTr = table.rows[table.rows.length-1].cloneNode(true);
table.appendChild(newTr);
var newTr = table.rows[table.rows.length-1];
firstChildOf(getChildNode(newTr, 0)).value = '';
firstChildOf(getChildNode(newTr, 1)).value = '';
return false;
}
</script>
<style type="text/css">
div.current select {
margin-bottom: 0;
}
li.selectAll {
border-bottom:1px solid #ccc;
overflow:hidden;
margin-bottom:10px !important;
}
tr.selectAll td {
border-bottom:1px solid #ccc;
overflow:hidden;
margin-bottom:10px !important;
}
#customComponents label {
min-width:200px;
}
#singleDomainsTable .inputbox {
width:200px;
}
</style>
<form action="<?php echo JRoute::_('index.php?option=com_mightysites&view=site&layout=edit&id='.(int) $this->item->id); ?>" method="post" name="site-form" id="site-form">
<?php
echo $pane->startPane("domain-pane");
echo $pane->startPanel(JText::_('COM_MIGHTYSITES_TAB_BASIC'), 'common-page');
?>
<div class="width-100" style="overflow:hidden">
<fieldset class="adminform">
<ul class="adminformlist">
<li><?php echo $this->form->getLabel('domain'); ?>
<?php echo $this->form->getInput('domain'); ?></li>
<li><?php echo $this->form->getLabel('aliases'); ?>
<?php echo $this->form->getInput('aliases'); ?></li>
<?php if (!$this->item->id) {?>
<li><?php echo $this->form->getLabel('source_config'); ?>
<?php echo $this->form->getInput('source_config'); ?></li>
<li><?php echo $this->form->getLabel('source_db'); ?>
<?php echo $this->form->getInput('source_db'); ?></li>
<?php }?>
</ul>
</fieldset>
</div>
<?php
echo $pane->endPanel();
echo $pane->startPanel(JText::_('COM_MIGHTYSITES_TAB_DATABASE'), 'database-page');
?>
<div class="width-100" style="overflow:hidden">
<div id="databaseData">
<fieldset class="adminform">
<ul class="adminformlist">
<li><?php echo $this->form->getLabel('db'); ?>
<?php echo $this->form->getInput('db'); ?>
<?php if (!$this->item->id) {?>
<input class="button" type="button" id="createButton" value="<?php echo JText::_('COM_MIGHTYSITES_CREATE_DATABASE');?>" onclick="createDatabase()" />
&nbsp;
<img align="top" src="../media/system/images/mootree_loader.gif" alt="<?php echo JText::_('COM_MIGHTYSITES_LOADING');?>" id="createWaiter" style="visibility:hidden" />
<fieldset class="radio"><span id="createInfo"></span></fieldset>
<?php }?>
</li>
<li><?php echo $this->form->getLabel('dbprefix'); ?>
<?php echo $this->form->getInput('dbprefix'); ?></li>
<li><?php echo $this->form->getLabel('user'); ?>
<?php echo $this->form->getInput('user'); ?></li>
<li><?php echo $this->form->getLabel('password'); ?>
<?php echo $this->form->getInput('password'); ?></li>
<li><input class="button" type="button" id="checkButton" value="<?php echo JText::_('COM_MIGHTYSITES_CHECK_CONNECTION');?>" onclick="checkConnection(1)" />
&nbsp;
<img align="top" src="../media/system/images/mootree_loader.gif" alt="<?php echo JText::_('COM_MIGHTYSITES_LOADING');?>" id="checkWaiter" style="visibility:hidden" />
<fieldset class="radio"><span id="checkInfo"></span></fieldset>
</li>
<li><?php echo $this->form->getLabel('dbtype'); ?>
<?php echo $this->form->getInput('dbtype'); ?></li>
</ul>
</fieldset>
</div>
</div>
<?php
echo $pane->endPanel();
echo $pane->startPanel(JText::_('COM_MIGHTYSITES_TAB_CONTENT_SHARING'), 'content-sharing-page');
if (!$this->item->id) {
echo JText::_('COM_MIGHTYSITES_APPLY_SETTINGS');
} else {?>
<div style="overflow:hidden">
<div class="width-100" style="overflow:hidden">
<fieldset class="adminform">
<ul class="adminformlist">
<?php foreach ($this->form->getFieldset('replacements') as $field) : ?>
<li><?php echo $field->label; ?>
<?php echo $field->input; ?></li>
<?php endforeach; ?>
</ul>
</fieldset>
</div>
<div class="width-30 fltlft" style="overflow:hidden">
<fieldset class="adminform" id="coreComponents">
<legend><?php echo JText::_('COM_MIGHTYSITES_FIELDSET_CORE_COMPONENTS');?></legend>
<ul class="adminformlist">
<li class="selectAll"><label>&nbsp;</label>
<?php echo MightysitesHelper::sitesList('coreComponentsSelect', -1, ' onchange="selectAllTo(\'coreComponents\', this.options[this.selectedIndex].value)"', $this->item->domain, JText::_('COM_MIGHTYSITES_SELECT_ALL_TO'), false, '-1', JText::_('COM_MIGHTYSITES_OWN_DATA'), '');?>
</li>
<?php foreach($this->synchs_core as $synch => $input) {?>
<li><label class="hasTip" title="<?php echo JText::_('COM_MIGHTYSITES_SYNCH_LABEL_'.$synch);?>::<?php echo JText::_('COM_MIGHTYSITES_SYNCH_DESC_'.$synch);?>"><?php echo JText::_('COM_MIGHTYSITES_SYNCH_LABEL_'.$synch);?></label>
<?php echo $input;?>
</li>
<?php }?>
</ul>
</fieldset>
</div>
<div class="width-30 fltlft" style="overflow:hidden">
<fieldset class="adminform" id="customComponents">
<legend><?php echo JText::_('COM_MIGHTYSITES_FIELDSET_CUSTOM_COMPONENTS');?></legend>
<ul class="adminformlist">
<li class="selectAll"><label>&nbsp;</label>
<?php echo MightysitesHelper::sitesList('customComponentsSelect', -1, ' onchange="selectAllTo(\'customComponents\', this.options[this.selectedIndex].value)"', $this->item->domain, JText::_('COM_MIGHTYSITES_SELECT_ALL_TO'), false, '-1', JText::_('COM_MIGHTYSITES_OWN_DATA'), '');?>
</li>
<?php foreach($this->synchs_custom as $synch => $input) {?>
<li><label class="hasTip" title="<?php echo JText::_('COM_MIGHTYSITES_SYNCH_LABEL_'.$synch);?>::<?php echo JText::_('COM_MIGHTYSITES_SYNCH_DESC_'.$synch);?>"><?php echo JText::_('COM_MIGHTYSITES_SYNCH_LABEL_'.$synch);?></label>
<?php echo $input;?>
</li>
<?php }?>
</ul>
</fieldset>
<br />
</div>
<div class="width-30 fltlft" style="overflow:hidden">
<fieldset class="adminform" id="tableComponents">
<legend><?php echo JText::_('COM_MIGHTYSITES_FIELDSET_DATABASE_TABLES');?></legend>
<div id="tablesArea">
<input type="button" class="button" onclick="loadTables()" value="<?php echo JText::_('COM_MIGHTYSITES_LOAD_TABLES');?>" />
&nbsp;
<img align="top" src="../media/system/images/mootree_loader.gif" alt="<?php echo JText::_('COM_MIGHTYSITES_LOADING');?>" id="tablesWaiter" style="visibility:hidden" />
<?php // Keep current settings
$tables = 0;
foreach($this->params->toArray() as $key => $value) {
if (strpos($key, 'table_') !== false) {
echo '<input type="hidden" name="jform[tables]['.substr($key, 6).']" value="'.$value.'" />';
$tables++;
}
}?>
<p> </p>
<p><?php echo JText::plural('COM_MIGHTYSITES_N_TABLES_ASSIGNED', $tables); ?></p>
</div>
</fieldset>
</div>
</div>
<?php
echo $pane->endPanel();
}
echo $pane->startPanel(JText::_('COM_MIGHTYSITES_TAB_SINGLE'), 'single-page');
if (!$this->item->id) {
echo JText::_('COM_MIGHTYSITES_APPLY_SETTINGS');
} else {?>
<div class="width-100" style="overflow:hidden">
<fieldset class="adminform">
<ul class="adminformlist">
<?php foreach ($this->form->getFieldset('single') as $field) : ?>
<li><?php echo $field->label; ?>
<?php echo $field->input; ?></li>
<?php endforeach; ?>
</ul>
</fieldset>
<fieldset class="adminform">
<legend><?php echo JText::_('COM_MIGHTYSITES_FIELDSET_SINGLE_SITES');?></legend>
<table class="adminlist" style="width:auto" id="singleDomainsTable">
<thead>
<tr><th><?php echo JText::_('COM_MIGHTYSITES_DOMAIN');?></th>
<th><?php echo JText::_('COM_MIGHTYSITES_SECRET_KEY');?></th>
</tr>
</thead>
<tbody>
<?php
$i = 0;
while ($this->params->get('single_domain'.(string)$i)) {?>
<tr><td><input type="text" class="inputbox" name="single_domain[]" value="<?php echo $this->params->get('single_domain'.(string)$i)?>" /></td>
<td><input type="text" class="inputbox" name="single_key[]" value="<?php echo $this->params->get('single_key'.(string)$i)?>" /></td>
</tr>
<?php
$i++;
}
if (!$i) {?>
<tr><td><input type="text" class="inputbox" name="single_domain[]" value="" /></td>
<td><input type="text" class="inputbox" name="single_key[]" value="" /></td>
</tr>
<?php }?>
</tbody>
</table>
<p></p>
<p><input type="button" class="button" onClick="return addSingleDomain()" value="<?php echo JText::_('COM_MIGHTYSITES_ADD_SINGLE_SITE');?>" /></p>
</fieldset>
</div>
<?php
echo $pane->endPanel();
}
if ($this->item->id) {
echo $pane->startPanel(JText::_('COM_MIGHTYSITES_TAB_OVERRIDES'), 'overrides-page');
?>
<div class="width-100" style="overflow:hidden">
<fieldset class="adminform">
<ul class="adminformlist">
<?php foreach ($this->form->getFieldset('overrides') as $field) : ?>
<li><?php echo $field->label; ?>
<?php echo $field->input; ?></li>
<?php endforeach; ?>
</ul>
</fieldset>
</div>
<?php
echo $pane->endPanel();
}
if ($this->item->id) {
echo $pane->startPanel(JText::_('COM_MIGHTYSITES_TAB_ADVANCED'), 'advanced-page');
?>
<div class="width-100" style="overflow:hidden">
<fieldset class="adminform">
<ul class="adminformlist">
<?php foreach ($this->form->getFieldset('advanced') as $field) : ?>
<li><?php echo $field->label; ?>
<?php echo $field->input; ?></li>
<?php endforeach; ?>
</ul>
</fieldset>
</div>
<?php
echo $pane->endPanel();
}
echo $pane->endPane();
?>
<input type="hidden" name="id" value="<?php echo $this->item->id;?>" />
<input type="hidden" name="type" value="<?php echo $this->item->type;?>" />
<input type="hidden" name="option" value="com_mightysites" />
<input type="hidden" name="task" value="" />
<?php echo JHTML::_('form.token');?>
</form>

View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>

View File

@ -0,0 +1,26 @@
<?php
/**
* @package Mightysites
* @copyright Copyright (C) 2009-2013 AlterBrains.com. All rights reserved.
* @license GNU/GPL, see LICENSE.php
*/
defined('_JEXEC') or die;
?>
<div class="control-group">
<div class="control-label"></div>
<div class="controls">
<?php echo MightysitesHelper::sitesList('tableComponentsSelect', -1, ' onchange="selectAllTo(\'tableComponents\', this.options[this.selectedIndex].value)"', $this->item->domain, JText::_('COM_MIGHTYSITES_SELECT_ALL_TO'), false, '-1', JText::_('COM_MIGHTYSITES_OWN_DATA'), '');?>
</div>
</div>
<hr/>
<?php foreach($this->tables as $table => $input) {?>
<div class="control-group">
<div class="control-label"><label><?php echo '#__', $table;?></label></div>
<div class="controls"><?php echo $input;?></div>
</div>
<?php }?>
<?php
jexit();

View File

@ -0,0 +1,21 @@
<?php
/**
* @package Mightysites
* @copyright Copyright (C) 2009-2013 AlterBrains.com. All rights reserved.
* @license GNU/GPL, see LICENSE.php
*/
defined('_JEXEC') or die;
?>
<table style="border-collapse:collapse" width="100%" cellpadding="0" cellspacing="0">
<tr class="selectAll"><td><label>&nbsp;</label></td>
<td><?php echo MightysitesHelper::sitesList('tableComponentsSelect', -1, ' onchange="selectAllTo(\'tableComponents\', this.options[this.selectedIndex].value)"', $this->item->domain, JText::_('COM_MIGHTYSITES_SELECT_ALL_TO'), false, '-1', JText::_('COM_MIGHTYSITES_OWN_DATA'), '');?></td>
</tr>
<?php foreach($this->tables as $table => $input) {?>
<tr><td><label><?php echo '#__', $table;?></label></td>
<td><?php echo $input;?></td>
</tr>
<?php }?>
</table>
<?php
jexit();

View File

@ -0,0 +1,107 @@
<?php
/**
* @package Mightysites
* @copyright Copyright (C) 2009-2013 AlterBrains.com. All rights reserved.
* @license GNU/GPL, see LICENSE.php
*/
defined('_JEXEC') or die('Restricted access');
class MightysitesViewSite extends JViewLegacy
{
protected $state;
protected $item;
protected $form;
public function display($tpl = null)
{
$this->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;
}
}

View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>

View File

@ -0,0 +1,232 @@
<?php
/**
* @package Mightysites
*
* @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die('Restricted access');
JHtml::_('bootstrap.tooltip');
JHtml::_('bootstrap.popover');
JHtml::_('behavior.multiselect');
JHtml::_('formbehavior.chosen', 'select');
JHtml::_('behavior.modal');
$user = JFactory::getUser();
$listOrder = $this->escape($this->state->get('list.ordering'));
$listDirn = $this->escape($this->state->get('list.direction'));
$sortFields = $this->getSortFields();
$this->sidebar = JHtmlSidebar::render();
?>
<script type="text/javascript">
Joomla.orderTable = function() {
table = document.getElementById("sortTable");
direction = document.getElementById("directionTable");
order = table.options[table.selectedIndex].value;
if (order != '<?php echo $listOrder; ?>') {
dirn = 'asc';
} else {
dirn = direction.options[direction.selectedIndex].value;
}
Joomla.tableOrdering(order, dirn, '');
}
Joomla.submitbutton = function(task) {
var form = document.adminForm;
if (task == 'sites.remove' && window.confirm('<?php echo JText::_('COM_MIGHTYSITES_REALLY_DELETE_DB', true); ?>')) {
/* Confirm twice! */
if (window.confirm('<?php echo JText::_('COM_MIGHTYSITES_REALLY_DELETE_DB', true); ?>')) {
form.delete_tables.value = 'true';
}
}
Joomla.submitform(task, document.getElementById('adminForm'));
}
</script>
<style type="text/css">
.table-strapless td {
background:none !important;
border:none !important;
}
.table-strapless hr {
margin:0 !important;
}
.popover {
max-width:none !important;
}
</style>
<form action="<?php echo JRoute::_('index.php?option=com_mightysites&view=sites'); ?>" method="post" name="adminForm" id="adminForm">
<?php if(!empty( $this->sidebar)): ?>
<div id="j-sidebar-container" class="span2">
<?php echo $this->sidebar; ?>
</div>
<div id="j-main-container" class="span10">
<?php else : ?>
<div id="j-main-container">
<?php endif; ?>
<div id="filter-bar" class="btn-toolbar">
<div class="filter-search btn-group pull-left">
<label for="filter_search" class="element-invisible"><?php echo JText::_('JSEARCH_FILTER'); ?></label>
<input type="text" name="filter_search" id="filter_search" placeholder="<?php echo JText::_('JSEARCH_FILTER'); ?>" value="<?php echo $this->escape($this->state->get('filter.search')); ?>" title="<?php echo JText::_('JSEARCH_FILTER'); ?>" />
</div>
<div class="btn-group pull-left">
<button class="btn hasTooltip" type="submit" title="<?php echo JText::_('JSEARCH_FILTER_SUBMIT'); ?>"><i class="icon-search"></i></button>
<button class="btn hasTooltip" type="button" title="<?php echo JText::_('JSEARCH_FILTER_CLEAR'); ?>" onclick="document.id('filter_search').value='';this.form.submit();"><i class="icon-remove"></i></button>
</div>
<div class="btn-group pull-right hidden-phone">
<label for="limit" class="element-invisible"><?php echo JText::_('JFIELD_PLG_SEARCH_SEARCHLIMIT_DESC'); ?></label>
<?php echo $this->pagination->getLimitBox(); ?>
</div>
<div class="btn-group pull-right hidden-phone">
<label for="directionTable" class="element-invisible"><?php echo JText::_('JFIELD_ORDERING_DESC'); ?></label>
<select name="directionTable" id="directionTable" class="input-medium" onchange="Joomla.orderTable()">
<option value=""><?php echo JText::_('JFIELD_ORDERING_DESC'); ?></option>
<option value="asc" <?php if ($listDirn == 'asc') echo 'selected="selected"'; ?>><?php echo JText::_('JGLOBAL_ORDER_ASCENDING'); ?></option>
<option value="desc" <?php if ($listDirn == 'desc') echo 'selected="selected"'; ?>><?php echo JText::_('JGLOBAL_ORDER_DESCENDING'); ?></option>
</select>
</div>
<div class="btn-group pull-right">
<label for="sortTable" class="element-invisible"><?php echo JText::_('JGLOBAL_SORT_BY'); ?></label>
<select name="sortTable" id="sortTable" class="input-medium" onchange="Joomla.orderTable()">
<option value=""><?php echo JText::_('JGLOBAL_SORT_BY'); ?></option>
<?php echo JHtml::_('select.options', $sortFields, 'value', 'text', $listOrder); ?>
</select>
</div>
</div>
<div class="clearfix"> </div>
<table class="table table-striped" id="weblinkList">
<thead>
<tr>
<th class="nowrap hidden-phone" width="1%" align="left"><?php echo JText::_('Num'); ?></th>
<th class="nowrap" width="1%"><input type="checkbox" name="checkall-toggle" value="" title="<?php echo JText::_('JGLOBAL_CHECK_ALL'); ?>" onclick="Joomla.checkAll(this)" /></th>
<th class="nowrap"><?php echo JHTML::_('grid.sort', 'COM_MIGHTYSITES_HEADING_SITE', 'a.domain', $listDirn, $listOrder); ?></th>
<th class="nowrap" width="25%"><?php echo JText::_('COM_MIGHTYSITES_HEADING_ACTIONS'); ?></th>
<th class="nowrap hidden-phone" width="25%"><?php echo JText::_('COM_MIGHTYSITES_HEADING_INFORMATION'); ?></th>
<th class="nowrap hidden-phone" width="5%"><?php echo JText::_('COM_MIGHTYSITES_HEADING_DATABASE_NAME'); ?></th>
<th class="nowrap hidden-phone" width="5%"><?php echo JText::_('COM_MIGHTYSITES_HEADING_DATABASE_USER'); ?></th>
<th class="nowrap hidden-phone" width="5%"><?php echo JText::_('COM_MIGHTYSITES_HEADING_DATABASE_PREFIX'); ?></th>
<!--<th class="nowrap hidden-phone" width="5%"><?php echo JText::_('COM_MIGHTYSITES_HEADING_DATABASE_TYPE'); ?></th>-->
<th class="nowrap hidden-phone" width="5%"><?php echo JText::_('COM_MIGHTYSITES_HEADING_LANGUAGE'); ?></th>
<th class="nowrap" width="1%"><?php echo JText::_('COM_MIGHTYSITES_HEADING_ONLINE'); ?></th>
<th class="nowrap" width="1%"><?php echo JHTML::_('grid.sort', 'ID', 'a.id', $listDirn, $listOrder); ?></th>
</tr>
</thead>
<tfoot>
<tr>
<td colspan="14">
<?php echo $this->pagination->getListFooter(); ?>
</td>
</tr>
</tfoot>
<tbody>
<?php 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');
?>
<tr class="row<?php echo $i % 2; ?>">
<td class="nowrap center hidden-phone"><?php echo $this->pagination->getRowOffset($i); ?></td>
<td class="center"><?php echo JHtml::_('grid.id', $i, $item->id); ?></td>
<td class="nowrap">
<?php if ($item->checked_out) : ?>
<?php echo JHtml::_('jgrid.checkedout', $i, $item->editor, $item->checked_out_time, 'sites.', $canCheckin); ?>
<?php endif; ?>
<?php if ($canEdit) {?>
<a href="<?php echo JRoute::_('index.php?option=com_mightysites&task=site.edit&id='.(int) $item->id); ?>">
<?php echo $item->title; ?></a>
<?php } else {?>
<?php echo $item->title; ?>
<?php }?>
<div class="small"><?php echo $this->escape(@$item->sitename); ?></div>
</td>
<td class="">
<?php if (JFactory::getUser()->authorise('core.edit', 'com_mightysites')) : ?>
<?php /*<a class="nowrap modal" href="<?php echo $item->link; ?>" rel="{handler: 'iframe', size: {x: 1200, y: 550}, marginInner: {x: 10, y: 0}}">*/?>
<a class="nowrap" href="#" onclick="document.siteFormConfig<?php echo $item->id ;?>.submit(); return false">
<i class="icon-cog"></i> <?php echo JText::_('COM_MIGHTYSITES_ACTION_CONFIG'); ?>
</a>
&nbsp;&nbsp;
<a class="nowrap" href="#" onclick="document.siteFormAdmin<?php echo $item->id ;?>.submit(); return false">
<i class="icon-share-alt"></i> <?php echo JText::_('COM_MIGHTYSITES_ACTION_ADMIN'); ?>
</a>
&nbsp;&nbsp;
<?php endif; ?>
<a class="nowrap" href="http://<?php echo $item->domain; ?>" target="_blank">
<i class="icon-eye"></i> <?php echo JText::_('COM_MIGHTYSITES_ACTION_PREVIEW'); ?>
</a>
</td>
<td class="hidden-phone">
<?php if (isset($item->mighty_enable) && $item->mighty_enable) : ?>
<span class="nowrap hasPopover" data-placement="right" data-content="<?php echo $item->contentTip; ?>" title="<?php echo JText::_('COM_MIGHTYSITES_INFO_CONTENT_SHARING'), ': ', JText::_('JENABLED'); ?>">
<i class="icon-ok"></i> <?php echo JText::_('COM_MIGHTYSITES_INFO_CONTENT_SHARING'); ?>
</span>
&nbsp;&nbsp;
<?php endif; ?>
<?php if (!isset($item->mighty_enable) || !$item->mighty_enable) : ?>
<span class="nowrap hasPopover" data-placement="right" data-content="<?php echo $item->contentTip; ?>" title="<?php echo JText::_('COM_MIGHTYSITES_INFO_CONTENT_SHARING'), ': ', JText::_('JDISABLED'); ?>">
<i class="icon-unpublish"></i> <?php echo JText::_('COM_MIGHTYSITES_INFO_CONTENT_SHARING'); ?>
</span>
&nbsp;&nbsp;
<?php endif; ?>
<?php if ($item->singleTip) : ?>
<span class="nowrap hasPopover" data-placement="right" data-content="<?php echo $item->singleTip; ?>" title="<?php echo JText::_('COM_MIGHTYSITES_INFO_SINGLE'); ?>">
<i class="icon-vcard"></i> <?php echo JText::_('COM_MIGHTYSITES_INFO_SINGLE'); ?>
</span>
&nbsp;&nbsp;
<?php endif; ?>
<?php if ($item->aliases) : ?>
<span class="nowrap hasPopover" data-placement="right" data-content="<?php echo nl2br($item->aliases); ?>" title="<?php echo JText::_('COM_MIGHTYSITES_INFO_ALIASES'); ?>">
<i class="icon-copy"></i> <?php echo JText::_('COM_MIGHTYSITES_INFO_ALIASES'); ?>
</span>
&nbsp;&nbsp;
<?php endif; ?>
</td>
<td class="center hidden-phone"><?php echo @$item->db; ?></td>
<td class="center hidden-phone"><?php echo @$item->user; ?></td>
<td class="center hidden-phone"><?php echo @$item->dbprefix; ?></td>
<!--<td class="center"><?php echo @$item->dbtype; ?></td>-->
<td class="center hidden-phone"><?php echo (isset($item->mighty_language) && $item->mighty_language) ? $item->mighty_language : JText::_('JDEFAULT'); ?></td>
<td class="center"><?php echo $published; ?></td>
<td class="center"><?php echo $item->id; ?></td>
</tr>
<?php }?>
</tbody>
</table>
<input type="hidden" name="option" value="com_mightysites" />
<input type="hidden" name="task" value="" />
<input type="hidden" name="boxchecked" value="0" />
<input type="hidden" name="filter_order" value="<?php echo $listOrder; ?>" />
<input type="hidden" name="filter_order_Dir" value="<?php echo $listDirn; ?>" />
<input type="hidden" name="delete_tables" value="" />
<?php echo JHTML::_('form.token'); ?>
</div>
</form>
<?php foreach ($this->items as $i => $item) : ?>
<?php echo $this->showForm($item->link, 'siteFormConfig'.$item->id); ?>
<?php echo $this->showForm($item->link2, 'siteFormAdmin'.$item->id); ?>
<?php endforeach; ?>

View File

@ -0,0 +1,180 @@
<?php
/**
* @package Mightysites
* @copyright Copyright (C) 2009-2013 AlterBrains.com. All rights reserved.
* @license GNU/GPL, see LICENSE.php
*/
defined('_JEXEC') or die('Restricted access');
$user = JFactory::getUser();
$listOrder = $this->escape($this->state->get('list.ordering'));
$listDirn = $this->escape($this->state->get('list.direction'));
JHtml::_('behavior.tooltip');
?>
<script language="javascript" type="text/javascript">
Joomla.submitbutton = function(task) {
var form = document.adminForm;
if (task == 'sites.remove' && window.confirm('<?php echo JText::_('COM_MIGHTYSITES_REALLY_DELETE_DB', true); ?>')) {
/* Confirm twice! */
if (window.confirm('<?php echo JText::_('COM_MIGHTYSITES_REALLY_DELETE_DB', true); ?>')) {
form.delete_tables.value = 'true';
}
}
Joomla.submitform(task, document.getElementById('adminForm'));
}
</script>
<form action="<?php echo JRoute::_('index.php?option=com_mightysites&view=sites'); ?>" method="post" name="adminForm" id="adminForm">
<table>
<tr>
<td align="left" width="100%">
<?php echo JText::_('JSEARCH_FILTER_LABEL'); ?>
<input type="text" name="filter_search" id="filter_search" value="<?php echo $this->escape($this->state->get('filter.search')); ?>" />
<button type="submit"><?php echo JText::_('JSEARCH_FILTER_SUBMIT'); ?></button>
<button type="button" onclick="document.id('filter_search').value='';this.form.submit();"><?php echo JText::_('JSEARCH_FILTER_CLEAR'); ?></button>
</td>
</tr>
</table>
<table class="adminlist">
<thead>
<tr>
<th nowrap="nowrap" width="1%" align="left"><?php echo JText::_('Num'); ?></th>
<th nowrap="nowrap" width="1%"><input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count($this->items); ?>);" /></th>
<th nowrap="nowrap"><?php echo JHTML::_('grid.sort', 'COM_MIGHTYSITES_HEADING_SITE', 'a.domain', $listDirn, $listOrder); ?></th>
<th nowrap="nowrap" width="25%"><?php echo JText::_('COM_MIGHTYSITES_HEADING_ACTIONS'); ?></th>
<th nowrap="nowrap" width="25%"><?php echo JText::_('COM_MIGHTYSITES_HEADING_INFORMATION'); ?></th>
<th nowrap="nowrap" width="5%"><?php echo JText::_('COM_MIGHTYSITES_HEADING_DATABASE_NAME'); ?></th>
<th nowrap="nowrap" width="5%"><?php echo JText::_('COM_MIGHTYSITES_HEADING_DATABASE_USER'); ?></th>
<th nowrap="nowrap" width="5%"><?php echo JText::_('COM_MIGHTYSITES_HEADING_DATABASE_PREFIX'); ?></th>
<!--<th nowrap="nowrap" width="5%"><?php echo JText::_('COM_MIGHTYSITES_HEADING_DATABASE_TYPE'); ?></th>-->
<th nowrap="nowrap" width="5%"><?php echo JText::_('COM_MIGHTYSITES_HEADING_LANGUAGE'); ?></th>
<th nowrap="nowrap" width="1%"><?php echo JText::_('COM_MIGHTYSITES_HEADING_ONLINE'); ?></th>
<th nowrap="nowrap" width="1%"><?php echo JHTML::_('grid.sort', 'ID', 'a.id', $listDirn, $listOrder); ?></th>
</tr>
</thead>
<tfoot>
<tr>
<td colspan="14">
<?php echo $this->pagination->getListFooter(); ?>
</td>
</tr>
</tfoot>
<tbody>
<?php
$k = 0;
if (count($this->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');
?>
<tr class="row<?php echo $i % 2; ?>">
<td><?php echo $this->pagination->getRowOffset($i); ?></td>
<td><?php echo JHtml::_('grid.id', $i, $item->id); ?></td>
<td><?php if ($item->checked_out) : ?>
<?php echo JHtml::_('jgrid.checkedout', $i, $item->editor, $item->checked_out_time, 'sites.', $canCheckin); ?>
<?php endif; ?>
<?php if ($canEdit) {?>
<a href="<?php echo JRoute::_('index.php?option=com_mightysites&task=site.edit&id='.(int) $item->id); ?>">
<?php echo $item->title; ?></a>
<?php } else {?>
<?php echo $item->title; ?>
<?php }?>
<p class="smallsub"><?php echo $this->escape(@$item->sitename); ?></p>
</td>
<td align="left" nowrap="nowrap">
<?php if (JFactory::getUser()->authorise('core.edit', 'com_mightysites')) : ?>
<?php /*<a class="modal" href="<?php echo $item->link; ?>" rel="{handler: 'iframe', size: {x: 1200, y: 550}}">*/?>
<a href="#" onclick="document.siteFormConfig<?php echo $item->id ;?>.submit(); return false">
<img src="templates/bluestork/images/menu/icon-16-config.png" alt="" border="0" align="top" /> <?php echo JText::_('COM_MIGHTYSITES_ACTION_CONFIG'); ?>
</a>
&nbsp;&nbsp;
<a href="#" onclick="document.siteFormAdmin<?php echo $item->id ;?>.submit(); return false">
<img src="templates/bluestork/images/menu/icon-16-cpanel.png" alt="" border="0" align="top" /> <?php echo JText::_('COM_MIGHTYSITES_ACTION_ADMIN'); ?>
</a>
&nbsp;&nbsp;
<?php endif; ?>
<a href="http://<?php echo $item->domain; ?>" target="_blank">
<img src="templates/bluestork/images/menu/icon-16-viewsite.png" alt="" border="0" align="top" /> <?php echo JText::_('COM_MIGHTYSITES_ACTION_PREVIEW'); ?>
</a>
</td>
<td align="left" nowrap="nowrap">
<?php if (isset($item->mighty_enable) && $item->mighty_enable) : ?>
<a href="#" class="hasTip" title="<?php echo JText::_('COM_MIGHTYSITES_INFO_CONTENT_SHARING'), ': ', JText::_('JENABLED'); ?>::<?php echo $item->contentTip; ?>">
<img alt="" src="templates/bluestork/images/admin/tick.png"/> <?php echo JText::_('COM_MIGHTYSITES_INFO_CONTENT_SHARING'); ?>
</a>
&nbsp;&nbsp;
<?php endif; ?>
<?php if (!isset($item->mighty_enable) || !$item->mighty_enable) : ?>
<a href="#" class="hasTip" title="<?php echo JText::_('COM_MIGHTYSITES_INFO_CONTENT_SHARING'), ': ', JText::_('JDISABLED'); ?>::<?php echo $item->contentTip; ?>">
<img alt="" src="templates/bluestork/images/admin/publish_x.png"/> <?php echo JText::_('COM_MIGHTYSITES_INFO_CONTENT_SHARING'); ?>
</a>
&nbsp;&nbsp;
<?php endif; ?>
<?php if ($item->singleTip) : ?>
<a href="#" target="" class="hasTip" title="<?php echo JText::_('COM_MIGHTYSITES_INFO_SINGLE'); ?>::<?php echo $item->singleTip; ?>">
<img src="templates/bluestork/images/menu/icon-16-links.png" alt="" border="0" align="top" /> <?php echo JText::_('COM_MIGHTYSITES_INFO_SINGLE'); ?>
</a>
&nbsp;&nbsp;
<?php endif; ?>
<?php if ($item->aliases) : ?>
<a href="#" target="" class="hasTip" title="<?php echo JText::_('COM_MIGHTYSITES_INFO_ALIASES'); ?>::<?php echo nl2br($item->aliases); ?>">
<img src="templates/bluestork/images/menu/icon-16-copy.png" alt="" border="0" align="top" /> <?php echo JText::_('COM_MIGHTYSITES_INFO_ALIASES'); ?>
</a>
&nbsp;&nbsp;
<?php endif; ?>
</td>
<td align="center"><?php echo @$item->db; ?></td>
<td align="center"><?php echo @$item->user; ?></td>
<td align="center"><?php echo @$item->dbprefix; ?></td>
<!--<td align="center"><?php echo @$item->dbtype; ?></td>-->
<td align="center"><?php echo (isset($item->mighty_language) && $item->mighty_language) ? $item->mighty_language : JText::_('JDEFAULT'); ?></td>
<td align="center"><?php echo $published; ?></td>
<td align="center"><?php echo $item->id; ?></td>
</tr>
<?php
}
} else {
?>
<tr><td colspan="14" align="center"><?php echo JText::_('COM_MIGHTYSITES_NO_SITES'); ?></td></tr>
<?php
}
?>
</tbody>
</table>
<input type="hidden" name="option" value="com_mightysites" />
<input type="hidden" name="task" value="" />
<input type="hidden" name="boxchecked" value="0" />
<input type="hidden" name="filter_order" value="<?php echo $listOrder; ?>" />
<input type="hidden" name="filter_order_Dir" value="<?php echo $listDirn; ?>" />
<input type="hidden" name="delete_tables" value="" />
<?php echo JHTML::_('form.token'); ?>
</form>
<?php foreach ($this->items as $i => $item) : ?>
<?php echo $this->showForm($item->link, 'siteFormConfig'.$item->id); ?>
<?php echo $this->showForm($item->link2, 'siteFormAdmin'.$item->id); ?>
<?php endforeach; ?>

View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>

View File

@ -0,0 +1,172 @@
<?php
/**
* @package Mightysites
* @copyright Copyright (C) 2009-2013 AlterBrains.com. All rights reserved.
* @license GNU/GPL, see LICENSE.php
*/
defined('_JEXEC') or die('Restricted access');
class MightysitesViewSites extends JViewLegacy
{
public function display($tpl = null)
{
$this->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 = '<b title="'.JText::_('COM_MIGHTYSITES_PRIMARY_DOMAIN').'">'.$item->domain.'</b>';
} 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 = '<table class="table-condensed table-strapless">';
foreach(MightysitesHelper::getSynchs() as $synch) {
if ($row->params->get($synch)) {
$s .= '<tr><td nowrap>'.JText::_('COM_MIGHTYSITES_SYNCH_LABEL_'.$synch).':</td><td>'.MightysitesHelper::getSite($row->params->get($synch))->domain.'</td></tr>';
$i++;
}
}
$s2 = '';
foreach($row->params->toArray() as $key => $value) {
if (strpos($key, 'table_') === 0) {
$s2 .= '<tr><td nowrap>#__'.substr($key, 6).':</td><td>'.MightysitesHelper::getSite($value)->domain.'</td></tr>';
$i++;
}
}
if ($s2) {
$s .= '<tr><td colspan="2"><hr/></td></tr>' . $s2;
}
$s .= '</table>';
return $i ? htmlspecialchars($s, ENT_COMPAT, 'UTF-8') : null;
}
protected function _getSingleInfo($row)
{
if (isset($row->mighty_sdomains) && $row->mighty_sdomains) {
$s = '<table>';
$s .= '<tr><td nowrap>'.JText::_('COM_MIGHTYSITES_FIELD_SINGLE_LOGIN').':</td><td>'.((isset($row->mighty_slogin) && $row->mighty_slogin) ? JText::_('JENABLED') : JText::_('JDISABLED')).'</td></tr>';
$s .= '<tr><td nowrap>'.JText::_('COM_MIGHTYSITES_FIELD_SINGLE_LOGOUT').':</td><td>'.((isset($row->mighty_slogout) && $row->mighty_slogout) ? JText::_('JENABLED') : JText::_('JDISABLED')).'</td></tr>';
$s .= '<tr><td colspan="2"><hr/></td></tr>';
foreach($row->mighty_sdomains as $key => $value) {
$s .= '<tr><td nowrap>'.$key.'</td></tr>';
}
$s .= '</table>';
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('&amp;', '&', $link);
$parts = parse_url($link);
$hiddens = array();
if (isset($parts['query'])) {
parse_str($parts['query'], $vars);
foreach($vars as $key => $value) {
$hiddens[] = '<input type="hidden" name="'.$key.'" value="'.$value.'" />';
}
}
$html = '<form action="'.$parts['path'].'" target="_blank" method="post" id="'.$name.'" name="'.$name.'" style="display:none">';
$html .= implode("\r\n", $hiddens);
$html .= '</form>';
return $html;
}
}

View File

@ -0,0 +1,119 @@
<?php
class JConfig {
public $offline = '0';
public $offline_message = 'Weblapunk karbantartás miatt nem érhető el.<br /> 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';
}

View File

@ -0,0 +1,119 @@
<?php
class JConfig {
public $offline = '0';
public $offline_message = 'Our website is under maintenance.<br /> 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';
}

View File

@ -0,0 +1,105 @@
<?php
class JConfig {
public $offline = '0';
public $offline_message = '';
public $display_offline_message = '1';
public $offline_image = '';
public $sitename = 'old.archline.hu';
public $editor = 'jckeditor';
public $captcha = 'recaptcha';
public $list_limit = '20';
public $access = '1';
public $debug = '0';
public $debug_lang = '0';
public $dbtype = 'mysql';
public $host = 'localhost';
public $user = 'cadline';
public $password = 'Shea6hoo';
public $db = 'www_archline_hu';
public $dbprefix = 'old_';
public $live_site = '';
public $secret = 'nhl3rxaCwEHWvgNp';
public $gzip = '0';
public $error_reporting = 'default';
public $helpurl = 'http://help.joomla.org/proxy/index.php?option=com_help&keyref=Help{major}{minor}:{keyref}';
public $ftp_host = '127.0.0.1';
public $ftp_port = '21';
public $ftp_user = 'mcleod';
public $ftp_pass = '3n3rgyDr1nk';
public $ftp_root = '';
public $ftp_enable = '0';
public $offset = 'UTC';
public $mailonline = '1';
public $mailer = 'smtp';
public $mailfrom = 'info@cadline.hu';
public $fromname = 'www.archline.hu';
public $sendmail = '/usr/sbin/sendmail';
public $smtpauth = '1';
public $smtpuser = 'www.smtp@cadline.hu';
public $smtppass = 'Chieng0t';
public $smtphost = 'localhost';
public $smtpsecure = 'none';
public $smtpport = '25';
public $caching = '0';
public $cache_handler = 'file';
public $cachetime = '15';
public $MetaDesc = 'Az ARCHLine.XP a sokoldalú építészeti és belsőépítészeti tervezés kiváló szoftvere, olyan CAD megoldás, amely magas színvonalon oldja meg a tervezési és dokumentálási feladatokat.';
public $MetaKeys = 'ARCHLine.XP, építészeti szoftver, építészeti tervező szoftver, belsőépítészeti szoftver, belsőépítészeti tervező szoftver, tervező szoftver, CAD szoftver, BIM, BIM kompatibilis,BIM szoftver, IFC, IFC kompatibilis, IFC szoftver';
public $MetaTitle = '1';
public $MetaAuthor = '0';
public $MetaVersion = '0';
public $robots = '';
public $sef = '1';
public $sef_rewrite = '1';
public $sef_suffix = '0';
public $unicodeslugs = '0';
public $feed_limit = '10';
public $log_path = '/var/www/hosting/archline.hu/www/logs';
public $tmp_path = '/var/www/hosting/archline.hu/www/tmp';
public $lifetime = '30';
public $session_handler = 'none';
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 $proxy_enable = '0';
public $proxy_host = '';
public $proxy_port = '';
public $proxy_user = '';
public $proxy_pass = '';
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 $feed_email = 'author';
public $cookie_domain = '';
public $cookie_path = '';
public $asset_id = '1';
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 = '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 = '';
}

View File

@ -0,0 +1,112 @@
<?php
class JConfig {
public $offline = '0';
public $offline_message = 'Weblapunk karbantartás miatt nem érhető el.<br /> 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';
}

View File

@ -0,0 +1,4 @@
<?php
define('MIGHTY_DOMAIN', 'archline_hu');
define('MIGHTY_CONFIG', __DIR__ . '/configuration_archline_hu.php');
require_once(MIGHTY_CONFIG);

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,140 @@
<?php
/**
* @package Mightysites
* @copyright Copyright (C) 2009-2013 AlterBrains.com. All rights reserved.
* @license GNU/GPL, see LICENSE.php
*/
defined('_JEXEC') or die('Restricted access');
class JRegistryFormatPHP extends JRegistryFormat
{
public function objectToString($object, $params = array())
{
// Build the object variables string
$vars = '';
foreach (get_object_vars($object) as $k => $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 = "<?php\nclass ".$params['class']." {\n";
$str .= $vars;
$str .= "}";
// Use the closing tag if it not set to false in parameters.
if (!isset($params['closingtag']) || $params['closingtag'] !== false) {
$str .= "\n?>";
}
// 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 :
?>
<html><body>
<form action="<?php echo base64_decode($mighty);?>" target="_top" name="adminForm" method="post">
<input type="hidden" name="mighty_saved" value="<?php echo MightysitesHelper::getHost();?>" />
</form>
<script type="text/javascript">document.adminForm.submit();</script>
</body></html>
<?php die;
break;
}
}
else {
switch ($task) {
case 'apply' :
$app->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;
}
}

View File

@ -0,0 +1,145 @@
<?php
/**
* @package Mightysites
* @copyright Copyright (C) 2009-2013 AlterBrains.com. All rights reserved.
* @license GNU/GPL, see LICENSE.php
*/
defined('_JEXEC') or die('Restricted access');
class JRegistryFormatPHP extends JRegistryFormat
{
public function objectToString($object, $params = array())
{
// Build the object variables string
$vars = '';
foreach (get_object_vars($object) as $k => $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 = "<?php\nclass ".$params['class']." {\n";
$str .= $vars;
$str .= "}";
// Use the closing tag if it not set to false in parameters.
if (!isset($params['closingtag']) || $params['closingtag'] !== false) {
$str .= "\n?>";
}
// 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:
?>
<html><body>
<form action="<?php echo base64_decode($mighty);?>" target="_top" name="adminForm" method="post">
<input type="hidden" name="mighty_saved" value="<?php echo MightysitesHelper::getHost(); ?>" />
</form>
<script type="text/javascript">document.adminForm.submit();</script>
</body></html>
<?php die;
break;
}
}
else {
switch ($task) {
case 'apply' :
case 'config.save.application.apply':
$app->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;
}
}

View File

@ -0,0 +1,174 @@
<?php
/**
* Part of the Joomla Framework Registry Package
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
namespace Joomla\Registry\Format;
use Joomla\Registry\AbstractRegistryFormat;
/**
* PHP class format handler for Registry
*
* @since 1.0
*/
class Php extends AbstractRegistryFormat
{
/**
* Converts an object into a php class string.
* - NOTE: Only one depth level is supported.
*
* @param object $object Data Source Object
* @param array $params Parameters used by the formatter
*
* @return string Config class formatted string
*
* @since 1.0
*/
public function objectToString($object, $params = array())
{
// Build the object variables string
$vars = '';
foreach (get_object_vars($object) as $k => $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 = "<?php\nclass " . $params['class'] . " {\n";
$str .= $vars;
$str .= "}";
// Use the closing tag if it not set to false in parameters.
if (!isset($params['closingtag']) || $params['closingtag'] !== false)
{
$str .= "\n?>";
}
// 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;
}
}

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,261 @@
<?php
/**
* @package Mightysites
* @copyright Copyright (C) 2009-2014 AlterBrains.com. All rights reserved.
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
/*
defined('JPATH_BASE') or die;
*/
// Setup base.
define('MIGHTY_BASE', substr(__DIR__, 0, -27));
// Setup domain. It can be already defined in alias config.
$domain = (isset($_SERVER['HTTP_HOST']) && $_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : $_SERVER['SERVER_NAME'];
if (strpos($domain, ':') !== false) {
list($domain, $tmp) = explode(':', $domain);
}
$domain = (substr($domain, 0, 4) == 'www.') ? substr($domain, 4) : $domain;
$domain = preg_replace('#([^A-Z0-9])#i', '_', $domain);
$mighty_domain = $domain;
// Setup config.
if (file_exists(MIGHTY_BASE.'/configuration_'.$mighty_domain.'.php')) {
$config_file = MIGHTY_BASE.'/configuration_'.$mighty_domain.'.php';
}
else if (file_exists(MIGHTY_BASE.'/components/com_mightysites/configuration/configuration_'.$mighty_domain.'.php')) {
$config_file = MIGHTY_BASE.'/components/com_mightysites/configuration/configuration_'.$mighty_domain.'.php';
}
else if (file_exists(MIGHTY_BASE.'/components/com_mightysites/configuration/default.php')) {
$config_file = MIGHTY_BASE.'/components/com_mightysites/configuration/default.php';
}
// Check for virtual folder
$folders = explode('/', $_SERVER['REQUEST_URI']);
if (isset($folders[1]) && $folders[1] && $folders[1] != 'administrator') {
$segment = preg_replace('#([^A-Z0-9])#i', '_', $folders[1]);
if (file_exists(MIGHTY_BASE . '/configuration_'.$mighty_domain.'_'.$segment.'.php')) {
$config_file = MIGHTY_BASE . '/configuration_'.$mighty_domain.'_'.$segment.'.php';
$mighty_domain .= '_'.$segment;
$subfolder = true;
}
else if (file_exists(MIGHTY_BASE . '/components/com_mightysites/configuration/configuration_'.$mighty_domain.'_'.$segment.'.php')) {
$config_file = MIGHTY_BASE . '/components/com_mightysites/configuration/configuration_'.$mighty_domain.'_'.$segment.'.php';
$mighty_domain .= '_'.$segment;
$subfolder = true;
}
}
// Correct possible issues with subfolder site and RewriteBase
if (!empty($subfolder))
{
if (isset($_SERVER['SCRIPT_NAME']) && $_SERVER['SCRIPT_NAME'] == '/index.php') {
$_SERVER['SCRIPT_NAME'] = '/'.$segment.'/index.php';
}
if (isset($_SERVER['PHP_SELF']) && $_SERVER['PHP_SELF'] == '/index.php') {
$_SERVER['PHP_SELF'] = '/'.$segment.'/index.php';
}
}
// Load personal config file
if (isset($config_file)) {
require_once($config_file);
}
// not for Akeeba kickstart restore
else if (!defined('KICKSTART') && !defined('_AKEEBA')) {
die('Invalid domain, please ensure that MightySites is configured properly.');
}
// Setup domain. It can be already defined in alias config.
if (!defined('MIGHTY_DOMAIN')) {
define('MIGHTY_DOMAIN', $mighty_domain);
}
// Setup config. It can be already defined in alias config.
if (!defined('MIGHTY_CONFIG')) {
define('MIGHTY_CONFIG', $config_file);
}
//error_reporting(E_ALL);
$config = new JConfig;
// Load our driver.
// sometimes configuration can be loaded by 3rd-party extensions directly, no constant or class in this case
if (defined('JPATH_SITE') && class_exists('JVersion') && isset($config->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');
}
}

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,579 @@
<?php
/**
* @package Mightysites
* @copyright Copyright (C) 2009-2013 AlterBrains.com. All rights reserved.
* @license GNU/GPL, see LICENSE.php
*/
defined('_JEXEC') or die('Restricted access');
// todo - remove once 2.5 is dead
jimport('joomla.plugin.plugin');
// Base class, actually not used but will be useful soon.
class plgSystemMightysitesBase extends JPlugin
{
}
$app = JFactory::getApplication();
$config = JFactory::getConfig();
// Frontend options
if ($app->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&amp;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&amp;'.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 = '
<div id="toolbar-box">
<div class="m">';
$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 .= '</div>
</div>';
$html .= $document->getBuffer('modules', 'submenu', array('name'=>'submenu', 'style'=>'rounded', 'id'=>'submenu-box'));
$html .= '<div id="element-box">
<div class="m">';
$contents = $document->getBuffer('component');
$contents = strtr($contents, array(
'index.php?option=com_config" ' => 'index.php?option=com_config&amp;tmpl=component&amp;mighty='.$app->input->getString('mighty').'" '
));
$html .= $contents;
$html .= '<div class="clr"></div>
</div>
</div>
';
}
else {
$html =
'<a class="btn btn-subhead" data-toggle="collapse" data-target=".subhead-collapse">'.JText::_('TPL_ISIS_TOOLBAR').'<i class="icon-wrench"></i></a>
<div class="subhead-collapse">
<div class="subhead">
<div class="container-fluid">
<div id="container-collapse" class="container-collapse"></div>
<div class="row-fluid">
<div class="span12">
'.JToolBar::getInstance('toolbar')->render('toolbar').'
</div>
</div>
</div>
</div>
</div>
<div class="container-fluid container-main">
<section id="content">
<h1 class="content-title">'.JText::_('COM_CONFIG') . ' : ' . MightysitesHelper::getHost().'</h1>
<div class="row-fluid">
<div class="span12">' .
$document->getBuffer('component') .
'</div>
</div>
</section>
</div>';
$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'));
}
}

View File

@ -0,0 +1,24 @@
<?php
/**
* @package MightySites
* @copyright Copyright (C) 2009-2013 AlterBrains.com. All rights reserved.
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
defined('JPATH_BASE') or die;
class plgSystemMightysitesInstallerScript {
function install($parent) {
JFactory::getApplication()->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!'));
}
}

View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<extension version="2.5" type="plugin" group="system" method="upgrade">
<name>PLG_SYSTEM_MIGHTYSITES</name>
<author>AlterBrains</author>
<copyright>(C) 2009-2012 AlterBrains. All rights reserved.</copyright>
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
<authorEmail>alterbrains@gmail.com</authorEmail>
<authorUrl>http://alterbrains.com</authorUrl>
<creationDate>12/03/2012</creationDate>
<version>2.1.5</version>
<description>PLG_SYSTEM_MIGHTYSITES_DESC</description>
<files>
<filename plugin="mightysites">mightysites.php</filename>
<filename>index.html</filename>
</files>
<scriptfile>mightysites.script.php</scriptfile>
<languages>
<language tag="en-GB">en-GB.plg_system_mightysites.ini</language>
<language tag="en-GB">en-GB.plg_system_mightysites.sys.ini</language>
</languages>
<config/>
</extension>

View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>

View File

@ -0,0 +1,55 @@
<?php
/**
* @package Mightysites
* @copyright Copyright (C) 2009-2013 AlterBrains.com. All rights reserved.
* @license GNU/GPL, see LICENSE.php
*/
defined('_JEXEC') or die('Restricted access');
// Frontend options
if (JFactory::getApplication()->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();
}
}
}

View File

@ -0,0 +1,22 @@
<?php
/**
* @package Mightysites
* @copyright Copyright (C) 2009-2013 AlterBrains.com. All rights reserved.
* @license GNU/GPL, see LICENSE.php
*/
class plgSystemMightysites_SingleInstallerScript
{
function install($parent) {
JFactory::getApplication()->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!'));
}
}

View File

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<extension version="2.5" type="plugin" group="system" method="upgrade">
<name>PLG_SYSTEM_MIGHTYSITES_SINGLE</name>
<author>AlterBrains</author>
<copyright>(C) 2009-2013 AlterBrains. All rights reserved.</copyright>
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
<authorEmail>alterbrains@gmail.com</authorEmail>
<authorUrl>http://alterbrains.com</authorUrl>
<creationDate>12/03/2012</creationDate>
<version>2.1.5</version>
<description>PLG_SYSTEM_MIGHTYSITES_SINGLE_DESC</description>
<files>
<filename plugin="mightysites_single">mightysites_single.php</filename>
<filename>index.html</filename>
</files>
<scriptfile>mightysites_single.script.php</scriptfile>
<languages>
<language tag="en-GB">en-GB.plg_system_mightysites_single.sys.ini</language>
</languages>
<config/>
</extension>