Example #1
0
 public function prepare()
 {
     $user = new User(1);
     if (!$user->isAuthorized()) {
         $this->redirect('?r=auth');
     }
     $header = new PageHeader($this->curpage, $this->db, $this->config);
     $footer = new PageFooter($this->curpage, $this->db, $this->config);
     $topMenu = new TopMenu($this->curpage, $this->db, $this->config);
     $topMenu->prepare();
     $tasksList = new JsonDB(__taskdb);
     $id = (int) $_GET['id'];
     if (isset($tasksList->data[$id])) {
         $this->data['taskTitle'] = $tasksList->data[$id]['title'];
         $header->data['title'] = $this->_LANG['store']['Store'] . ' / ' . $this->_LANG['store']['Local'] . ' / ' . $tasksList->data[$id]['title'];
     } else {
         $this->data['taskTitle'] = $this->_LANG['store']['undefined'];
         $header->data['title'] = $this->_LANG['store']['Store'] . ' / ' . $this->_LANG['store']['Local'] . ' / ' . $this->_LANG['store']['undefined'];
     }
     $this->data['files'] = $this->getlFolderFiles();
     $this->data['taskId'] = $id;
     $this->data['header'] = $header->show();
     $this->data['footer'] = $footer->show();
     $this->data['topMenu'] = $topMenu->show();
 }
Example #2
0
 /**
  * Get the actions for a given section & role
  * @param $section name
  */
 function get($options = null)
 {
     $results = array();
     $defaultOptions = array('context' => 'default', 'action' => '*', 'controller' => '*', 'shortName' => false);
     // Use tab to refine context on index only, as in users:index:archived
     if ($options['action'] == 'index' && !isset($options['tab'])) {
         $defaultOptions['tab'] = '*';
     }
     // Override defaults options with given (if any)
     $options = array_merge($defaultOptions, $options);
     // get the action list
     $map = $this->__get($options);
     //format the action with url, class, options
     foreach ($map as $k => $item) {
         list($controller, $action) = explode(':', $item);
         if ($controller == '*') {
             $controller = $options['controller'];
         }
         $results[$k]['name'] = Action::getName($action, $controller, $options['shortName']);
         $results[$k]['url'] = DS . $controller . DS . $action;
         $results[$k]['options']['class'] = $controller . ' ' . $action;
         $results[$k]['options']['disabled'] = !User::isAuthorized($controller, $action);
     }
     return $results;
 }
Example #3
0
 public function prepare()
 {
     $user = new User(1);
     if (!$user->isAuthorized()) {
         $this->redirect('?r=auth');
     }
     $header = new PageHeader($this->curpage, $this->db, $this->config);
     $footer = new PageFooter($this->curpage, $this->db, $this->config);
     $topMenu = new TopMenu($this->curpage, $this->db, $this->config);
     $topMenu->prepare();
     $serversList = new JsonDB(__serversdb);
     $sid = (int) $_GET['sid'];
     $fid = (int) $_GET['fid'];
     $serverTitle = $this->_LANG['store']['undefined'];
     $taskTitle = $this->_LANG['store']['undefined'];
     if (isset($serversList->data[$sid])) {
         $serverTitle = $serversList->data[$sid]['name'];
     }
     if (isset($serversList->data[$sid]['tasks'][$fid])) {
         $taskTitle = $serversList->data[$sid]['tasks'][$fid]['title'];
     }
     $header->data['title'] = $this->_LANG['store']['Store'] . " / " . $this->_LANG['store']['Remote'] . " / {$serverTitle} / {$taskTitle}";
     $this->data['serverTitle'] = $serverTitle;
     $this->data['taskTitle'] = $taskTitle;
     $this->data['files'] = $this->getlFolderFiles($serversList, $sid, $fid);
     $this->data['taskId'] = $fid;
     $this->data['serverId'] = $sid;
     $this->data['header'] = $header->show();
     $this->data['footer'] = $footer->show();
     $this->data['topMenu'] = $topMenu->show();
 }
