<div class="clr"></div> </div> </div> <div id="mc-footer"> <div class="mc-wrapper"> <p class="copyright"> <span class="mc-footer-logo"></span> <a href="http://www.GetAnahita.com" target="_blank">Anahita Social Networking Platform and Framework</a> <?php echo JText::_('ISFREESOFTWARE'); ?> - Anahita <?php echo JText::_('Version'); ?> <?php echo Anahita::getVersion(); ?> <br /> <?php echo JText::_('MISSION_CONTROL_FOOTER'); ?> (MC Version <?php echo CURRENT_VERSION; ?> ) </p> </div> </div> <div id="mc-message"> </div>
jimport('joomla.application.router'); jimport('joomla.user.user'); jimport('joomla.environment.uri'); jimport('joomla.html.html'); jimport('joomla.html.parameter'); jimport('joomla.utilities.utility'); jimport('joomla.event.event'); jimport('joomla.event.dispatcher'); jimport('joomla.language.language'); jimport('joomla.utilities.string'); jimport('joomla.plugin.helper'); require_once JPATH_CONFIGURATION . '/configuration.php'; require_once JPATH_LIBRARIES . '/anahita/anahita.php'; $config = new JConfig(); //instantiate anahita and nooku Anahita::getInstance(array('cache_prefix' => md5($config->secret) . '-cache-koowa', 'cache_enabled' => $config->caching)); KServiceIdentifier::setApplication('site', JPATH_SITE); KServiceIdentifier::setApplication('admin', JPATH_ADMINISTRATOR); KLoader::addAdapter(new AnLoaderAdapterComponent(array('basepath' => JPATH_BASE))); KServiceIdentifier::addLocator(KService::get('anahita:service.locator.component')); KLoader::addAdapter(new KLoaderAdapterPlugin(array('basepath' => JPATH_ROOT))); KServiceIdentifier::addLocator(KService::get('koowa:service.locator.plugin')); KLoader::addAdapter(new AnLoaderAdapterTemplate(array('basepath' => JPATH_BASE))); KServiceIdentifier::addLocator(KService::get('anahita:service.locator.template')); KService::setAlias('koowa:database.adapter.mysqli', 'com://admin/default.database.adapter.mysqli'); KService::setAlias('anahita:domain.store.database', 'com:base.domain.store.database'); KService::setAlias('anahita:domain.space', 'com:base.domain.space'); //make sure for the autoloader to be reigstered after nooku $autoloader = (require_once JPATH_VENDOR . '/autoload.php'); $autoloader->unregister(); $autoloader->register();
/** * Creates the admin user */ public static function createAdminUser(&$vars) { $DBtype = JArrayHelper::getValue($vars, 'DBtype', 'mysqli'); $DBhostname = JArrayHelper::getValue($vars, 'DBhostname', ''); $DBuserName = JArrayHelper::getValue($vars, 'DBuserName', ''); $DBpassword = JArrayHelper::getValue($vars, 'DBpassword', ''); $DBname = JArrayHelper::getValue($vars, 'DBname', ''); $DBPrefix = JArrayHelper::getValue($vars, 'DBPrefix', ''); $adminPassword = JArrayHelper::getValue($vars, 'adminPassword', ''); $adminEmail = JArrayHelper::getValue($vars, 'adminEmail', ''); jimport('joomla.user.helper'); // Create random salt/password for the admin user $salt = JUserHelper::genRandomPassword(32); $crypt = JUserHelper::getCryptedPassword($adminPassword, $salt); $cryptpass = $crypt . ':' . $salt; $db =& JInstallationHelper::getDBO($DBtype, $DBhostname, $DBuserName, $DBpassword, $DBname, $DBPrefix); $vars = array_merge(array('adminLogin' => 'admin', 'adminName' => 'Administrator'), $vars); $adminLogin = $vars['adminLogin']; $adminName = $vars['adminName']; // create the admin user $installdate = date('Y-m-d H:i:s'); $nullDate = $db->getNullDate(); $query = "INSERT INTO #__users VALUES (62, '{$adminName}', '{$adminLogin}', " . $db->Quote($adminEmail) . ", " . $db->Quote($cryptpass) . ", 'Super Administrator', 0, 1, 25, '{$installdate}', '{$nullDate}', '', '')"; $db->setQuery($query); if (!$db->query()) { // is there already and existing admin in migrated data if ($db->getErrorNum() == 1062) { $vars['adminLogin'] = JText::_('Admin login in migrated content was kept'); $vars['adminPassword'] = JText::_('Admin password in migrated content was kept'); return; } else { echo $db->getErrorMsg(); return; } } // add the ARO (Access Request Object) $query = "INSERT INTO #__core_acl_aro VALUES (10,'users','62',0,'Administrator',0)"; $db->setQuery($query); if (!$db->query()) { echo $db->getErrorMsg(); return; } // add the map between the ARO and the Group $query = "INSERT INTO #__core_acl_groups_aro_map VALUES (25,'',10)"; $db->setQuery($query); if (!$db->query()) { echo $db->getErrorMsg(); return; } //Anahita Installation require_once JPATH_LIBRARIES . '/anahita/anahita.php'; //instantiate anahita and nooku Anahita::getInstance(array('cache_prefix' => uniqid(), 'cache_enabled' => false)); KServiceIdentifier::setApplication('site', JPATH_SITE); KServiceIdentifier::setApplication('admin', JPATH_ADMINISTRATOR); KLoader::addAdapter(new AnLoaderAdapterComponent(array('basepath' => JPATH_BASE))); KServiceIdentifier::addLocator(KService::get('anahita:service.locator.component')); KLoader::addAdapter(new KLoaderAdapterPlugin(array('basepath' => JPATH_ROOT))); KServiceIdentifier::addLocator(KService::get('koowa:service.locator.plugin')); KService::setAlias('anahita:domain.space', 'com:base.domain.space'); KService::set('koowa:database.adapter.mysqli', KService::get('koowa:database.adapter.mysqli', array('connection' => $db->_resource, 'table_prefix' => $DBPrefix))); KService::set('anahita:domain.store.database', KService::get('anahita:domain.store.database', array('adapter' => KService::get('koowa:database.adapter.mysqli')))); KService::set('plg:storage.default', new KObject()); $person = KService::get('repos://site/people')->getEntity()->setData(array('name' => $adminName, 'userId' => 62, 'username' => $adminLogin, 'userType' => 'Super Administrator', 'email' => $adminEmail)); $note = KService::get('repos://site/notes')->getEntity()->setData(array('author' => $person, 'owner' => $person, 'body' => 'Welcome to Anahita!')); $comment = $note->addComment(array('author' => $person, 'body' => 'The best Social Platform there is', 'component' => 'com_notes')); $story = KService::get('repos://site/stories')->getEntity()->setData(array('component' => 'com_notes', 'name' => 'note_comment', 'object' => $note, 'comment' => $comment, 'target' => $person, 'owner' => $person, 'subject' => $person)); $entities = array(); $comment->save($entities); return true; }