diff options
author | carlgmathisen <> | 2008-12-07 13:05:05 +0000 |
---|---|---|
committer | carlgmathisen <> | 2008-12-07 13:05:05 +0000 |
commit | 736e92efbc75908a2bf26fe333a03990e3bb8100 (patch) | |
tree | 21dfe413b2f3f52704ca28e17f22269f9cfdb5ea /demos | |
parent | 6228873cf9d6471463d2413e7dfd7447f759baf2 (diff) |
work on php style configuration
Diffstat (limited to 'demos')
-rw-r--r-- | demos/blog/index_php.php | 20 | ||||
-rw-r--r-- | demos/blog/protected/Data/Settings.php | 13 | ||||
-rw-r--r-- | demos/blog/protected/Pages/Admin/config.php | 13 | ||||
-rw-r--r-- | demos/blog/protected/Pages/Posts/config.php | 20 | ||||
-rw-r--r-- | demos/blog/protected/application.php | 86 | ||||
-rw-r--r-- | demos/blog/protected/application.xml | 10 | ||||
-rw-r--r-- | demos/chat/index_php.php | 27 | ||||
-rw-r--r-- | demos/chat/protected/application.php | 25 | ||||
-rw-r--r-- | demos/chat/protected/pages/config.php | 31 | ||||
-rw-r--r-- | demos/northwind-db/index_php.php | 26 | ||||
-rw-r--r-- | demos/northwind-db/protected/application.php | 29 | ||||
-rw-r--r-- | demos/personal/protected/Pages/config.php | 2 | ||||
-rw-r--r-- | demos/personal/protected/application.php | 2 | ||||
-rw-r--r-- | demos/sqlmap/index_php.php | 18 | ||||
-rw-r--r-- | demos/sqlmap/protected/pages/Manual/config.php | 18 | ||||
-rw-r--r-- | demos/time-tracker/index_php.php | 33 | ||||
-rw-r--r-- | demos/time-tracker/protected/application.php | 49 | ||||
-rw-r--r-- | demos/time-tracker/protected/pages/TimeTracker/config.php | 30 |
18 files changed, 445 insertions, 7 deletions
diff --git a/demos/blog/index_php.php b/demos/blog/index_php.php new file mode 100644 index 00000000..a5434860 --- /dev/null +++ b/demos/blog/index_php.php @@ -0,0 +1,20 @@ +<?php + +$basePath=dirname(__FILE__); +$frameworkPath=$basePath.'/../../framework/prado.php'; +$assetsPath=$basePath.'/assets'; +$runtimePath=$basePath.'/protected/runtime'; +$dataPath=$basePath.'/protected/Data'; + +if(!is_writable($assetsPath)) + die("Please make sure that the directory $assetsPath is writable by Web server process."); +if(!is_writable($runtimePath)) + die("Please make sure that the directory $runtimePath is writable by Web server process."); +if(!is_writable($dataPath)) + die("Please make sure that the directory $dataPath is writable by Web server process."); +if(!extension_loaded("sqlite")) + die("SQLite PHP extension is required."); + +require_once($frameworkPath); +$application=new TApplication('protected',false,TApplication::CONFIG_TYPE_PHP); +$application->run();
\ No newline at end of file diff --git a/demos/blog/protected/Data/Settings.php b/demos/blog/protected/Data/Settings.php new file mode 100644 index 00000000..a4adcd9f --- /dev/null +++ b/demos/blog/protected/Data/Settings.php @@ -0,0 +1,13 @@ +<?php +return array( + 'SiteTitle' => 'MyBlog', + 'SiteSubtitle' => 'A Prado-driven weblog', + 'SiteOwner' => 'Prado User', + 'AdminEmail' => 'admin@example.com', + 'MultipleUser' => false, + 'AccountApproval' => false, + 'PostPerPage' => 6, + 'RecentComments' => 6, + 'PostApproval' => false, + 'ThemeName' => 'Winter' +);
\ No newline at end of file diff --git a/demos/blog/protected/Pages/Admin/config.php b/demos/blog/protected/Pages/Admin/config.php new file mode 100644 index 00000000..d392da4e --- /dev/null +++ b/demos/blog/protected/Pages/Admin/config.php @@ -0,0 +1,13 @@ +<?php +return array( + 'authorization' => array( + array( + 'action' => 'allow', + 'roles' => 'admin', + ), + array( + 'action' => 'deny', + 'users' => '*', + ), + ), +);
\ No newline at end of file diff --git a/demos/blog/protected/Pages/Posts/config.php b/demos/blog/protected/Pages/Posts/config.php new file mode 100644 index 00000000..8af0dd56 --- /dev/null +++ b/demos/blog/protected/Pages/Posts/config.php @@ -0,0 +1,20 @@ +<?php +return array( + 'authorization' => array( + array( + 'action' => 'deny', + 'pages' => 'EditPost,NewPost,MyPost', + 'users' => '?', + ), + array( + 'action' => 'allow', + 'pages' => 'NewCategory,EditCategory', + 'users' => 'admin', + ), + array( + 'action' => 'deny', + 'pages' => 'NewCategory,EditCategory', + 'users' => '*', + ), + ) +);
\ No newline at end of file diff --git a/demos/blog/protected/application.php b/demos/blog/protected/application.php new file mode 100644 index 00000000..c6f26c7e --- /dev/null +++ b/demos/blog/protected/application.php @@ -0,0 +1,86 @@ +<?php +return array( + 'application' => array( + 'id' => 'blog', + 'mode' => 'Debug' + ), + 'paths' => array( + 'using' => array( + 'Application.Common.*', + ), + ), + // Modules configured and loaded for all services + 'modules' => array( + 'request' => array( + 'class' => 'THttpRequest', + 'properties' => array( + 'UrlFormat' => 'Path', + 'UrlManager' => 'friendly-url', + ), + ), + + 'cache' => array( + 'class' => 'System.Caching.TSqliteCache', + ), + + 'error' => array( + 'class' => 'Application.Common.BlogErrorHandler', + ), + array( + 'class' => 'System.Util.TLogRouter', + 'routes' => array( + array( + 'class' => 'TFileLogRoute', + 'properties' => array( + 'Categories' => 'BlogApplication', + ), + ), + ), + ), + array( + 'class' => 'System.Util.TParameterModule', + 'properties' => array( + 'ParameterFile' => 'Application.Data.Settings', + ), + ), + 'friendly-url' => array( + 'class' => 'System.Web.TUrlMapping', + 'properties' => array( + 'EnableCustomUrl' => true, + ), + 'urls' => array( + array('properties' => array('ServiceParameter'=>'Posts.ViewPost','pattern'=>'post/{id}/?','parameters.id'=>'\d+')), + ), + ), + ), + 'services' => array( + 'page' => array( + 'class' => 'TPageService', + 'properties' => array( + 'BasePath' => 'Application.Pages', + 'DefaultPage' => 'Posts.ListPost', + ), + 'modules' => array( + 'users' => array( + 'class' => 'Application.Common.BlogUserManager', + ), + 'auth' => array( + 'class' => 'System.Security.TAuthManager', + 'properties' => array( + 'UserManager' => 'users', + 'LoginPage' => 'Posts.ListPost', + ), + ), + 'data' => array( + 'class' => 'Application.Common.BlogDataModule', + ), + ), + ), + ), + 'pages' => array( + 'properties' => array( + 'MasterClass' => 'Application.Layouts.MainLayout', + 'Theme' => 'Basic', + ), + ), +);
\ No newline at end of file diff --git a/demos/blog/protected/application.xml b/demos/blog/protected/application.xml index d28b2dd7..1ab6a9c0 100644 --- a/demos/blog/protected/application.xml +++ b/demos/blog/protected/application.xml @@ -6,10 +6,10 @@ </paths>
<!-- modules configured and loaded for all services -->
<modules>
- <!-- Remove this comment mark to enable PATH url format
- <module id="request" class="THttpRequest" UrlFormat="Path" />
- -->
- <module id="cache" class="System.Caching.TSqliteCache" />
+
+ <module id="request" class="THttpRequest" UrlFormat="Path" UrlManager="friendly-url" />
+
+ <!--<module id="cache" class="System.Caching.TSqliteCache" />-->
<module class="Application.Common.BlogErrorHandler" />
<module id="log" class="System.Util.TLogRouter">
<route class="TFileLogRoute" Categories="BlogApplication" />
@@ -17,7 +17,7 @@ <module class="System.Util.TParameterModule" ParameterFile="Application.Data.Settings" />
<!-- use TUrlMapping to map URL patterns to particular requests -->
- <module id="friendly-url" class="System.Web.TUrlMapping">
+ <module id="friendly-url" class="System.Web.TUrlMapping" EnableCustomUrl="true">
<url ServiceParameter="Posts.ViewPost" pattern="post/{id}/?" parameters.id="\d+" />
<url ServiceParameter="Posts.ListPost" pattern="archive/{time}/?" parameters.time="\d{6}" />
<url ServiceParameter="Posts.ListPost" pattern="category/{cat}/?" parameters.cat="\d+" />
diff --git a/demos/chat/index_php.php b/demos/chat/index_php.php new file mode 100644 index 00000000..88427e4a --- /dev/null +++ b/demos/chat/index_php.php @@ -0,0 +1,27 @@ +<?php + +$frameworkPath='../../framework/prado.php'; + +/** The directory checks may be removed if performance is required **/ +$basePath=dirname(__FILE__); +$assetsPath=$basePath."/assets"; +$runtimePath=$basePath."/protected/runtime"; + +$sqliteDbDir = $basePath."/protected/App_Code"; +$sqliteDb = $sqliteDbDir."/chat.db"; + +if(!is_file($frameworkPath)) + die("Unable to find prado framework path $frameworkPath."); +if(!is_writable($assetsPath)) + die("Please make sure that the directory $assetsPath is writable by Web server process."); +if(!is_writable($runtimePath)) + die("Please make sure that the directory $runtimePath is writable by Web server process."); +if(!is_writable($sqliteDbDir)) + die("Please make sure that the directory $sqliteDbDir is writable by Web server process."); +if(!is_writable($sqliteDb)) + die("Please make sure that the sqlite file $sqliteDb is writable by Web server process."); + +require_once($frameworkPath); + +$application=new TApplication('protected',false,TApplication::CONFIG_TYPE_PHP); +$application->run();
\ No newline at end of file diff --git a/demos/chat/protected/application.php b/demos/chat/protected/application.php new file mode 100644 index 00000000..ae4e1d8c --- /dev/null +++ b/demos/chat/protected/application.php @@ -0,0 +1,25 @@ +<?php +return array( + 'application' => array( + 'id' => 'Chat', + 'mode' => 'Debug' + ), + 'paths' => array( + 'using'=>array( + 'Application.App_Code.*', + 'System.Data.*', + 'System.Data.ActiveRecord.*', + 'System.Security.*', + 'System.Web.UI.ActiveControls.*', + ), + ), + 'modules' => array( + 'db' => array( + 'class' => 'TActiveRecordConfig', + 'properties' => array( + 'EnableCache' => 'true', + 'Database.ConnectionString'=>"sqlite:protected/App_Code/chat.db", + ) + ), + ), +);
\ No newline at end of file diff --git a/demos/chat/protected/pages/config.php b/demos/chat/protected/pages/config.php new file mode 100644 index 00000000..926bf150 --- /dev/null +++ b/demos/chat/protected/pages/config.php @@ -0,0 +1,31 @@ +<?php +return array( + 'modules' => array( + 'users' => array( + 'class' => 'ChatUserManager', + ), + 'auth' => array( + 'class' => 'TAuthManager', + 'properties' => array( + 'UserManager' => 'users', + 'LoginPage' => 'Login', + ), + ), + ), + + 'authorization' => array( + array( + 'action' => 'allow', + 'pages' => 'Login', + 'users' => '?', + ), + array( + 'action' => 'allow', + 'roles' => 'normal', + ), + array( + 'action' => 'deny', + 'users' => '*', + ), + ), +);
\ No newline at end of file diff --git a/demos/northwind-db/index_php.php b/demos/northwind-db/index_php.php new file mode 100644 index 00000000..d3fe038b --- /dev/null +++ b/demos/northwind-db/index_php.php @@ -0,0 +1,26 @@ +<?php + +$basePath=dirname(__FILE__); +$frameworkPath=$basePath.'/../../framework/prado.php'; +$assetsPath=$basePath.'/assets'; +$runtimePath=$basePath.'/protected/runtime'; + +if(!is_file($frameworkPath)) + die("Unable to find prado framework path $frameworkPath."); +if(!is_writable($assetsPath)) + die("Please make sure that the directory $assetsPath is writable by Web server process."); +if(!is_writable($runtimePath)) + die("Please make sure that the directory $runtimePath is writable by Web server process."); + +/** SQLite Northwind database file **/ +$sqlite_dir = $basePath.'/protected/data'; +$sqlite_db = $sqlite_dir.'/Northwind.db'; +if(!is_writable($sqlite_dir)) + die("Please make sure that the directory $sqlite_dir is writable by Web server process."); +if(!is_writable($sqlite_db)) + die("Please make sure that the sqlite database file $sqlite_db is writable by Web server process."); + +require_once($frameworkPath); + +$application=new TApplication('protected',false,TApplication::CONFIG_TYPE_PHP); +$application->run();
\ No newline at end of file diff --git a/demos/northwind-db/protected/application.php b/demos/northwind-db/protected/application.php new file mode 100644 index 00000000..2d6d4ec7 --- /dev/null +++ b/demos/northwind-db/protected/application.php @@ -0,0 +1,29 @@ +<?php +return array( + 'application' => array( + 'id' => 'northwind-db', + 'mode' => 'Debug' + ), + 'paths' => array( + 'using'=>array( + 'System.Data.*', + 'System.Data.ActiveRecord.*', + 'System.Data.ActiveRecord.Scaffold.*', + 'Application.database.*', + ), + ), + 'modules' => array( + 'db' => array( + 'class' => 'TActiveRecordConfig', + 'database' => array( + 'ConnectionString' => 'sqlite:protected/data/Northwind.db', + ), + ), + 'i81n' => array( + 'class' => 'System.I18N.TGlobalization', + 'properties' => array( + 'DefaultCharSet'=>'UTF-8', + ), + ), + ), +);
\ No newline at end of file diff --git a/demos/personal/protected/Pages/config.php b/demos/personal/protected/Pages/config.php index 23cb184e..7a42d866 100644 --- a/demos/personal/protected/Pages/config.php +++ b/demos/personal/protected/Pages/config.php @@ -4,7 +4,7 @@ return array( array( 'action' => 'deny', 'pages' => 'Settings', - 'users' => '?', + 'users' => '?', ), ), 'pages' => array( diff --git a/demos/personal/protected/application.php b/demos/personal/protected/application.php index 26100576..0d9cadd4 100644 --- a/demos/personal/protected/application.php +++ b/demos/personal/protected/application.php @@ -5,7 +5,7 @@ return array( 'mode' => 'Debug', ), 'paths' => array( - 'using'=>array('Application.Common.*'), + 'using'=>array('Application.common.*'), ), 'modules' => array( ), diff --git a/demos/sqlmap/index_php.php b/demos/sqlmap/index_php.php new file mode 100644 index 00000000..4c382999 --- /dev/null +++ b/demos/sqlmap/index_php.php @@ -0,0 +1,18 @@ +<?php + +$basePath=dirname(__FILE__); +$frameworkPath='../../framework/prado.php'; +$assetsPath=$basePath."/assets"; +$runtimePath=$basePath."/protected/runtime"; + +if(!is_file($frameworkPath)) + die("Unable to find prado framework path $frameworkPath."); +if(!is_writable($assetsPath)) + die("Please make sure that the directory $assetsPath is writable by Web server process."); +if(!is_writable($runtimePath)) + die("Please make sure that the directory $runtimePath is writable by Web server process."); + +require_once($frameworkPath); + +$application=new TApplication; +$application->run('protected',false,TApplication::CONFIG_TYPE_PHP);
\ No newline at end of file diff --git a/demos/sqlmap/protected/pages/Manual/config.php b/demos/sqlmap/protected/pages/Manual/config.php new file mode 100644 index 00000000..ca1ec772 --- /dev/null +++ b/demos/sqlmap/protected/pages/Manual/config.php @@ -0,0 +1,18 @@ +<?php +return array( + 'modules' => array( + 'theme' => array( + 'class' => 'System.Web.UI.TThemeManager', + 'properties' => array( + 'BasePath' => 'Quickstart.themes', + 'BaseUrl' => '../quickstart/themes', + ), + ), + ), + 'pages' => array( + 'properties' => array( + 'MasterClass' => 'Application.pages.Manual.Layout', + 'Theme' => 'PradoSoft', + ), + ), +);
\ No newline at end of file diff --git a/demos/time-tracker/index_php.php b/demos/time-tracker/index_php.php new file mode 100644 index 00000000..b74690e4 --- /dev/null +++ b/demos/time-tracker/index_php.php @@ -0,0 +1,33 @@ +<?php + +$basePath=dirname(__FILE__); +//$frameworkPath='../../framework/pradolite.php'; +$frameworkPath='../../framework/prado.php'; +$assetsPath=$basePath."/assets"; +$runtimePath=$basePath."/protected/runtime"; + +$sqlite_dir = $basePath."/protected/App_Data/SQLite"; +$sqlite_db = $sqlite_dir.'/time-tracker.db'; + +if(!is_file($frameworkPath)) + die("Unable to find prado framework path $frameworkPath."); +if(!is_writable($assetsPath)) + die("Please make sure that the directory $assetsPath is writable by Web server process."); +if(!is_writable($runtimePath)) + die("Please make sure that the directory $runtimePath is writable by Web server process."); +if(!is_writable($sqlite_dir)) + die("Please make sure that the directory $sqlite_dir is writable by Web server process."); +if(!is_writable($sqlite_db)) + die("Please make sure that the sqlite database file $sqlite_dir is writable by Web server process."); + +require_once($frameworkPath); + +function h($text) +{ + $app = Prado::getApplication()->getGlobalization(); + $charset = $app ? $app->getCharset() : 'UTF-8'; + return htmlentities($text, ENT_QUOTES, $charset); +} + +$application=new TApplication; +$application->run('protected',false,TApplication::CONFIG_TYPE_PHP);
\ No newline at end of file diff --git a/demos/time-tracker/protected/application.php b/demos/time-tracker/protected/application.php new file mode 100644 index 00000000..4fd65d04 --- /dev/null +++ b/demos/time-tracker/protected/application.php @@ -0,0 +1,49 @@ +<?php +return array( + 'application' => array( + 'id'=>'Time-Tracker', + 'Mode'=>'Debug' + ), + 'paths' => array( + 'aliases' => array( + 'Quickstart' => '../../quickstart', + ), + 'using' => array( + 'System.Data.*', + 'System.Security.*', + 'Application.App_Code.*', + 'Application.App_Code.Dao.*', + 'Application.App_Data.*', + ), + ), + 'modules' => array( + 'daos' => array( + 'class' => 'DaoManager', + 'properties' => array( + 'EnableCache' => 'true', + 'configFile' => 'Application.App_Data.sqlite-sqlmap', + ), + 'daos' => array( + 'UserDao' => 'Application.App_Code.Dao.UserDao', + 'ProjectDao' => 'Application.App_Code.Dao.ProjectDao', + 'TimeEntryDao' => 'Application.App_Code.Dao.TimeEntryDao', + 'CategoryDao' => 'Application.App_Code.Dao.CategoryDao', + 'ReportDao' => 'Application.App_Code.Dao.ReportDao', + ) + ), + 'globalization' => array( + 'class' => 'System.I18N.TGlobalization', + 'properties' => array( + 'CharSet' => 'UTF-8', + ), + ), + ), + 'services' => array( + 'page' => array( + 'class' => 'TPageService', + 'properties' => array( + 'DefaultPage' => 'TimeTracker.LogTimeEntry', + ), + ), + ), +);
\ No newline at end of file diff --git a/demos/time-tracker/protected/pages/TimeTracker/config.php b/demos/time-tracker/protected/pages/TimeTracker/config.php new file mode 100644 index 00000000..8668ca15 --- /dev/null +++ b/demos/time-tracker/protected/pages/TimeTracker/config.php @@ -0,0 +1,30 @@ +<?php +return array( + 'modules' => array( + 'users' => array( + 'class' => 'Application.App_Code.UserManager', + ), + 'auth' => array( + 'class' => 'Application.App_Code.TrackerAuthManager', + 'properties' => array( + 'UserManager' => 'users', + 'LoginPage' => 'TimeTracker.Login' + ), + ), + ), + 'authorization' => array( + array('action'=>'allow','pages'=>'ProjectList, ProjectDetails, ReportResource, ReportProject','roles'=>'manager'), + array('action'=>'allow','pages'=>'LogTimeEntry','roles'=>'consultant'), + array('action'=>'allow','pages'=>'UserCrate,Logout,Login','users'=>'*'), + array('action'=>'deny','users'=>'*'), + ), + 'pages' => array( + 'properties' => array( + 'MasterClass' => 'Application.pages.TimeTracker.MainLayout', + 'Theme' => 'TimeTracker', + ), + ), + 'parameters' => array( + 'NewUserRoles' => 'admin,manager,consultant', + ), +);
\ No newline at end of file |