Example #4
0
 public function prepare()
 {
     $user = new User(1);
     if (!$user->isAuthorized()) {
         $this->redirect('?r=auth');
     }
     $fileName = str_replace('/', '', $_GET['fileName']);
     $folder = str_replace('.', '', $_GET['folder']);
     $taskId = str_replace('.', '', $_GET['taskId']);
     $serverId = '';
     if (isset($_GET['serverId'])) {
         $serverId = (int) $_GET['serverId'];
     }
     if (!$user->checkRights('manager')) {
         addNotification($this->_LANG['misc']["You don't have permissions"], 'warning');
         $this->redirect('?r=store/' . $folder . '/folder&fid=' . $taskId . '&sid=' . $serverId);
     }
     switch ($folder) {
         case 'local':
             $path = __archiveDIR . "local/{$taskId}/{$fileName}";
             break;
         case 'remote':
             $path = __archiveDIR . "servers/{$serverId}/{$taskId}/{$fileName}";
             break;
     }
     //echo $path;
     if (file_exists($path)) {
         header('Content-Description: File Transfer');
         header('Content-Type: application/octet-stream');
         header('Content-Length: ' . filesize($path));
         header('Content-Disposition: attachment; filename=' . basename($path));
         readfile($path);
     }
     die;
 }
Example #5
0
 /**
  * Authorization checking callback
  * @return boolean, true if action is allowed
  */
 function isAuthorized()
 {
     if (!in_array($this->Controller->action, $this->whitelist)) {
         return User::isAuthorized($this->Controller->name, $this->Controller->action);
     }
     return true;
 }
Example #6
0
 public function prepare()
 {
     $user = new User(1);
     if (!$user->isAuthorized()) {
         $this->redirect('?r=auth');
     }
     $header = new PageHeader($this->curpage, $this->db, $this->config);
     $footer = new PageFooter($this->curpage, $this->db, $this->config);
     $topMenu = new TopMenu($this->curpage, $this->db, $this->config);
     $topMenu->prepare();
     $header->data['title'] = $this->_LANG['servers']['Connect to the server'];
     $this->data['header'] = $header->show();
     $this->data['footer'] = $footer->show();
     $this->data['topMenu'] = $topMenu->show();
     if (isset($_SESSION['formSent']) && !empty($_SESSION['formSent'])) {
         $formsent = $_SESSION['formSent'];
     }
     if (!isset($formsent['address'])) {
         $formsent['address'] = '';
     }
     if (!isset($formsent['apiKey'])) {
         $formsent['apiKey'] = '';
     }
     $this->data['formSent'] = $formsent;
     $_SESSION['formSent'] = array();
 }
 public function prepare()
 {
     $user = new User(1);
     if (!$user->isAuthorized()) {
         $this->redirect('?r=auth');
     }
     $header = new PageHeader($this->curpage, $this->db, $this->config);
     $footer = new PageFooter($this->curpage, $this->db, $this->config);
     $topMenu = new TopMenu($this->curpage, $this->db, $this->config);
     $topMenu->prepare();
     $header->data['title'] = $this->_LANG['tasks']['Edit MYSQL backup task'];
     $this->data['widgets'] = new Widgets($this->db, __corePath . 'widgets/', $this->config);
     $this->data['header'] = $header->show();
     $this->data['footer'] = $footer->show();
     $this->data['topMenu'] = $topMenu->show();
     $serversList = new JsonDB(__serversdb);
     $id = (int) $_GET['id'];
     $sid = (int) $_GET['sid'];
     $formsent = $serversList->data[$sid]['tasks'][$id];
     if (isset($_SESSION['formSent']) && !empty($_SESSION['formSent'])) {
         $formsent = $_SESSION['formSent'];
     }
     $_SESSION['formSent'] = array();
     if (!isset($formsent['title'])) {
         $formsent['title'] = '';
     }
     if (!isset($formsent['type'])) {
         $formsent['type'] = '';
     }
     if (!isset($formsent['status'])) {
         $formsent['status'] = '';
     }
     if (!isset($formsent['deep'])) {
         $formsent['deep'] = '';
     }
     if (!isset($formsent['mysql-backup-filename'])) {
         $formsent['mysql-backup-filename'] = '';
     }
     if (!isset($formsent['mysql-backup-address'])) {
         $formsent['mysql-backup-address'] = '';
     }
     if (!isset($formsent['mysql-backup-name'])) {
         $formsent['mysql-backup-name'] = '';
     }
     if (!isset($formsent['mysql-backup-user'])) {
         $formsent['mysql-backup-user'] = '';
     }
     if (!isset($formsent['mysql-backup-password'])) {
         $formsent['mysql-backup-password'] = '';
     }
     $this->data['task'] = $formsent;
     $this->data['serverName'] = $serversList->data[$sid]['name'];
     $this->data['id'] = $id;
     $this->data['sid'] = $sid;
     $_SESSION['formSent'] = array();
 }
