<commit_before><?php
/**
#  Copyright 2003-2015 Opmantek Limited (www.opmantek.com)
#
#  ALL CODE MODIFICATIONS MUST BE SENT TO <EMAIL>
#
#  This file is part of Open-AudIT.
#
#  Open-AudIT is free software: you can redistribute it and/or modify
#  it under the terms of the GNU Affero General Public License as published
#  by the Free Software Foundation, either version 3 of the License, or
#  (at your option) any later version.
#
#  Open-AudIT is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU Affero General Public License for more details.
#
#  You should have received a copy of the GNU Affero General Public License
#  along with Open-AudIT (most likely in a file named LICENSE).
#  If not, see <http://www.gnu.org/licenses/>
#
#  For further information on Open-AudIT or for a license other than AGPL please see
#  www.opmantek.com or email <EMAIL>
#
# *****************************************************************************
*
* @category  Controller
* @package   Open-AudIT
* @author    <NAME> <<EMAIL>>
* @copyright 2014 Opmantek
* @license   http://www.gnu.org/licenses/agpl-3.0.html aGPL v3
* @version   GIT: Open-AudIT_3.3.2
* @link      http://www.open-audit.org
*/

/**
* Base Object main
*
* @access   public
* @category Object
* @package  Open-AudIT
* @author   <NAME> <<EMAIL>>
* @license  http://www.gnu.org/licenses/agpl-3.0.html aGPL v3
* @link     http://www.open-audit.org
 */
class Main extends MY_Controller
{
    /**
    * Constructor
    *
    * @access    public
    */
    public function __construct()
    {
        parent::__construct();
        $this->load->model('m_users');
        $this->load->model('m_roles');
        $this->roles = $this->m_roles->collection(1);
    }


    /**
    * Constructor
    *
    * @access    public
    */
    public function index()
    {
        $this->load->helper('input');
        $this->load->helper('output');
        $this->load->helper('error');
        inputRead();
        if ($this->response->meta->format == 'json') {
            // JSON request to the base URL
            // return a document providing futher links
            $this->response->links->related = array();
            $this->response->links->related[]['href'] = $this->response->links->self . 'devices';
            $this->response->links->related[]['href'] = $this->response->links->self . 'networks';
            $this->response->links->related[]['href'] = $this->response->links->self . 'credentials';
            output($this->response);
        } else {
            $this->session->set_flashdata('error', 'main/' . __FUNCTION__ . ' no longer exists, please update your bookmarks.');
            redirect('summaries');
        }
    }

    public function summary()
    {
        #echo json_encode($this->user); exit;
        // $this->load->model('m_summaries');
        // $response = array();

        // $this->load->model('m_applications');
        // $count = $this->m_applications->count();
        // $response[] = array('name' => 'applications', 'icon' => '',  'count' => $count);

        // $this->load->model('m_attributes');
        // $count = $this->m_attributes->count();
        // $response[] = array('name' => 'attributes', 'count' => $count);

        $this->load->model('m_users');
        $this->load->model('m_orgs');
        $items = array();
        $items[] = array('name' => 'applications', 'icon' => 'fa-code');
        $items[] = array('name' => 'attributes', 'icon' => 'fa-list');
        $items[] = array('name' => 'baselines', 'icon' => 'fa-files-o');
        $items[] = array('name' => 'clouds', 'icon' => 'fa-cloud');
        $items[] = array('name' => 'clusters', 'icon' => 'fa-cubes');
        $items[] = array('name' => 'collectors', 'icon' => 'fa-cogs');
        $items[] = array('name' => 'configuration', 'icon' => 'fa-sliders');
        $items[] = array('name' => 'connections', 'icon' => 'fa-link');
        $items[] = array('name' => 'credentials', 'icon' => 'fa-shield');
        $items[] = array('name' => 'dashboards', 'icon' => 'fa-pie-chart');
        // $items[] = array('name' => 'database', 'icon' => 'fa-database');
        $items[] = array('name' => 'devices', 'icon' => 'fa-desktop');
        $items[] = array('name' => 'discoveries', 'icon' => 'fa-binoculars');
        $items[] = array('name' => 'fields', 'icon' => 'fa-list');
        $items[] = array('name' => 'files', 'icon' => 'fa-folder-open-o');
        $items[] = array('name' => 'groups', 'icon' => 'fa-tags');
        $items[] = array('name' => 'integrations', 'icon' => 'fa-exchange');
        $items[] = array('name' => 'ldap_servers', 'icon' => 'fa-address-card-o');
        // $items[] = array('name' => 'licenses', 'icon' => 'fa-leanpub');
        $items[] = array('name' => 'locations', 'icon' => 'fa-globe');
        $items[] = array('name' => 'logs', 'icon' => 'fa-bars');
        // $items[] = array('name' => 'maps', 'icon' => 'fa-map-o');
        $items[] = array('name' => 'networks', 'icon' => 'fa-wifi');
        $items[] = array('name' => 'orgs', 'icon' => 'fa-bank');
        $items[] = array('name' => 'queries', 'icon' => 'fa-table');
        $items[] = array('name' => 'racks', 'icon' => 'fa-film');
        $items[] = array('name' => 'roles', 'icon' => 'fa-lock');
        $items[] = array('name' => 'rules', 'icon' => 'fa-map-signs');
        $items[] = array('name' => 'scripts', 'icon' => 'fa-code');
        $items[] = array('name' => 'summaries', 'icon' => 'fa-file-image-o');
        $items[] = array('name' => 'tasks', 'icon' => 'fa-clock-o');
        $items[] = array('name' => 'users', 'icon' => 'fa-users');
        $items[] = array('name' => 'widgets', 'icon' => 'fa-bar-chart');
        $items = json_encode($items);
        $items = json_decode($items);
        foreach ($items as $item) {
            if ($this->m_users->get_user_permission($this->user->id, $item->name, 'r') !== false) {
                $this->load->model('m_' . $item->name);
                $item->count = $this->{'m_'.$item->name}->count();
            }
        }



        echo json_encode($items);
    }

