<?php

// Build on top of framework authentication controller
AngieApplication::useController('fw_authentication', AUTHENTICATION_FRAMEWORK);
class FrossoAuthController extends FwAuthenticationController
{
    /**
     * Active module
     *
     * @var string
     */
    protected $active_module = FROSSO_AUTH_MODULE;
    function __before()
    {
        // 		parent::__before();
    }
    /**
     * Log user in
     */
    function login()
    {
        $params = $this->request->get('params', false);
        if ($params) {
            $rsa = new Crypt_RSA();
            $my_pub_key = ConfigOptions::getValue('frosso_auth_my_pub_key');
            $my_pri_key = ConfigOptions::getValue('frosso_auth_my_pri_key');
            $rsa->loadKey($my_pri_key);
            $decrypted_params = $rsa->decrypt($params);
            if ($decrypted_params) {
                list($email, $token, $timestamp) = explode(';', $decrypted_params);
                if ($email && $token && $timestamp) {
<?php

// Build on top of administration controller
AngieApplication::useController('admin', SYSTEM_MODULE);
/**
 * Tasks administration controller
 *
 * @package activeCollab.modules.tasks
 * @subpackage controllers
*/
class FrossoAuthAdminController extends AdminController
{
    function __construct($parent)
    {
        parent::__construct($parent);
    }
    function index()
    {
        if ($this->request->isAsyncCall()) {
            $my_pub_key = ConfigOptions::getValue('frosso_auth_my_pub_key', false);
            $my_pri_key = ConfigOptions::getValue('frosso_auth_my_pri_key', false);
            $token = ConfigOptions::getValue('frosso_auth_my_pri_token', false);
            $this->smarty->assign(array('my_pub_key' => $my_pub_key, 'my_pri_key' => $my_pri_key, 'token' => $token));
            if ($this->request->isSubmitted()) {
                $my_pub_sub = $this->request->post('my_pub_key');
                $my_pri_sub = $this->request->post('my_pri_key');
                $sub_token = $this->request->post('token');
                if ($sub_token) {
                    if (FrossoAuthModel::isValidKey($my_pub_sub, $my_pri_sub)) {
                        ConfigOptions::setValue('frosso_auth_my_pub_key', $my_pub_sub);
                        ConfigOptions::setValue('frosso_auth_my_pri_key', $my_pri_sub);
<?php

// We need projects controller
AngieApplication::useController('milestones', SYSTEM_MODULE);
/**
 * MilestonesTrackingController controller
 *
*/
class MilestonesTrackingController extends MilestonesController
{
    /**
     * Active module
     *
     * @var string
     */
    protected $active_module = FROSSO_EC_MODULE;
    /**
     * Object tracking controller delegate
     *
     * @var ObjectTrackingController
     */
    protected $object_tracking_delegate;
    /**
     * Construct controller
     *
     * @param Request $parent
     * @param mixed $context
     */
    function __construct($parent, $context = null)
    {
        parent::__construct($parent, $context);
<?php

// We need projects controller
AngieApplication::useController('project', SYSTEM_MODULE);
class FrossoGanttChartController extends ProjectController
{
    /**
     * Construct controller
     *
     * @param Request $parent
     * @param mixed $context
     */
    function __construct($parent, $context = null)
    {
        parent::__construct($parent, $context);
    }
    /**
     * Prepare controller
     */
    function __before()
    {
        parent::__before();
        if (!Tasks::canAccess($this->logged_user, $this->active_project)) {
            $this->response->forbidden();
        }
        // if
        // load project tabs
        //$project_tabs = $this->active_project->getTabs($this->logged_user, AngieApplication::INTERFACE_DEFAULT);
        $this->wireframe->tabs->setCurrentTab('fred_gc');
        $this->wireframe->breadcrumbs->add('frosso_gc_route', lang('FRosso GC'), Router::assemble('frosso_gc_route', array('project_slug' => $this->active_project->getSlug())));
    }
<?php

AngieApplication::useController('tasks', TASKS_MODULE);
class FrossoTasksTabModController extends TasksController
{
    /**
     * Construct controller
     *
     * @param Request $parent
     * @param mixed $context
     */
    function __construct($parent, $context = null)
    {
        parent::__construct($parent, $context);
    }
    /**
     * Prepare controller
     */
    function __before()
    {
        parent::__before();
    }
    function index()
    {
        parent::index();
        $this->response->assign(array('tasks' => FrossoTasksTabModModel::findForObjectsList($this->active_project, $this->logged_user)));
    }
    function view()
    {
        parent::view();
        //TODO: cambiare il template
<?php

// We need admin controller
AngieApplication::useController('source_admin', SOURCE_MODULE);
/**
 * Ac Gitolite Source Controller 
 * @package activeCollab.modules.ac_gitolite
 * @subpackage controllers
 * @author rtCamp Software Solutions Pvt Ltd <*****@*****.**>
 * @author Rahul Bansal <*****@*****.**>
 * @author Kasim Badami <*****@*****.**>
 * @author Mitesh Shah <*****@*****.**>
 * @author strik3r <*****@*****.**>
 */
class AcGitoliteSourceController extends SourceAdminController
{
    protected $active_repository;
    /**
     * Prepare controller
     */
    function __before()
    {
        parent::__before();
        $repository_id = $this->request->getId('source_repository_id');
        if ($repository_id) {
            $this->active_repository = SourceRepositories::findById($repository_id);
            if ($this->active_repository instanceof SourceRepository && !$this->active_repository instanceof GitRepository) {
                $this->httpError(HTTP_ERR_CONFLICT);
            }
        }
        if (!$this->active_repository instanceof GitRepository) {
<?php

require_once SOURCE_MODULE_PATH . '/engines/git.class.php';
// Build on top of system module
AngieApplication::useController('repository', SOURCE_MODULE);
/**
 * Project Tracking Gitolite Controller controller implementation
 *
 * @package custom.modules.ac_gitolite
 * @subpackage controllers
 * @author rtCamp Software Solutions Pvt Ltd <*****@*****.**>
 * @author Rahul Bansal <*****@*****.**>
 * @author Kasim Badami <*****@*****.**>
 * @author  Mitesh Shah <*****@*****.**>
 *
 */
class ProjectTrackingGitoliteController extends RepositoryController
{
    function __before()
    {
        parent::__before();
    }
    /**
     * Project Tracking Gitolite
     * Add "Add New Git Repository" option under source tab.
     * Check for allowed repository as per the permissions
     */
    function index()
    {
        parent::index();
        // check whether user have access to add repositories
<?php

// Build on top of backend controller
AngieApplication::useController('backend', ENVIRONMENT_FRAMEWORK_INJECT_INTO);
/**
 * System level timer
 *
 * @package activeCollab.modules.timer
 * @subpackage controllers
 */
class TimerController extends BackendController
{
    /**
     * Active module
     *
     * @var string
     */
    protected $active_module = WEB_TIMER_MODULE;
    /**
     * Prepare controller
     */
    function __before()
    {
        parent::__before();
        $this->wireframe->tabs->clear();
        $this->wireframe->tabs->add('calendar', lang('Timer'), TimerModule::getTimerRoute(), null, true);
        // Custom event
        EventsManager::trigger('on_timer_tabs', array(&$this->wireframe->tabs, &$this->logged_user));
        // set wireframe
        $this->wireframe->breadcrumbs->add('timer', lang('Timer'), TimerModule::getTimerRoute());
        $this->wireframe->setCurrentMenuItem('timer');
<?php

// Build on top of reports module
AngieApplication::useController('reports', REPORTS_FRAMEWORK_INJECT_INTO);
class FrossoTestingController extends ReportsController
{
    /**
     * Index action
     */
    function index()
    {
        $rsa = new Crypt_RSA();
        $rsa->loadKey(ConfigOptions::getValue('frosso_auth_my_pub_key'));
        $text = 'frosso@remedia.it;' . ConfigOptions::getValue('frosso_auth_my_pri_token', false) . ';' . time();
        $crypt = $rsa->encrypt($text);
        echo '<textarea cols="200">' . $crypt . "</textarea>";
        echo '<br/><textarea cols="200">' . urlencode($crypt) . "</textarea>";
        $this->response->badRequest();
    }
}
<?php

// We need projects controller
AngieApplication::useController('milestone_tasks', TASKS_MODULE);
class FrossoMilestoneTaskAssigneeController extends MilestoneTasksController
{
    /**
     * Active module
     *
     * @var string
     */
    protected $active_module = FROSSO_MTA_MODULE;
    /**
     * construct Controller
     */
    function __construct($parent, $context = null)
    {
        parent::__construct($parent, $context);
    }
    /**
     * Prepare controller
     */
    function __before()
    {
        parent::__before();
    }
    function index()
    {
        parent::index();
        if ($this->request->isWebBrowser()) {
            $milestone_tasks_per_page = 30;
<?php

AngieApplication::useController('users', SYSTEM_MODULE);
/**
 * AcGitoliteController controller
 *
 * @package activeCollab.modules.ac_gitolite
 * @subpackage controllers
 * @author rtCamp Software Solutions Pvt Ltd<*****@*****.**>
 * @author Rahul Bansal <*****@*****.**>
 * @author Kasim Badami <*****@*****.**>
 * @author  Mitesh Shah <*****@*****.**>
 */
class AcGitoliteController extends UsersController
{
    /**
     * List public keys in inline tabs
     * @return void
     */
    function getpublickeys()
    {
        $active_user = $this->active_user;
        $user_public_keys = GitoliteAc::fetch_keys($active_user->getId());
        $is_gitolite = GitoliteAdmin::is_gitolite();
        $this->smarty->assign(array('user_public_keys' => $user_public_keys, 'icon' => AngieApplication::getImageUrl('layout/button-add.png', ENVIRONMENT_FRAMEWORK, AngieApplication::getPreferedInterface()), 'delete_icon' => AngieApplication::getImageUrl('icons/12x12/delete.png', ENVIRONMENT_FRAMEWORK, AngieApplication::getPreferedInterface()), 'add_url' => Router::assemble('add_public_keys', array('company_id' => $active_user->getCompanyId(), 'user_id' => $active_user->getId())), 'del_url' => $this->active_user->getViewUrl(), 'is_gitolite' => $is_gitolite));
    }
    /**
     * Add new public key of user. Create .pub file gitolite admin directory
     * @return void
     */
    function add_public_keys()