Example #8
0
 public function execute()
 {
     sleep(1);
     $login = htmlspecialchars($_POST['login'], ENT_QUOTES);
     $password = $_POST['password'];
     $user = new User(0, __userdb);
     $user->auth($login, $password);
     if ($user->isAuthorized()) {
         $this->redirect('');
     } else {
         $this->redirect('?r=auth&error=1');
     }
 }
Example #9
0
 public function prepare()
 {
     $user = new User(1);
     if (!$user->isAuthorized()) {
         $this->redirect('?r=auth');
     }
     $header = new PageHeader($this->curpage, $this->db, $this->config);
     $footer = new PageFooter($this->curpage, $this->db, $this->config);
     $topMenu = new TopMenu($this->curpage, $this->db, $this->config);
     $topMenu->prepare();
     $header->data['title'] = $this->_LANG['store']['Store'];
     $this->data['header'] = $header->show();
     $this->data['footer'] = $footer->show();
     $this->data['topMenu'] = $topMenu->show();
 }
 public function prepare()
 {
     $user = new User(1);
     if (!$user->isAuthorized()) {
         $this->redirect('?r=auth');
     }
     $header = new PageHeader($this->curpage, $this->db, $this->config);
     $footer = new PageFooter($this->curpage, $this->db, $this->config);
     $topMenu = new TopMenu($this->curpage, $this->db, $this->config);
     $topMenu->prepare();
     $header->data['title'] = $this->_LANG['tasks']['New MYSQL backup'];
     $this->data['widgets'] = new Widgets($this->db, __corePath . 'widgets/', $this->config);
     $this->data['header'] = $header->show();
     $this->data['footer'] = $footer->show();
     $this->data['topMenu'] = $topMenu->show();
 }
Example #11
0
 public function prepare()
 {
     $user = new User(1, __userdb);
     if (!$user->isAuthorized()) {
         $this->redirect('?r=auth');
     }
     $header = new PageHeader($this->curpage, $this->db, $this->config);
     $footer = new PageFooter($this->curpage, $this->db, $this->config);
     $topMenu = new TopMenu($this->curpage, $this->db, $this->config);
     $topMenu->prepare();
     $usersList = new JsonDB(__userdb);
     $header->data['title'] = 'Users list';
     $this->data['usersList'] = $usersList->data;
     $this->data['header'] = $header->show();
     $this->data['footer'] = $footer->show();
     $this->data['topMenu'] = $topMenu->show();
 }
 public function prepare()
 {
     $user = new User(1);
     if (!$user->isAuthorized()) {
         $this->redirect('?r=auth');
     }
     $header = new PageHeader($this->curpage, $this->db, $this->config);
     $footer = new PageFooter($this->curpage, $this->db, $this->config);
     $topMenu = new TopMenu($this->curpage, $this->db, $this->config);
     $topMenu->prepare();
     $header->data['title'] = $this->_LANG['tasks']['New MYSQL backup'];
     $this->data['widgets'] = new Widgets($this->db, __corePath . 'widgets/', $this->config);
     $serversList = new JsonDB(__serversdb);
     $sid = (int) $_GET['sid'];
     $this->data['header'] = $header->show();
     $this->data['footer'] = $footer->show();
     $this->data['topMenu'] = $topMenu->show();
     $this->data['serverName'] = $serversList->data[$sid]['name'];
     $this->data['sid'] = $sid;
 }
