Example #1
0
 function Index()
 {
     TemplVar('menu_left_active', -1);
     $str = file_get_contents(RootDir() . '/../../app.json');
     $appl = json_decode($str, true);
     ViewVar('cfg', FALSE);
     ViewVar('url', '');
     $post = TRUE;
     if (file_exists($this->cfg_file)) {
         $str = file_get_contents($this->cfg_file);
         $cfg = json_decode($str, true);
         if (isset($cfg['idn'])) {
             $post = FALSE;
             ViewVar('idn', $cfg['idn']);
             ViewVar('cfg', TRUE);
         }
         if (isset($cfg['scheme'])) {
             ViewVar('url', $cfg['scheme'] . '://' . $cfg['host'] . $cfg['path']);
         }
     }
     if ($post && $_SERVER['REQUEST_METHOD'] == 'POST') {
         $_POST = EsSanitize($_POST);
         if (isset($_POST['url'])) {
             $url = parse_url($_POST['url']);
             if ($url['scheme'] == null) {
                 EsMessage(_('Errore, URL errato'));
                 EsRedir('main');
             }
             $cfg['scheme'] = $url['scheme'];
             $cfg['host'] = $url['host'];
             if ($url['port'] != null) {
                 $cfg['host'] .= ':' . $url['port'];
             }
             if ($url['path'] == null) {
                 $cfg['path'] = '';
             } else {
                 $cfg['path'] = $url['path'];
             }
             $file = fopen($this->cfg_file, 'w');
             if ($file !== FALSE) {
                 fwrite($file, json_encode($cfg));
                 fclose($file);
                 EsMessage(_('Impostazioni salvate'));
             } else {
                 EsMessage(_('Errore nel salvataggio delle impostazioni'));
             }
             EsRedir('main');
         }
     }
     if (!isset($cfg['sn'])) {
         $sn = '---';
     } else {
         $sn = $cfg['sn'];
     }
     ViewVar('sn', $sn);
     ViewVar('appl', $appl);
 }
Example #2
0
 function Delete()
 {
     if (!isset($_GET['id']) || !is_numeric($_GET['id'])) {
         EsRedir('user');
     }
     $usr_id = SesVarGet('user_id');
     $udata = $this->users->SearchByID($_GET['id']);
     if ($udata !== FALSE && $this->users->Permanent($udata['id']) == FALSE) {
         if ($udata['type'] > $this->usr_type || $udata['id'] == $usr_id || $this->users->FullAccess($usr_id)) {
             $this->users->Delete($udata['id']);
             EsMessage(_('Utente rimosso'));
             if ($udata['id'] == $usr_id) {
                 EsRedir('user', 'logout');
             }
             EsRedir('user');
         }
     }
     EsMessage(_('Operazione non consentita'));
     EsRedir('user');
 }
Example #3
0
 function UserDelNode()
 {
     if (!isset($_GET['id']) || $this->utype == 3 || !SesVarCheck('user_id')) {
         EsMessage(_("Operazione non consentita"));
         EsRedir('main', 'nodes_list');
     }
     $user_id = SesVarGet('user_id');
     $this->nodes->UserDelNode($user_id, $_GET['id']);
     EsMessage(_("Nodo Disabilitato"));
     EsRedir('main', 'user_nodes', 'id=' . $user_id);
 }