    public function api_index()
    {
        $level = $this->uri->segment(3, 0);
        if (isset($_POST['level'])) {
            $level = $_POST['level'];
        }
        if ($level !== 'min' and $level !== 'select' and $level !== 'max') {
            $level = 'min';
        }
        if ($level === 'list') {
            $sql = 'SELECT id, concat("/omk/oae/node_config_documents/", id) as show_resource FROM system WHERE status = "production"';
        }<commit_msg>Revise icon for tasks in unused main::summary function.<commit_after><?php
/**
#  Copyright 2003-2015 Opmantek Limited (www.opmantek.com)
#
#  ALL CODE MODIFICATIONS MUST BE SENT TO CODE@OPMANTEK.COM
#
#  This file is part of Open-AudIT.
#
#  Open-AudIT is free software: you can redistribute it and/or modify
#  it under the terms of the GNU Affero General Public License as published
#  by the Free Software Foundation, either version 3 of the License, or
#  (at your option) any later version.
#
#  Open-AudIT is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU Affero General Public License for more details.
#
#  You should have received a copy of the GNU Affero General Public License
#  along with Open-AudIT (most likely in a file named LICENSE).
#  If not, see <http://www.gnu.org/licenses/>
#
#  For further information on Open-AudIT or for a license other than AGPL please see
#  www.opmantek.com or email <EMAIL>
#
# *****************************************************************************
*
* @category  Controller
* @package   Open-AudIT
* @author    <NAME> <<EMAIL>>
* @copyright 2014 Opmantek
* @license   http://www.gnu.org/licenses/agpl-3.0.html aGPL v3
* @version   GIT: Open-AudIT_3.3.2
* @link      http://www.open-audit.org
*/

/**
* Base Object main
*
* @access   public
* @category Object
* @package  Open-AudIT
* @author   <NAME> <<EMAIL>>
* @license  http://www.gnu.org/licenses/agpl-3.0.html aGPL v3
* @link     http://www.open-audit.org
 */
class Main extends MY_Controller
{
    /**
    * Constructor
    *
    * @access    public
    */
    public function __construct()
    {
        parent::__construct();
        $this->load->model('m_users');
        $this->load->model('m_roles');
        $this->roles = $this->m_roles->collection(1);
    }


    /**
    * Constructor
    *
    * @access    public
    */
    public function index()
    {
        $this->load->helper('input');
        $this->load->helper('output');
        $this->load->helper('error');
        inputRead();
        if ($this->response->meta->format == 'json') {
            // JSON request to the base URL
            // return a document providing futher links
            $this->response->links->related = array();
            $this->response->links->related[]['href'] = $this->response->links->self . 'devices';
            $this->response->links->related[]['href'] = $this->response->links->self . 'networks';
            $this->response->links->related[]['href'] = $this->response->links->self . 'credentials';
            output($this->response);
        } else {
            $this->session->set_flashdata('error', 'main/' . __FUNCTION__ . ' no longer exists, please update your bookmarks.');
            redirect('summaries');
        }
    }

    public function summary()
    {
        #echo json_encode($this->user); exit;
        // $this->load->model('m_summaries');
        // $response = array();

        // $this->load->model('m_applications');
        // $count = $this->m_applications->count();
        // $response[] = array('name' => 'applications', 'icon' => '',  'count' => $count);

        // $this->load->model('m_attributes');
        // $count = $this->m_attributes->count();
        // $response[] = array('name' => 'attributes', 'count' => $count);

        $this->load->model('m_users');
        $this->load->model('m_orgs');
        $items = array();
        $items[] = array('name' => 'applications', 'icon' => 'fa-snowflake-o');
        $items[] = array('name' => 'attributes', 'icon' => 'fa-list');
        $items[] = array('name' => 'baselines', 'icon' => 'fa-files-o');
        $items[] = array('name' => 'clouds', 'icon' => 'fa-cloud');
        $items[] = array('name' => 'clusters', 'icon' => 'fa-cubes');
        $items[] = array('name' => 'collectors', 'icon' => 'fa-cogs');
        $items[] = array('name' => 'configuration', 'icon' => 'fa-sliders');
        $items[] = array('name' => 'connections', 'icon' => 'fa-link');
        $items[] = array('name' => 'credentials', 'icon' => 'fa-shield');
        $items[] = array('name' => 'dashboards', 'icon' => 'fa-dashboard');
        // $items[] = array('name' => 'database', 'icon' => 'fa-database');
        $items[] = array('name' => 'devices', 'icon' => 'fa-desktop');
        $items[] = array('name' => 'discoveries', 'icon' => 'fa-binoculars');
        //$items[] = array('name' => 'discovery_scan_options', 'icon' => 'fa-random');
        $items[] = array('name' => 'fields', 'icon' => 'fa-comments-o');
        $items[] = array('name' => 'files', 'icon' => 'fa-file-image-o');
        //$items[] = array('name' => 'floors', 'icon' => 'fa-sort-numeric-desc');
        $items[] = array('name' => 'groups', 'icon' => 'fa-tags');
        $items[] = array('name' => 'integrations', 'icon' => 'fa-exchange');
        $items[] = array('name' => 'ldap_servers', 'icon' => 'fa-address-card-o');
        // $items[] = array('name' => 'licenses', 'icon' => 'fa-leanpub');
        $items[] = array('name' => 'locations', 'icon' => 'fa-building');
        $items[] = array('name' => 'logs', 'icon' => 'fa-bars');
        // $items[] = array('name' => 'maps', 'icon' => 'fa-map-o');
        $items[] = array('name' => 'networks', 'icon' => 'fa-wifi');
        $items[] = array('name' => 'orgs', 'icon' => 'fa-bank');
        $items[] = array('name' => 'queries', 'icon' => 'fa-table');
        $items[] = array('name' => 'racks', 'icon' => 'fa-film');
        $items[] = array('name' => 'roles', 'icon' => 'fa-lock');
        // $items[] = array('name' => 'rooms', 'icon' => 'fa-plus-square-o');
        // $items[] = array('name' => 'rows', 'icon' => 'fa-hashtag');
        $items[] = array('name' => 'rules', 'icon' => 'fa-map-signs');
        $items[] = array('name' => 'scripts', 'icon' => 'fa-code');
        $items[] = array('name' => 'summaries', 'icon' => 'fa-pie-chart');
        $items[] = array('name' => 'tasks', 'icon' => 'fa-clock-o');
        $items[] = array('name' => 'users', 'icon' => 'fa-users');
        $items[] = array('name' => 'widgets', 'icon' => 'fa-bar-chart');
        $items = json_encode($items);
        $items = json_decode($items);
        foreach ($items as $item) {
            if ($this->m_users->get_user_permission($this->user->id, $item->name, 'r') !== false) {
                $this->load->model('m_' . $item->name);
                $item->count = $this->{'m_'.$item->name}->count();
            }
        }



        echo json_encode($items);
    }

    public function api_index()
    {
        $level = $this->uri->segment(3, 0);
        if (isset($_POST['level'])) {
            $level = $_POST['level'];
        }
        if ($level !== 'min' and $level !== 'select' and $level !== 'max') {
            $level = 'min';
        }
        if ($level === 'list') {
            $sql = 'SELECT id, concat("/omk/oae/node_config_documents/", id) as show_resource FROM system WHERE status = "production"';
        }
{'fraction_non_alphanumeric': 0.22558409519663328, 'fraction_numerical': 0.0036279204759831663, 'mean_word_length': 2.6813568376068377, 'pattern_counts': {'":': 0, '<': 22, '<?xml version=': 0, '>': 308, 'https://': 0, 'lorem ipsum': 0, 'www.': 14, 'xml': 0}, 'pii_count': 1, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4033352', 'n_tokens_mistral': 4421, 'n_tokens_neox': 4353, 'n_words': 1017}