Example #13
0
 /**
  * Get the siderbar for a given section
  * @param $section name
  */
 function get($options = null)
 {
     $results = array();
     if (!isset($options) || empty($options)) {
         return $results;
     }
     $section = isset($options['section']) ? $options['section'] : null;
     $controller = $options['controller'];
     $action = $options['action'];
     $widgets = $this->__getSidebarElements($section);
     // check permissions
     // 1. sidebar inclusion rules for controller:action
     // 2. user/role rights to access sidebar:widget
     foreach ($widgets as $key => $widget) {
         if (Common::requestAllowed($controller, $action, $widget['rules']) && User::isAuthorized($controller, $action)) {
             $results[$key] = $widget;
         }
     }
     return $results;
 }
Example #14
0
 public function prepare()
 {
     $user = new User(1, __userdb);
     if (!$user->isAuthorized()) {
         $this->redirect('?r=auth');
     }
     $header = new PageHeader($this->curpage, $this->db, $this->config);
     $footer = new PageFooter($this->curpage, $this->db, $this->config);
     $topMenu = new TopMenu($this->curpage, $this->db, $this->config);
     $topMenu->prepare();
     $usersList = new JsonDB(__userdb);
     $id = (int) $_GET['id'];
     $header->data['title'] = $this->_LANG['users']['Edit user, id:'] . ' ' . $id;
     $this->data['header'] = $header->show();
     $this->data['footer'] = $footer->show();
     $this->data['topMenu'] = $topMenu->show();
     $user = $usersList->data[$id];
     $user['password1'] = '';
     $user['password2'] = '';
     $this->data['id'] = $id;
     if (isset($_SESSION['formSent']) && !empty($_SESSION['formSent'])) {
         $formsent = $_SESSION['formSent'];
         if (isset($formsent['login'])) {
             $user['login'] = $formsent['login'];
         }
         if (isset($formsent['email'])) {
             $user['email'] = $formsent['email'];
         }
         if (isset($formsent['accessGroup'])) {
             $user['accessGroup'] = $formsent['accessGroup'];
         }
         if (isset($formsent['alerts'])) {
             $user['alerts'] = $formsent['alerts'];
         }
         if (isset($formsent['login'])) {
             $user['login'] = $formsent['login'];
         }
         $_SESSION['formSent'] = array();
     }
     $this->data['user'] = $user;
 }
Example #15
0
 public function prepare()
 {
     $user = new User(1);
     if (!$user->isAuthorized()) {
         $this->redirect('?r=auth');
     }
     $header = new PageHeader($this->curpage, $this->db, $this->config);
     $footer = new PageFooter($this->curpage, $this->db, $this->config);
     $topMenu = new TopMenu($this->curpage, $this->db, $this->config);
     $topMenu->prepare();
     $header->data['title'] = 'New task';
     $this->data['header'] = $header->show();
     $this->data['footer'] = $footer->show();
     $this->data['topMenu'] = $topMenu->show();
     if (isset($_SESSION['formSent']) && !empty($_SESSION['formSent'])) {
         $formsent = $_SESSION['formSent'];
     }
     #if( !isset($formsent['login'] )) $formsent['login'] = '';
     $this->data['formSent'] = $formsent;
     $_SESSION['formSent'] = array();
 }
