示例#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();
     $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();
 }
示例#2
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();
 }
示例#3
0
 /**
  * factory to create top menu
  * @param $name
  * @return \TopMenu
  */
 public function createComponentTopMenu($name)
 {
     $topmenu = new TopMenu($this, $name);
     $topmenu->setup();
     $topmenu->addItems();
     return $topmenu;
 }
示例#4
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();
 }
 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();
 }
示例#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['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();
 }
示例#8
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;
 }
示例#10
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;
 }
示例#11
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();
 }
示例#12
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();
 }
示例#14
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();
 }
示例#15
0
            }
            if (!empty($menu['handler'])) {
                $attributes .= ' onclick="' . str_replace('"', '\'', $menu['handler']) . '"';
            }
            $smTpl .= '<a' . $attributes . '>' . $menu['text'] . $description . '</a>' . "\n";
            if (!empty($menu['children'])) {
                $smTpl .= '<ul class="modx-subsubnav">' . "\n";
                $this->processSubMenus($smTpl, $menu['children']);
                $smTpl .= '</ul>' . "\n";
            }
            $smTpl .= '</li>';
            $output .= $smTpl;
            $this->childrenCt++;
        }
        //$output .= '</ul>'."\n";
    }
    /**
     * Clean "orphan" sub menus
     *
     * @return void
     */
    public function cleanEmptySubMenus()
    {
        $emptySub = '<ul class="modx-subsubnav">' . "\n" . '</ul>' . "\n";
        $this->output = str_replace($emptySub, '', $this->output);
    }
}
// Set Smarty placeholder to display search bar, if appropriate
$this->setPlaceholder('_search', $modx->hasPermission('search'));
$menu = new TopMenu($this);
$menu->render();
示例#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['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();
 }
示例#17
0
 public function render()
 {
     return "  [decorated_top_menu]\n  " . parent::render() . "\n  [/decorated_top_menu]";
 }