Example #1
0
File: pass1.php Project: nikic/phan
function node_func($file, $conditional, $node, $current_scope, $current_class, $namespace = '')
{
    global $scope, $classes;
    if ($node instanceof \ast\Node) {
        $req = $opt = 0;
        $dc = ['return' => '', 'params' => []];
        if (!empty($node->docComment)) {
            $dc = parse_doc_comment($node->docComment);
        }
        $result = ['file' => $file, 'namespace' => $namespace, 'scope' => $current_scope, 'conditional' => $conditional, 'flags' => $node->flags, 'lineno' => $node->lineno, 'endLineno' => $node->endLineno, 'name' => strpos($current_scope, '::') === false ? $namespace . $node->name : $node->name, 'docComment' => $node->docComment, 'params' => node_paramlist($file, $node->children[0], $req, $opt, $dc, $namespace), 'required' => $req, 'optional' => $opt, 'ret' => '', 'oret' => '', 'ast' => $node->children[2]];
        if (!empty($dc['deprecated'])) {
            $result['deprecated'] = true;
        }
        if ($node->children[3] !== null) {
            $result['oret'] = ast_node_type($file, $node->children[3], $namespace);
            // Original return type
            $result['ret'] = ast_node_type($file, $node->children[3], $namespace);
            // This one changes as we walk the tree
        } else {
            // Check if the docComment has a return value specified
            if (!empty($dc['return'])) {
                // We can't actually figure out 'static' at this point, but fill it in regardless. It will be partially correct
                if ($dc['return'] == 'static' || $dc['return'] == 'self' || $dc['return'] == '$this') {
                    if (strpos($current_scope, '::') !== false) {
                        list($dc['return'], ) = explode('::', $current_scope);
                    }
                }
                $result['oret'] = $dc['return'];
                $result['ret'] = $dc['return'];
            }
        }
        // Add params to local scope for user functions
        if ($file != 'internal') {
            $i = 1;
            foreach ($result['params'] as $k => $v) {
                if (empty($v['type'])) {
                    // If there is no type specified in PHP, check for a docComment
                    // We assume order in the docComment matches the parameter order in the code
                    if (!empty($dc['params'][$k]['type'])) {
                        $scope[$current_scope]['vars'][$v['name']] = ['type' => $dc['params'][$k]['type'], 'tainted' => false, 'tainted_by' => '', 'param' => $i];
                    } else {
                        $scope[$current_scope]['vars'][$v['name']] = ['type' => '', 'tainted' => false, 'tainted_by' => '', 'param' => $i];
                    }
                } else {
                    $scope[$current_scope]['vars'][$v['name']] = ['type' => $v['type'], 'tainted' => false, 'tainted_by' => '', 'param' => $i];
                }
                if (array_key_exists('def', $v)) {
                    $type = node_type($file, $namespace, $v['def'], $current_scope, empty($current_class) ? null : $classes[strtolower($current_class)]);
                    if ($scope[$current_scope]['vars'][$v['name']]['type'] !== '') {
                        // Does the default value match the declared type?
                        if ($type !== 'null' && !type_check($type, $scope[$current_scope]['vars'][$v['name']]['type'])) {
                            Log::err(Log::ETYPE, "Default value for {$scope[$current_scope]['vars'][$v['name']]['type']} \${$v['name']} can't be {$type}", $file, $node->lineno);
                        }
                    }
                    add_type($current_scope, $v['name'], strtolower($type));
                    // If we have no other type info about a parameter, just because it has a default value of null
                    // doesn't mean that is its type. Any type can default to null
                    if ($type === 'null' && !empty($result['params'][$k]['type'])) {
                        $result['params'][$k]['type'] = merge_type($result['params'][$k]['type'], strtolower($type));
                    }
                }
                $i++;
            }
            if (!empty($dc['vars'])) {
                foreach ($dc['vars'] as $var) {
                    if (empty($scope[$current_scope]['vars'][$var['name']])) {
                        $scope[$current_scope]['vars'][$var['name']] = ['type' => $var['type'], 'tainted' => false, 'tainted_by' => ''];
                    } else {
                        add_type($current_scope, $var['name'], $var['type']);
                    }
                }
            }
        }
        return $result;
    }
    assert(false, "{$node} was not an \\ast\\Node");
}
    $sql = "INSERT INTO bill_plan (bill_plan, name, no_years, roi, cr_dt)\nVALUES ('{$bill_plan}', '{$name}', '{$years}', '{$roi}', now());";
    $h_success = "Billing Plan: " . $desc . " Added Successfully";
    $h_success = "<script type='text/javascript'>alert('{$h_success}');</script>";
    $h_fail = "Billing Plan: " . $bill_plan . " Not Added";
    database($sql, $h_success, $h_fail);
}
switch ($_POST[add]) {
    case "tower":
        unset($msg);
        add_tower($_POST['tw_id'], $_POST['desc']);
        break;
        //add tower
    //add tower
    case "type":
        unset($msg);
        add_type($_POST[type_id], $_POST[desc], $_POST[tw_id], $_POST[price]);
        break;
        //add type
    //add type
    case "unit":
        unset($msg);
        add_unit($_POST[ut_id], $_POST[type], $_POST[tw_id], $_POST[floor], $_POST[area]);
        break;
        //add unit
    //add unit
    case "plan":
        unset($msg);
        add_plan($_POST[bill_plan], $_POST[name], $_POST[years], $_POST[roi]);
        break;
        //add billing plan
}
Example #3
0
function arglist_type_check($file, $namespace, $arglist, $func, $current_scope, $current_class) : array
{
    global $internal_arginfo, $scope, $tainted_by;
    $errs = [];
    $fn = $func['scope'] ?? $func['name'];
    foreach ($arglist->children as $k => $arg) {
        $taint = false;
        $tainted_by = '';
        if (empty($func['params'][$k])) {
            break;
        }
        $param = $func['params'][$k];
        $argno = $k + 1;
        $arg_name = false;
        if ($param['flags'] & \ast\flags\PARAM_REF) {
            if (!$arg instanceof \ast\Node || $arg->kind != \ast\AST_VAR && $arg->kind != \ast\AST_DIM && $arg->kind != \ast\AST_PROP) {
                $errs[] = "Only variables can be passed by reference at arg#{$argno} of {$fn}()";
            } else {
                $arg_name = var_name($arg);
            }
        }
        // For user functions, add the types of the args to the receiving function's scope
        if ($func['file'] != 'internal') {
            if (empty($scope[$fn]['vars'][$param['name']])) {
                $scope[$fn]['vars'][$param['name']] = ['type' => '', 'tainted' => false, 'tainted_by' => ''];
            }
            // If it is by-ref link it back to the local variable name
            if ($param['flags'] & \ast\flags\PARAM_REF) {
                $arg_type = node_type($file, $namespace, $arg, $current_scope, $current_class, $taint, false);
                if (!empty($scope[$current_scope]['vars'][$arg_name])) {
                    $scope[$fn]['vars'][$param['name']] =& $scope[$current_scope]['vars'][$arg_name];
                } else {
                    $scope[$fn]['vars'][$param['name']]['type'] = $arg_type;
                }
            } else {
                $arg_type = node_type($file, $namespace, $arg, $current_scope, $current_class, $taint);
                if (!empty($arg_type)) {
                    add_type($fn, $param['name'], $arg_type);
                }
            }
            if ($taint) {
                $scope[$fn]['vars'][$param['name']]['tainted'] = true;
                $scope[$fn]['vars'][$param['name']]['tainted_by'] = $tainted_by;
            } else {
                $scope[$fn]['vars'][$param['name']]['tainted'] = false;
                $scope[$fn]['vars'][$param['name']]['tainted_by'] = '';
            }
        } else {
            $arg_type = node_type($file, $namespace, $arg, $current_scope, $current_class, $taint, !($param['flags'] & \ast\flags\PARAM_REF));
        }
        // For all functions, add the param to the local scope if pass-by-ref
        // and make it an actual ref for user functions
        if ($param['flags'] & \ast\flags\PARAM_REF) {
            if ($func['file'] == 'internal') {
                if (empty($scope[$current_scope]['vars'][$arg_name])) {
                    add_var_scope($current_scope, $arg_name, $arg_type);
                }
            } else {
                if (empty($scope[$current_scope]['vars'][$arg_name])) {
                    if (!array_key_exists($current_scope, $scope)) {
                        $scope[$current_scope] = [];
                    }
                    if (!array_key_exists('vars', $scope[$current_scope])) {
                        $scope[$current_scope]['vars'] = [];
                    }
                    $scope[$current_scope]['vars'][$arg_name] =& $scope[$fn]['vars'][$param['name']];
                }
            }
        }
        // turn callable:{closure n} into just callable
        if (strpos($arg_type, ':') !== false) {
            list($arg_type, ) = explode(':', $arg_type, 2);
        }
        if (!type_check($arg_type, $param['type'], $namespace)) {
            if (!empty($param['name'])) {
                $paramstr = '(' . trim($param['name'], '&=') . ')';
            } else {
                $paramstr = '';
            }
            if (empty($arg_type)) {
                $arg_type = '';
            }
            if ($func['file'] == 'internal') {
                if (!($param['flags'] & \ast\flags\PARAM_REF)) {
                    $errs[] = "arg#{$argno}{$paramstr} is {$arg_type} but {$func['name']}() takes {$param['type']}";
                }
            } else {
                $errs[] = "arg#{$argno}{$paramstr} is {$arg_type} but {$func['name']}() takes {$param['type']} defined at {$func['file']}:{$func['lineno']}";
            }
        }
    }
    return $errs;
}
Example #4
0
function arglist_type_check($file, $namespace, $arglist, $func, $current_scope, $current_class) : array
{
    global $classes, $internal_arginfo, $scope, $tainted_by;
    $errs = [];
    $fn = $func['scope'] ?? $func['name'];
    foreach ($arglist->children as $k => $arg) {
        $taint = false;
        $tainted_by = '';
        if (empty($func['params'][$k])) {
            break;
        }
        $param = $func['params'][$k];
        $argno = $k + 1;
        $arg_name = false;
        if ($param['flags'] & \ast\flags\PARAM_REF) {
            if (!$arg instanceof \ast\Node || $arg->kind != \ast\AST_VAR && $arg->kind != \ast\AST_DIM && $arg->kind != \ast\AST_PROP && $arg->kind != \ast\AST_STATIC_PROP) {
                $errs[] = "Only variables can be passed by reference at arg#{$argno} of {$fn}()";
            } else {
                $arg_name = var_name($arg);
                if ($arg->kind == \ast\AST_STATIC_PROP) {
                    if ($arg_name == 'self' || $arg_name == 'static' || $arg_name == 'parent') {
                        Log::err(Log::ESTATIC, "Using {$arg_name}:: when not in object context", $file, $arg->lineno);
                    }
                }
            }
        }
        // For user functions, add the types of the args to the receiving function's scope
        if ($func['file'] != 'internal') {
            if (empty($scope[$fn]['vars'][$param['name']])) {
                $scope[$fn]['vars'][$param['name']] = ['type' => '', 'tainted' => false, 'tainted_by' => ''];
            }
            // If it is by-ref link it back to the local variable name
            if ($param['flags'] & \ast\flags\PARAM_REF) {
                $arg_type = node_type($file, $namespace, $arg, $current_scope, $current_class, $taint, false);
                if ($arg->kind == \ast\AST_STATIC_PROP && $arg->children[0]->kind == \ast\AST_NAME) {
                    $class_name = $arg->children[0]->children[0];
                    if ($class_name == 'self' || $class_name == 'static' || $class_name == 'parent') {
                        if ($current_class) {
                            if ($class_name == 'static') {
                                $class_name = $current_class['name'];
                            }
                            if ($class_name == 'self') {
                                if ($current_scope != 'global') {
                                    list($class_name, ) = explode('::', $current_scope);
                                } else {
                                    $class_name = $current_class['name'];
                                }
                            } else {
                                if ($class_name == 'parent') {
                                    $class_name = $current_class['parent'];
                                }
                            }
                            $static_call_ok = true;
                        } else {
                            $class_name = '';
                        }
                    } else {
                        $class_name = qualified_name($file, $arg->children[0], $namespace);
                    }
                    if ($class_name) {
                        if (!$arg->children[1] instanceof \ast\Node) {
                            if (empty($classes[strtolower($class_name)]['properties'][$arg->children[1]])) {
                                Log::err(Log::ESTATIC, "Access to undeclared static property: {$class_name}::\${$arg->children[1]}", $file, $arg->lineno);
                            } else {
                                $scope[$fn]['vars'][$param['name']] =& $classes[strtolower($class_name)]['properties'][$arg->children[1]];
                            }
                        }
                    }
                } else {
                    if (!empty($scope[$current_scope]['vars'][$arg_name])) {
                        $scope[$fn]['vars'][$param['name']] =& $scope[$current_scope]['vars'][$arg_name];
                    } else {
                        $scope[$fn]['vars'][$param['name']]['type'] = $arg_type;
                    }
                }
            } else {
                $arg_type = node_type($file, $namespace, $arg, $current_scope, $current_class, $taint);
                if (!empty($arg_type)) {
                    add_type($fn, $param['name'], $arg_type);
                }
            }
            if ($taint) {
                $scope[$fn]['vars'][$param['name']]['tainted'] = true;
                $scope[$fn]['vars'][$param['name']]['tainted_by'] = $tainted_by;
            } else {
                $scope[$fn]['vars'][$param['name']]['tainted'] = false;
                $scope[$fn]['vars'][$param['name']]['tainted_by'] = '';
            }
        } else {
            $arg_type = node_type($file, $namespace, $arg, $current_scope, $current_class, $taint, !($param['flags'] & \ast\flags\PARAM_REF));
        }
        // For all functions, add the param to the local scope if pass-by-ref
        // and make it an actual ref for user functions
        if ($param['flags'] & \ast\flags\PARAM_REF) {
            if ($func['file'] == 'internal') {
                if (empty($scope[$current_scope]['vars'][$arg_name])) {
                    add_var_scope($current_scope, $arg_name, $arg_type);
                }
            } else {
                if (empty($scope[$current_scope]['vars'][$arg_name])) {
                    if (!array_key_exists($current_scope, $scope)) {
                        $scope[$current_scope] = [];
                    }
                    if (!array_key_exists('vars', $scope[$current_scope])) {
                        $scope[$current_scope]['vars'] = [];
                    }
                    $scope[$current_scope]['vars'][$arg_name] =& $scope[$fn]['vars'][$param['name']];
                }
            }
        }
        // turn callable:{closure n} into just callable
        if (strpos($arg_type, ':') !== false) {
            list($arg_type, ) = explode(':', $arg_type, 2);
        }
        // if we have a single non-native type, expand it
        if (!empty($arg_type) && !is_native_type($arg_type)) {
            if (!empty($classes[strtolower($arg_type)]['type'])) {
                $arg_type = $classes[strtolower($arg_type)]['type'];
            }
        }
        if (!type_check(all_types($arg_type), all_types($param['type']), $namespace)) {
            if (!empty($param['name'])) {
                $paramstr = '(' . trim($param['name'], '&=') . ')';
            } else {
                $paramstr = '';
            }
            if (empty($arg_type)) {
                $arg_type = '';
            }
            if ($func['file'] == 'internal') {
                if (!($param['flags'] & \ast\flags\PARAM_REF)) {
                    $errs[] = "arg#{$argno}{$paramstr} is {$arg_type} but {$func['name']}() takes {$param['type']}";
                }
            } else {
                $errs[] = "arg#{$argno}{$paramstr} is {$arg_type} but {$func['name']}() takes {$param['type']} defined at {$func['file']}:{$func['lineno']}";
            }
        }
    }
    return $errs;
}
Example #5
0
function node_func($file, $conditional, $node, $current_scope, $current_class, $namespace = '')
{
    global $scope;
    if ($node instanceof \ast\Node) {
        $req = $opt = 0;
        $dc = ['return' => '', 'params' => []];
        if (!empty($node->docComment)) {
            $dc = parse_doc_comment($node->docComment);
        }
        $result = ['file' => $file, 'namespace' => $namespace, 'scope' => $current_scope, 'conditional' => $conditional, 'flags' => $node->flags, 'lineno' => $node->lineno, 'endLineno' => $node->endLineno, 'name' => strpos($current_scope, '::') === false ? $namespace . $node->name : $node->name, 'docComment' => $node->docComment, 'params' => node_paramlist($file, $node->children[0], $req, $opt, $dc, $namespace), 'required' => $req, 'optional' => $opt, 'ret' => '', 'oret' => '', 'ast' => $node->children[2]];
        if ($node->children[3] !== null) {
            $result['oret'] = ast_node_type($file, $node->children[3], $namespace);
            // Original return type
            $result['ret'] = ast_node_type($file, $node->children[3], $namespace);
            // This one changes as we walk the tree
        } else {
            // Check if the docComment has a return value specified
            if (!empty($dc['return'])) {
                if ($dc['return'] == 'static' || $dc['return'] == 'self' || $dc['return'] == '$this') {
                    if (strpos($current_scope, '::') !== false) {
                        list($dc['return'], ) = explode('::', $current_scope);
                    }
                }
                $result['oret'] = $dc['return'];
                $result['ret'] = $dc['return'];
            }
        }
        // Add params to local scope for user functions
        if ($file != 'internal') {
            $i = 1;
            foreach ($result['params'] as $k => $v) {
                if (empty($v['type'])) {
                    // If there is no type specified in PHP, check for a docComment
                    // We assume order in the docComment matches the parameter order in the code
                    if (!empty($dc['params'][$k]['type'])) {
                        $scope[$current_scope]['vars'][$v['name']] = ['type' => $dc['params'][$k]['type'], 'tainted' => false, 'tainted_by' => '', 'param' => $i];
                    } else {
                        $scope[$current_scope]['vars'][$v['name']] = ['type' => '', 'tainted' => false, 'tainted_by' => '', 'param' => $i];
                    }
                } else {
                    $scope[$current_scope]['vars'][$v['name']] = ['type' => $v['type'], 'tainted' => false, 'tainted_by' => '', 'param' => $i];
                }
                if (array_key_exists('def', $v)) {
                    $type = node_type($file, $namespace, $v['def'], $current_scope, $current_class);
                    if ($type === "NULL") {
                        add_type($current_scope, $v['name'], $type);
                        if (!empty($result['params'][$k]['type'])) {
                            $result['params'][$k]['type'] .= '|NULL';
                        }
                    } else {
                        if ($scope[$current_scope]['vars'][$v['name']]['type'] !== '') {
                            // Does the default value match the declared type?
                            if (!type_check($type, $scope[$current_scope]['vars'][$v['name']]['type'])) {
                                Log::err(Log::ETYPE, "Default value for {$scope[$current_scope]['vars'][$v['name']]['type']} \${$v['name']} can't be {$type}", $file, $node->lineno);
                            }
                        }
                    }
                }
                $i++;
            }
        }
        return $result;
    }
    assert(false, "{$node} was not an \\ast\\Node");
}
            $result_exist = ajaxtab_entete_fixe($list_fields, $default_fields, $tab_options, $list_col_cant_del);
            echo "<input type = submit value='" . $l->g(116) . "' name='ADD_SUB'>";
        }
    } else {
        msg_warning($method);
    }
} elseif ($protectedPost['onglet'] == 'ADMIN_TYPE') {
    if (isset($protectedPost['Reset_modif'])) {
        unset($protectedPost['MODIF']);
    }
    if (isset($protectedPost['SUP_PROF']) and $protectedPost['SUP_PROF'] != '') {
        delete_type($protectedPost['SUP_PROF']);
        $tab_options['CACHE'] = 'RESET';
    }
    if (isset($protectedPost['Valid_modif'])) {
        $result = add_type($protectedPost['TYPE_NAME'], $protectedPost['MODIF']);
        if ($result) {
            msg_error($result);
            $protectedPost['ADD_TYPE'] = "VALID";
        } else {
            $protectedPost = '';
            $tab_options['CACHE'] = 'RESET';
            $msg_ok = $l->g(1121);
        }
    }
    if ($protectedPost['MODIF'] != '') {
        echo "<input type='hidden' name='MODIF' id='MODIF' value='" . $protectedPost['MODIF'] . "'";
    }
    if (isset($protectedPost['ADD_TYPE']) or $protectedPost['MODIF']) {
        if ($protectedPost['MODIF']) {
            $info = find_info_type('', $protectedPost['MODIF']);
Example #7
0
function Draw_Page($Page_Type)
{
    // Read only pages - these pages don't strictly require user authentication.
    // Therefore, to enable permit-all page viewing, comment out the call
    // to rejectIfNotAuthenticated() in the relevant case block. Note, some of
    // these pages will replace sensitive info such as telephone/email with
    // the string 'PROTECTED'
    // ************************************************************************
    switch ($Page_Type) {
        case "default":
            //rejectIfNotAuthenticated();
            require_once __DIR__ . '/controllers/start_page.php';
            startPage();
            break;
        case "View_Service_Endpoint":
            //rejectIfNotAuthenticated();
            require_once __DIR__ . '/controllers/service/view_service_endpoint.php';
            view_endpoint();
            break;
        case "Service_Groups":
            //rejectIfNotAuthenticated();
            require_once __DIR__ . '/controllers/service_group/view_all.php';
            showAllServiceGroups();
            break;
        case "Service_Group":
            //rejectIfNotAuthenticated();
            require_once __DIR__ . '/controllers/service_group/view_sgroup.php';
            showServiceGroup();
            break;
        case "Site":
            //rejectIfNotAuthenticated();
            require_once __DIR__ . '/controllers/site/view_site.php';
            view_site();
            break;
        case "NGI":
            //rejectIfNotAuthenticated();
            require_once __DIR__ . '/controllers/ngi/view_ngi.php';
            view_ngi();
            break;
        case "Service":
            //rejectIfNotAuthenticated();
            require_once __DIR__ . '/controllers/service/view_service.php';
            view_se();
            break;
        case "Services":
            //rejectIfNotAuthenticated();
            require_once __DIR__ . '/controllers/service/view_all.php';
            drawSEs();
            break;
        case "NGIs":
            //rejectIfNotAuthenticated();
            require_once __DIR__ . '/controllers/ngi/view_ngis.php';
            view_ngis();
            break;
        case "Sites":
            //rejectIfNotAuthenticated();
            require_once __DIR__ . '/controllers/site/view_all.php';
            showAllSites();
            break;
        case "Projects":
            //rejectIfNotAuthenticated();
            require_once __DIR__ . '/controllers/project/view_all.php';
            show_all_projects();
            break;
        case "Project":
            //rejectIfNotAuthenticated();
            require_once __DIR__ . '/controllers/project/view_project.php';
            show_project();
            break;
        case "Scope_Help":
            //rejectIfNotAuthenticated();
            require_once __DIR__ . '/controllers/scope_help.php';
            show_help();
            break;
        case "Site_Geo_xml":
            //rejectIfNotAuthenticated();
            require_once __DIR__ . '/controllers/sitesForGoogleMapXML.php';
            show_xml();
            break;
        case "Error_Redirect":
            //rejectIfNotAuthenticated();
            show_view('error.php', $_REQUEST['error']);
            break;
        case "Static_HTML":
            //rejectIfNotAuthenticated();
            Draw_Static_HTML();
            break;
        case "Search":
            //rejectIfNotAuthenticated();
            require_once __DIR__ . '/controllers/search.php';
            search();
            break;
            // CrUD Pages - These pages MUST have authentication enabled so
            // the calls to rejectIfNotAuthenticated() must be used.
            // *********************************************************************
        // CrUD Pages - These pages MUST have authentication enabled so
        // the calls to rejectIfNotAuthenticated() must be used.
        // *********************************************************************
        case "Revoke_Role":
            rejectIfNotAuthenticated();
            require_once __DIR__ . '/controllers/political_role/revoke_request.php';
            view_revoke_request();
            break;
        case "Accept_Role_Request":
            rejectIfNotAuthenticated();
            require_once __DIR__ . '/controllers/political_role/accept_request.php';
            view_accept_request();
            break;
        case "Deny_Role_Request":
            rejectIfNotAuthenticated();
            require_once __DIR__ . '/controllers/political_role/deny_request.php';
            view_deny_request();
            break;
        case "Role_Requests":
            rejectIfNotAuthenticated();
            require_once __DIR__ . '/controllers/political_role/view_requests.php';
            view_requests();
            break;
        case "Request_Role":
            rejectIfNotAuthenticated();
            require_once __DIR__ . '/controllers/political_role/request_role.php';
            request_role();
            break;
        case "Edit_Site":
            rejectIfNotAuthenticated();
            require_once __DIR__ . '/controllers/site/edit_site.php';
            edit_site();
            break;
        case "Edit_Service":
            rejectIfNotAuthenticated();
            require_once __DIR__ . '/controllers/service/edit_service.php';
            edit_service();
            break;
        case "SE_Downtimes":
            rejectIfNotAuthenticated();
            require_once __DIR__ . '/controllers/service/se_downtimes.php';
            se_downtimes();
            break;
        case "Add_Service":
            rejectIfNotAuthenticated();
            require_once __DIR__ . '/controllers/service/add_service.php';
            add_service();
            break;
        case "Add_Service_Endpoint":
            rejectIfNotAuthenticated();
            require_once __DIR__ . '/controllers/service/add_service_endpoint.php';
            add_service_endpoint();
            break;
        case "Delete_Service":
            rejectIfNotAuthenticated();
            require_once __DIR__ . '/controllers/service/delete_service.php';
            delete();
            break;
        case "Edit_User":
            rejectIfNotAuthenticated();
            require_once __DIR__ . '/controllers/user/edit_user.php';
            edit_user();
            break;
        case "User":
            rejectIfNotAuthenticated();
            require_once __DIR__ . '/controllers/user/view_user.php';
            view_user();
            break;
        case "Downtime":
            rejectIfNotAuthenticated();
            require_once __DIR__ . '/controllers/downtime/view_downtime.php';
            view();
            break;
        case "My_Sites":
            rejectIfNotAuthenticated();
            require_once __DIR__ . '/controllers/my_sites.php';
            my_sites();
            break;
        case "Edit_NGI":
            rejectIfNotAuthenticated();
            require_once __DIR__ . '/controllers/ngi/edit_ngi.php';
            edit_ngi();
            break;
        case "Edit_Service_Group":
            rejectIfNotAuthenticated();
            require_once __DIR__ . '/controllers/service_group/edit_service_group.php';
            edit_service_group();
            break;
        case "Add_Service_Group_SEs":
            rejectIfNotAuthenticated();
            require_once __DIR__ . '/controllers/service_group/add_ses.php';
            add_ses();
            break;
        case "Search_SEs":
            rejectIfNotAuthenticated();
            require_once __DIR__ . '/controllers/service_group/search_ses.php';
            search_ses();
            break;
        case "Remove_Service_Group_SEs":
            rejectIfNotAuthenticated();
            require_once __DIR__ . '/controllers/service_group/remove_ses.php';
            remove_ses();
            break;
        case "Add_Site":
            rejectIfNotAuthenticated();
            require_once __DIR__ . '/controllers/site/add_site.php';
            add_site();
            break;
        case "SGroup_Downtimes":
            rejectIfNotAuthenticated();
            require_once __DIR__ . '/controllers/service_group/view_sgroup_downtimes.php';
            view_sgroup_downtimes();
            break;
        case "Add_Service_Group":
            rejectIfNotAuthenticated();
            require_once __DIR__ . '/controllers/service_group/add_service_group.php';
            add_service_group();
            break;
        case "Site_Downtimes":
            rejectIfNotAuthenticated();
            require_once __DIR__ . '/controllers/site/site_downtimes.php';
            site_downtimes();
            break;
        case "Register":
            rejectIfNotAuthenticated('Access denied - ' . 'you need to be pre-authenticated before you can register a new account');
            require_once __DIR__ . '/controllers/user/register.php';
            register();
            break;
        case "Add_Downtime":
            rejectIfNotAuthenticated();
            require_once __DIR__ . '/controllers/downtime/add_downtime.php';
            //require_once __DIR__.'/controllers/downtime/add_downtime_old.php';
            add();
            break;
        case "Edit_Downtime":
            rejectIfNotAuthenticated();
            require_once __DIR__ . '/controllers/downtime/edit_downtime.php';
            //require_once __DIR__.'/controllers/downtime/edit_downtime_old.php';
            edit();
            break;
        case "End_Downtime":
            rejectIfNotAuthenticated();
            require_once __DIR__ . '/controllers/downtime/end_downtime.php';
            endDt();
            break;
        case "Downtime_view_endpoint_tree":
            rejectIfNotAuthenticated();
            require_once __DIR__ . '/controllers/downtime/view_endpoint_tree.php';
            getServiceandEndpointList();
            break;
        case "Edit_Downtime_view_endpoint_tree":
            rejectIfNotAuthenticated();
            require_once __DIR__ . '/controllers/downtime/view_endpoint_tree.php';
            editDowntimePopulateEndpointTree();
            break;
        case "Downtime_View_Services":
            rejectIfNotAuthenticated();
            require_once __DIR__ . '/controllers/downtime/view_services.php';
            getSitesServices();
            break;
        case "Delete_Site":
            rejectIfNotAuthenticated();
            require_once __DIR__ . '/controllers/site/delete_site.php';
            delete();
            break;
        case "Delete_Downtime":
            rejectIfNotAuthenticated();
            require_once __DIR__ . '/controllers/downtime/delete_downtime.php';
            delete();
            break;
        case "Downtimes_Overview":
            rejectIfNotAuthenticated();
            require_once __DIR__ . '/controllers/downtime/downtimes_overview.php';
            view();
            break;
        case "Delete_Service_Group":
            rejectIfNotAuthenticated();
            require_once __DIR__ . '/controllers/service_group/delete_service_group.php';
            delete();
            break;
        case "Delete_User":
            rejectIfNotAuthenticated();
            require_once __DIR__ . '/controllers/user/delete_user.php';
            delete();
            break;
        case "Edit_Certification_Status":
            rejectIfNotAuthenticated();
            require_once __DIR__ . '/controllers/site/edit_cert_status.php';
            edit();
            break;
        case "Retrieve_Account":
            rejectIfNotAuthenticated();
            require_once __DIR__ . '/controllers/user/retrieve_account.php';
            retrieve();
            break;
        case "Remove_Project_NGIs":
            rejectIfNotAuthenticated();
            require_once __DIR__ . '/controllers/project/remove_ngis.php';
            remove_ngis_project();
            break;
        case "Add_Project_NGIs":
            rejectIfNotAuthenticated();
            require_once __DIR__ . '/controllers/project/add_ngis.php';
            add_ngis_to_project();
            break;
        case "Edit_Project":
            rejectIfNotAuthenticated();
            require_once __DIR__ . '/controllers/project/edit_project.php';
            edit_project();
            break;
        case "Delete_Project":
            rejectIfNotAuthenticated();
            require_once __DIR__ . '/controllers/project/delete_project.php';
            delete_project();
            break;
        case "Admin_Move_Site":
            rejectIfNotAuthenticated();
            require_once __DIR__ . '/controllers/admin/move_site.php';
            move_site();
            break;
        case "Admin_Move_SEP":
            rejectIfNotAuthenticated();
            require_once __DIR__ . '/controllers/admin/move_service_end_point.php';
            move_service_end_point();
            break;
        case "Admin_Service_Types":
            rejectIfNotAuthenticated();
            require_once __DIR__ . '/controllers/admin/view_service_types.php';
            show_all();
            break;
        case "Admin_Service_Type":
            rejectIfNotAuthenticated();
            require_once __DIR__ . '/controllers/admin/view_service_type.php';
            view_service_type();
            break;
        case "Admin_Edit_Service_Type":
            rejectIfNotAuthenticated();
            require_once __DIR__ . '/controllers/admin/edit_service_type.php';
            edit_type();
            break;
        case "Admin_Add_Service_Type":
            rejectIfNotAuthenticated();
            require_once __DIR__ . '/controllers/admin/add_service_type.php';
            add_type();
            break;
        case "Admin_Delete_Service_Type":
            rejectIfNotAuthenticated();
            require_once __DIR__ . '/controllers/admin/delete_service_type.php';
            delete_service_type();
            break;
        case "Admin_Delete_Service_Type_Denied":
            rejectIfNotAuthenticated();
            require_once __DIR__ . '/controllers/admin/delete_service_type_denied.php';
            deny_delete_type();
            break;
        case "Admin_Add_NGI":
            rejectIfNotAuthenticated();
            require_once __DIR__ . '/controllers/admin/add_ngi.php';
            add_ngi();
            break;
        case "Admin_Users":
            rejectIfNotAuthenticated();
            require_once __DIR__ . '/controllers/admin/users.php';
            show_users();
            break;
        case "Admin_Edit_User_DN":
            rejectIfNotAuthenticated();
            require_once __DIR__ . '/controllers/admin/edit_user_dn.php';
            edit_dn();
            break;
            //        case "Admin_Change_User_Admin_Status":
            //            rejectIfNotAuthenticated();
            //            require_once __DIR__.'/controllers/admin/edit_user_isadmin.php';
            //            make_admin();
            //            break;
        //        case "Admin_Change_User_Admin_Status":
        //            rejectIfNotAuthenticated();
        //            require_once __DIR__.'/controllers/admin/edit_user_isadmin.php';
        //            make_admin();
        //            break;
        case "Admin_Add_Project":
            rejectIfNotAuthenticated();
            require_once __DIR__ . '/controllers/admin/add_project.php';
            add_project();
            break;
        case "Admin_Scopes":
            rejectIfNotAuthenticated();
            require_once __DIR__ . '/controllers/admin/scopes.php';
            show_scopes();
            break;
        case "Admin_Remove_Scope":
            rejectIfNotAuthenticated();
            require_once __DIR__ . '/controllers/admin/delete_scope.php';
            remove_scope();
            break;
        case "Admin_Add_Scope":
            rejectIfNotAuthenticated();
            require_once __DIR__ . '/controllers/admin/add_scope.php';
            add_scope();
            break;
        case "Admin_Scope":
            rejectIfNotAuthenticated();
            require_once __DIR__ . '/controllers/admin/scope.php';
            view_scope();
            break;
        case "Admin_Edit_Scope":
            rejectIfNotAuthenticated();
            require_once __DIR__ . '/controllers/admin/edit_scope.php';
            edit_scope();
            break;
        case "Admin_Delete_NGI":
            rejectIfNotAuthenticated();
            require_once __DIR__ . '/controllers/admin/delete_ngi.php';
            delete_ngi();
            break;
        case "User_Validate_DN_Change":
            rejectIfNotAuthenticated();
            require_once __DIR__ . '/controllers/user/retrieve_account_user_validate.php';
            validate_dn_change();
            break;
        case "Add_Site_Property":
            rejectIfNotAuthenticated();
            require_once __DIR__ . '/controllers/site/add_site_property.php';
            add_site_property();
            break;
        case "Add_Service_Property":
            rejectIfNotAuthenticated();
            require_once __DIR__ . '/controllers/service/add_service_property.php';
            add_service_property();
            break;
        case "Add_Endpoint_Property":
            rejectIfNotAuthenticated();
            require_once __DIR__ . '/controllers/service/add_endpoint_property.php';
            add_endpoint_property();
            break;
        case "Delete_Site_Property":
            rejectIfNotAuthenticated();
            require_once __DIR__ . '/controllers/site/delete_site_property.php';
            delete();
            break;
        case "Delete_Service_Property":
            rejectIfNotAuthenticated();
            require_once __DIR__ . '/controllers/service/delete_service_property.php';
            delete();
            break;
        case "Delete_Endpoint_Property":
            rejectIfNotAuthenticated();
            require_once __DIR__ . '/controllers/service/delete_endpoint_property.php';
            delete();
            break;
        case "Edit_Site_Property":
            rejectIfNotAuthenticated();
            require_once __DIR__ . '/controllers/site/edit_site_property.php';
            edit_property();
            break;
        case "Edit_Service_Property":
            rejectIfNotAuthenticated();
            require_once __DIR__ . '/controllers/service/edit_service_property.php';
            edit_property();
            break;
        case "Edit_Endpoint_Property":
            rejectIfNotAuthenticated();
            require_once __DIR__ . '/controllers/service/edit_endpoint_property.php';
            edit_property();
            break;
        case "Add_Service_Group_Property":
            rejectIfNotAuthenticated();
            require_once __DIR__ . '/controllers/service_group/add_service_group_property.php';
            add_service_group_property();
            break;
        case "Edit_Service_Group_Property":
            rejectIfNotAuthenticated();
            require_once __DIR__ . '/controllers/service_group/edit_service_group_property.php';
            edit_property();
            break;
        case "Delete_Service_Group_Property":
            rejectIfNotAuthenticated();
            require_once __DIR__ . '/controllers/service_group/delete_service_group_property.php';
            delete();
            break;
        case "Delete_Service_Endpoint":
            rejectIfNotAuthenticated();
            require_once __DIR__ . '/controllers/service/delete_service_endpoint.php';
            delete_endpoint();
            break;
        case "Edit_Service_Endpoint":
            rejectIfNotAuthenticated();
            require_once __DIR__ . '/controllers/service/edit_service_endpoint.php';
            edit_endpoint();
            break;
        default:
            // require auth by default
            rejectIfNotAuthenticated();
            require_once __DIR__ . '/controllers/start_page.php';
            startPage();
            break;
    }
}
Example #8
0
     navbar($USER['permissions']);
     $modarray = explode('_', $key);
     if (function_exists('plugin_show')) {
         plugin_show($db, $tableinfo, $showid, $USER, $system_settings, false);
     } else {
         show_g($db, $tableinfo, $modarray[1], $USER, $system_settings, true);
     }
     printfooter();
     exit;
 }
 // Add/modify/delete pulldown menu items
 if (substr($key, 0, 7) == 'addtype' && $USER['permissions'] & $LAYOUT) {
     printheader($httptitle, '', './includes/js/tablemanage.js');
     $modarray = explode('_', $key);
     include './includes/type_inc.php';
     add_type($db, $edit_type);
     show_type($db, $edit_type, '', $tableinfo->name);
     printfooter();
     exit;
 }
 if (substr($key, 0, 6) == 'mdtype' && $USER['permissions'] & $LAYOUT) {
     $modarray = explode("_", $key);
     include './includes/type_inc.php';
     // Ajax-based request do not need much in terms of an answer:
     if ($_POST['jsrequest']) {
         mod_type($db, $edit_type, $modarray[1]);
     } else {
         printheader($httptitle, "", './includes/js/tablemanage.js');
         mod_type($db, $edit_type, $modarray[1]);
         show_type($db, $edit_type, "", $tableinfo->name);
         printfooter();