Example #16
0
 public function prepare()
 {
     $user = new User(1);
     if (!$user->isAuthorized()) {
         $this->redirect('?r=auth');
     }
     $header = new PageHeader($this->curpage, $this->db, $this->config);
     $footer = new PageFooter($this->curpage, $this->db, $this->config);
     $topMenu = new TopMenu($this->curpage, $this->db, $this->config);
     $topMenu->prepare();
     $header->data['title'] = $this->_LANG['servers']['Connectin information'];
     $this->data['header'] = $header->show();
     $this->data['footer'] = $footer->show();
     $this->data['topMenu'] = $topMenu->show();
     if (isset($_SESSION['formSent']) && !empty($_SESSION['formSent'])) {
         $formsent = $_SESSION['formSent'];
     } else {
         $serversDB = new JsonDB(__serversdb);
         $id = (int) $_GET['id'];
         $formsent = $serversDB->data[$id];
     }
     if (!isset($formsent['address'])) {
         $formsent['address'] = '';
     }
     if (!isset($formsent['apiKey'])) {
         $formsent['apiKey'] = '';
     }
     if (!isset($formsent['archSync'])) {
         $formsent['archSync'] = '';
     }
     if (!isset($formsent['archDepth'])) {
         $formsent['archDepth'] = '';
     }
     if (!isset($formsent['deleteSync'])) {
         $formsent['deleteSync'] = '';
     }
     $this->data['formSent'] = $formsent;
     $_SESSION['formSent'] = array();
 }
 public function prepare()
 {
     $user = new User(1);
     if (!$user->isAuthorized()) {
         $this->redirect('?r=auth');
     }
     $header = new PageHeader($this->curpage, $this->db, $this->config);
     $footer = new PageFooter($this->curpage, $this->db, $this->config);
     $topMenu = new TopMenu($this->curpage, $this->db, $this->config);
     $topMenu->prepare();
     $serversDB = new JsonDB(__serversdb);
     $serverId = (int) $_GET['id'];
     $server = $serversDB->data[$serverId];
     $query = new ApiQuery($server['address'], $server['apiKey']);
     $tasksList = $query->getTasksList(true);
     $header->data['title'] = $server['name'];
     $this->data['server'] = $server;
     $this->data['tasksList'] = $tasksList;
     $this->data['header'] = $header->show();
     $this->data['footer'] = $footer->show();
     $this->data['topMenu'] = $topMenu->show();
 }
Example #18
0
 public function prepare()
 {
     $user = new User(1);
     if (!$user->isAuthorized()) {
         $this->redirect('?r=auth');
     }
     $header = new PageHeader($this->curpage, $this->db, $this->config);
     $footer = new PageFooter($this->curpage, $this->db, $this->config);
     $topMenu = new TopMenu($this->curpage, $this->db, $this->config);
     $topMenu->prepare();
     $settings = new JsonDB(__settingsdb);
     $settings->data = $this->checkSettings($settings->data);
     $header->data['title'] = $this->_LANG['settings']['Main settings'];
     $langs = glob(__corePath . "lang/*.php");
     foreach ($langs as $key => $val) {
         $langs[$key] = str_replace('.php', '', str_replace(__corePath . 'lang/', '', $val));
     }
     $this->data['langs'] = $langs;
     $this->data['settings'] = $settings->data;
     $this->data['header'] = $header->show();
     $this->data['footer'] = $footer->show();
     $this->data['topMenu'] = $topMenu->show();
 }
Example #19
0
require_once "inc/main.php";
global $title;
global $roles;
$User = new User();
if (!$User->isLogued()) {
    $_SESSION['came_from'] = $_SERVER['REQUEST_URI'];
    if ($_SESSION['debug'] == 1) {
        echo 'Not logged. Debug mode, please <a href="/login.php">log in</a>';
        include "bottom.php";
        die;
    }
    header("Location: /login.php");
    die;
}
$user = $User->getInfos();
if (!$User->isAuthorized($roles)) {
    header("Location: /welcome.php");
    exit;
}
if (isset($_SESSION['message']) and $_SESSION['message'] != "") {
    if (isset($_SESSION['error']) and $_SESSION['error'] == 1) {
        $_SESSION['message'] = '<div class="post_error">' . $_SESSION['message'] . "</div>";
        unset($_SESSION['error']);
    } else {
        if (!preg_match('/^<div/', $_SESSION['message'])) {
            $_SESSION['message'] = '<div class="post_message">' . $_SESSION['message'] . "</div>";
        }
    }
}
$css_theme = "/css/themes/main/main.css";
// Historic default
Example #20
0
   Webfinance is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2 of the License, or
   (at your option) any later version.

    Webfinance 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 General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Webfinance; if not, write to the Free Software
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
*/
require_once "../inc/main.php";
$User = new User();
if (!$User->isAuthorized("manager,accounting,employee")) {
    $_SESSION['came_from'] = $_SERVER['REQUEST_URI'];
    header("Location: /login.php");
    exit;
}
if (!isset($_GET['id'], $_GET['action'], $_GET['company_id'])) {
    die('Too few argument');
}
$done = 1;
if ($_GET['action'] === 'todo') {
    $done = 0;
}
mysql_query('UPDATE webfinance_suivi SET ' . "done = {$done} " . 'WHERE id_suivi = ' . mysql_real_escape_string($_GET['id'])) or die(mysql_error());
header("Location: fiche_prospect.php?onglet=followup&id={$_GET['company_id']}");
exit;
Example #21
0
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2 of the License, or
   (at your option) any later version.

    Webfinance 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 General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Webfinance; if not, write to the Free Software
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
*/
require "../../inc/main.php";
$User = new User();
if (!$User->isAuthorized("manager")) {
    $_SESSION['came_from'] = $_SERVER['REQUEST_URI'];
    header("Location: /login.php");
    exit;
}
if (empty($_POST['bank_name']) or empty($_POST['iban']) or empty($_POST['bic']) or empty($_POST['id_client'])) {
    die('Missing argument');
}
# SQL escape
$_POST['bank_name'] = mysql_real_escape_string($_POST['bank_name']);
$_POST['iban'] = mysql_real_escape_string($_POST['iban']);
$_POST['bic'] = mysql_real_escape_string($_POST['bic']);
$_POST['id_client'] = mysql_real_escape_string($_POST['id_client']);
mysql_query("INSERT INTO bank_account SET\n  id_client = {$_POST['id_client']},\n  bank_name = '{$_POST['bank_name']}',\n  iban = '{$_POST['iban']}',\n  bic = '{$_POST['bic']}'") or die(mysql_error());
$iban_id = mysql_insert_id();
logmessage("Add new IBAN #{$iban_id} for client:{$_POST['id_client']}", $_POST['id_client']);
Example #22
0
// This file is part of « Webfinance »
//
// Copyright (c) 2004-2006 NBI SARL
// Author : Nicolas Bouthors <*****@*****.**>
//
// You can use and redistribute this file under the term of the GNU GPL v2.0
//
require_once "inc/main.php";
?>
<div class="nav">
<?php 
$req = mysql_query('select count(*) from webfinance_suivi where done=0');
list($todo_number) = mysql_fetch_row($req);
$todo = 'Todo';
if ($todo_number > 0) {
    $todo .= " ({$todo_number})";
}
$elements = array(_('Home') => array('url' => '/', 'roles' => 'any'), _('My invoices') => array('url' => '/client/', 'roles' => 'client'), _('Companies') => array('url' => '/prospection/?sort=nom&q=0', 'roles' => 'manager,employee,accounting'), _('Direct debit') => array('url' => '/direct_debit/', 'roles' => 'manager,accounting'), _('Ticket billing') => array('url' => '/mantis/fetchBillingInformation.php', 'roles' => 'manager,accounting'), _('Documents') => array('url' => '/document/', 'roles' => 'manager,accounting'), _($todo) => array('url' => '/prospection/todo.php', 'roles' => 'manager,accounting'), _('My account') => array('url' => '/moncompte/', 'roles' => 'any'), _('Administration') => array('url' => '/admin/', 'roles' => 'manager,admin'), _('Logout') => array('url' => '/logout.php', 'roles' => 'any'));
$User = new User();
$User->getInfos();
foreach ($elements as $elname => $data) {
    if ($User->isAuthorized($data['roles'])) {
        $on = '/imgs/boutons/' . str_replace('+', '%20', urlencode($elname . "_on_" . $User->prefs->theme)) . '.png';
        array_push($_SESSION['preload_images'], $on);
        $off = '/imgs/boutons/' . str_replace('+', '%20', urlencode($elname . "_off_" . $User->prefs->theme)) . '.png';
        printf('<a class="bouton" href="%s"><img onMouseOver="this.src=\'%s\';" onMouseOut="this.src=\'%s\';" src="%s" border=0 /></a>', $data['url'], $on, $off, $off);
    }
}
?>
</div>
Example #23
0
 public function prepare()
 {
     $user = new User(1);
     if (!$user->isAuthorized()) {
         $this->redirect('?r=auth');
     }
     $header = new PageHeader($this->curpage, $this->db, $this->config);
     $footer = new PageFooter($this->curpage, $this->db, $this->config);
     $topMenu = new TopMenu($this->curpage, $this->db, $this->config);
     $topMenu->prepare();
     $header->data['title'] = $this->_LANG['misc']['home_title'];
     $tasksList = new JsonDB(__taskdb);
     $serversList = new JsonDB(__serversdb);
     $backUpsUsage = array();
     $usedByAllBackups = 0;
     // for local backups
     foreach ($tasksList->data as $task) {
         $size = round(dirSize(__archiveDIR . 'local/' . $task['id']));
         $usedByAllBackups += $size;
         $backUpsUsage[] = array('value' => $size, 'label' => $this->_LANG['store']['Local'] . ' / ' . $task['title']);
     }
     //for remote backups
     foreach ($serversList->data as $server) {
         if (isset($server['tasks'])) {
             foreach ($server['tasks'] as $task) {
                 $size = round(dirSize(__archiveDIR . 'servers/' . $server['id'] . '/' . $task['id']));
                 $usedByAllBackups += $size;
                 $backUpsUsage[] = array('value' => $size, 'label' => $server['name'] . ' / ' . $task['title']);
             }
         }
     }
     function iCmp($a, $b)
     {
         if ($a['value'] > $b['value']) {
             return 0;
         } else {
             return 1;
         }
     }
     usort($backUpsUsage, "iCmp");
     $usedByBackupsTmp = dirSize(__archiveDIR . 'local/');
     $usedByBackups = round($usedByBackupsTmp / (1024 * 1024));
     $hddTotalSize = round(disk_total_space(__workfolder) / (1024 * 1024));
     $hddFreeSpace = round(disk_free_space(__workfolder) / (1024 * 1024));
     $hddUsedSpace = $hddTotalSize - $hddFreeSpace - $usedByBackups;
     $hddUsage = array();
     $hddUsage['title'] = $this->_LANG['misc']['HDD usage'];
     $hddUsage['data'] = array();
     $hddUsage['data'][] = array('value' => $usedByBackups, 'color' => '#008d32', 'highlight' => '#2ac360', 'label' => $this->_LANG['misc']['Used by BackUps (Mb)']);
     $hddUsage['data'][] = array('value' => $hddUsedSpace, 'color' => '#008aa3', 'highlight' => '#20abc4', 'label' => $this->_LANG['misc']['Hdd used by other (Mb)']);
     $hddUsage['data'][] = array('value' => $hddFreeSpace, 'color' => '#a65200', 'highlight' => '#cd741c', 'label' => $this->_LANG['misc']['Hdd free space (Mb)']);
     $widgets = new Widgets($this->db, __corePath . 'widgets/', $this->config);
     $maxUsage = 0;
     if (isset($backUpsUsage[0])) {
         $maxUsage = $backUpsUsage[0]['value'];
     }
     $this->data['hddUsage'] = $widgets->show('PieGraph', $hddUsage);
     $this->data['backUpsUsage'] = $backUpsUsage;
     $this->data['maxUsage'] = $maxUsage;
     $this->data['header'] = $header->show();
     $this->data['footer'] = $footer->show();
     $this->data['topMenu'] = $topMenu->show();
 }
Example #24
0
 * This program 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 General
 * Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program. If not, see <http://www.gnu.org/licenses/>.
 *
 */
$roles = 'manager,accounting,employee';
require_once '../../lib/WebfinanceMantis.php';
require_once "../inc/main.php";
$User = new User();
if (!$User->isLogued()) {
    $_SESSION['came_from'] = $_SERVER['REQUEST_URI'];
    if ($_SESSION['debug'] == 1) {
        echo 'Not logged. Debug mode, please <a href="/login.php">log in</a>';
        include "bottom.php";
        die;
    }
    header("Location: /login.php");
    die;
}
$user = $User->getInfos();
if (!$User->isAuthorized($roles)) {
    header("Location: /welcome.php");
    exit;
}
$mantis = new WebfinanceMantis();
$pdf_file = $mantis->createReport($_GET['year'], $_GET['month'], $_GET['id_client'], 'inline');
unlink($pdf_file);