<?php
/**
  * Ahead WebSoft Technologies Pvt Ltd.
  * @copyright  Copyright 2006-2026 Ahead WebSoft Technologies Pvt Ltd.
  * @license    https://www.socialengine.com/policies
*/
class IndexController extends Zend_Controller_Action
{
  public function indexAction()
  {
    // If we haven't installed yet
    if( !Zend_Registry::get('Engine/Installed') ) {
      return $this->_helper->redirector->gotoRoute(array('action' => 'sanity'), 'install', true);
    }
    
    // Get auth info
    $auth = Zend_Registry::get('Zend_Auth');
    $this->view->identity = $identity = $auth->getIdentity();

    // We have installed and are logged in
    if( $identity ) {
      return $this->_helper->redirector->gotoRoute(array(), 'manage', true);
    }

    // We have to login
    else {
      return $this->_helper->redirector->gotoRoute(array(), 'login', true);
    }
  }
}
