コード例 #1
0
ファイル: main.php プロジェクト: gnlcosta/eTunnel
 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);
 }
コード例 #2
0
ファイル: controller.php プロジェクト: gnlcosta/eTunnel
 function Error()
 {
     SesVarSet('esalert', _('Content does not exist') . ' "' . $_GET['url'] . '"');
     EsRedir();
 }
コード例 #3
0
ファイル: index.php プロジェクト: gnlcosta/eTunnel
include '../../core/lib/controller.php';
// identify controller and page requested (by url)
list($controller, $page) = ControllerPage();
// check controller file
if (!file_exists('../controllers/' . $controller . '.php')) {
    $controller = $default_controller;
    $page = 'error';
}
// specific controler loading
include '../controllers/' . $controller . '.php';
// controller class name and member function (ie page name)
$cntr_class = str_replace(' ', '', ucwords(str_replace('_', ' ', $controller)));
$page_function = str_replace(' ', '', ucwords(str_replace('_', ' ', $page)));
if (!class_exists($cntr_class)) {
    SesVarSet('esalert', _("The Controller doesn't exist."));
    EsRedir();
}
$contr = new $cntr_class();
if (!method_exists($contr, $page_function)) {
    SesVarSet('esalert', _("The page doesn't exist"));
    $page = 'index';
    $page_function = 'Index';
}
// setup controller (its models and components)
$contr->__ModulesInit();
$contr->EsBefore();
$contr->{$page_function}();
if (!isset($title_page)) {
    if ($controller != $page) {
        $title_page = '..:: ' . ucfirst($cntr_class) . '->' . ucfirst($page_function) . ' ::..';
    } else {
コード例 #4
0
ファイル: user.php プロジェクト: gnlcosta/eTunnel
 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');
 }
コード例 #5
0
ファイル: main.php プロジェクト: gnlcosta/eTunnel
 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);
 }