コード例 #1
0
ファイル: route.class.php プロジェクト: silversthem/simPHPle
 public function test($url)
 {
     if ($this->base != false) {
         if (!preg_match('#^' . preg_quote($this->base) . '/?$#', $url)) {
             return false;
         }
     }
     foreach ($this->patterns as $thing) {
         if (\routing\route::test_url($url, $thing['pattern'])) {
             if ($thing['permission'] == false || $thing['permission']->test()) {
                 if (array_key_exists('files', $thing) && $thing['files'] != false) {
                     $this->files->add_files_array($thing['files']);
                 }
                 $this->create_object();
                 // creates the module object
                 return $this;
             } else {
                 return \routing\route::NOT_ALLOWED;
             }
         }
     }
 }
コード例 #2
0
ファイル: index.php プロジェクト: silversthem/simPHPle
$members->set_couple(array('member/{id}/{?option}'), 'member.php');
$forum = new \routing\route('forum', 'forum/');
$forum->files->add_file('index.php');
$forum->set_couple('forum/{cat}', 'read.php');
$forum->set_couple('forum/{cat}/{option}', 'edit.php', $user_permission);
$forum->set_couple('forum/{cat}/{id}/{[topic]}', 'read_topic.php');
$simphple = new \routing\route('simphple', 'simphple/');
$simphple->files->add_file('index.php');
$simphple->set_couple('simphple/{option}', 'simphple.php');
$articles = new \routing\route('articles', 'articles/');
$articles->files->add_file('index.php');
$articles->set_couple('articles/', 'list.php');
$articles->set_couple('articles/{id}/{title}', 'read.php');
$articles->set_couple('articles/{option}', 'edit.php', $user_permission);
$wiki = new \routing\route('wiki', 'wiki/');
$wiki->files->add_file('index.php');
$wiki->set_couple('wiki/{entry}', 'wiki.php');
$wiki->set_couple('wiki/{option}/{entry}', 'edit.php', $user_permission);
$adminZone = new \routing\route('admin');
$adminZone->files->add_file('index.php');
$adminZone->set_couple('admin/{?module}/{?option}/{?1}/{?2}', 'admin.php', $admin_permission);
$adminZone->set_couple('moderation/{?module}/{?option}/{?1}/{?2}', 'moderation.php', $moderator_permission);
$adminZone->allow_display_module(false);
$style = \routing\route::simple_route('style', '{[file]}.css');
$jscripts = \routing\route::simple_route('jscripts', '{[file]}.js');
$upload = \routing\route::simple_route('upload', 'uploads/{[file]}');
$launcher->router->set_display_route($index, 'display.php');
$launcher->load_module(launcher::AFTER_ROUTING, 'style', 'index.php');
$launcher->router->add_routes($index, $login, $members, $forum, $articles, $simphple, $wiki, $adminZone, $style, $jscripts, $upload);
$launcher->run();
echo '<br/>' . launcher::stop_timer();