Пример #1
0
                                         // Action with no params
                                         $action = $_GET['action'];
                                         $args = array('pagetitle' => ucfirst($action), 'pageurl' => $_SERVER['REQUEST_URI'], 'actions' => $ACTIONS);
                                         $_SESSION['lastargs'] = $args;
                                         switch ($action) {
                                             case 'search':
                                             case 'list':
                                             case 'contact':
                                             case 'privacy':
                                             case 'terms':
                                             case 'about':
                                                 include "views/{$action}.view.php";
                                                 break;
                                             default:
                                                 Error::generate('suspicious', "Invalid action {$action} in /course/ : {$_SERVER['REQUEST_URI']}");
                                                 redirect_raw($PAGE_REL_URL);
                                                 break;
                                         }
                                     } else {
                                         $args = array('pagetitle' => 'Welcome', 'pageurl' => $_SERVER['REQUEST_URI'], 'courses' => CourseDefn::ListAll(), 'actions' => $ACTIONS);
                                         include "views/index.view.php";
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }
Пример #2
0
                                         case 'reset_password':
                                         case 'upload':
                                             include "views/{$action}.view.php";
                                             break;
                                         case 'show':
                                             Error::generate('notice', 'Invalid user ID', Error::$FLAGS['single']);
                                             if (isset($_SESSION) && $_SESSION['last_rendered_page']) {
                                                 redirect_raw($_SESSION['last_rendered_page']);
                                             } else {
                                                 redirect();
                                             }
                                             break;
                                         default:
                                             Error::generate('suspicious', "Invalid action {$action} in /user/");
                                             if (isset($_SESSION) && $_SESSION['last_rendered_page']) {
                                                 redirect_raw($_SESSION['last_rendered_page']);
                                             } else {
                                                 redirect();
                                             }
                                     }
                                 } else {
                                     include "views/index.view.php";
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }