From f7fe14f0f5cc17a078fa34e1a02904341dd8fd44 Mon Sep 17 00:00:00 2001 From: Militis Date: Sat, 4 Feb 2012 11:25:38 -0600 Subject: [PATCH 1/5] Start spark version. Add spark.info --- spark.info | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 spark.info diff --git a/spark.info b/spark.info new file mode 100644 index 0000000..61fd011 --- /dev/null +++ b/spark.info @@ -0,0 +1,19 @@ +# This is the spark-sdk specification. It's in a magical format called YAML. +# Use this format while developing your own sparks! + +# This is the spark name. This should be the registered name of the spark. +# It is here for informational purposes only. +name: bitauth + +# This is the current version of this spark. All sparks should be in +# x.x.x format. Validation will fail otherwise. +version: 0.2.1 + +# This is the version of CodeIgniter this spark is compatible up to. It should +# be in x.x.x format +compatibility: 2.0.x + +# There are no dependencies now, but when there are, uncomment below. +#dependencies: +# some-spark-1: 1.0.0 +# some-other-spark-2: 1.0.0 From 5de402eb40081e90c6c92c08f04ceaa8724ad6ad Mon Sep 17 00:00:00 2001 From: Militis Date: Sat, 4 Feb 2012 11:28:20 -0600 Subject: [PATCH 2/5] Move files to correct directory structure for sparks. --- {application/config => config}/bitauth.php | 0 {application/controllers => controllers}/example.php | 0 {application/language => language}/english/bitauth_lang.php | 0 {application/libraries => libraries}/Bitauth.php | 0 {application/libraries => libraries}/MY_Form_validation.php | 0 {application/libraries => libraries}/phpass.php | 0 {application/views => views}/example/activation_failed.php | 0 {application/views => views}/example/activation_successful.php | 0 {application/views => views}/example/add_group.php | 0 {application/views => views}/example/add_user.php | 0 {application/views => views}/example/edit_group.php | 0 {application/views => views}/example/edit_user.php | 0 {application/views => views}/example/groups.php | 0 {application/views => views}/example/login.php | 0 {application/views => views}/example/no_access.php | 0 {application/views => views}/example/users.php | 0 16 files changed, 0 insertions(+), 0 deletions(-) rename {application/config => config}/bitauth.php (100%) rename {application/controllers => controllers}/example.php (100%) rename {application/language => language}/english/bitauth_lang.php (100%) rename {application/libraries => libraries}/Bitauth.php (100%) rename {application/libraries => libraries}/MY_Form_validation.php (100%) rename {application/libraries => libraries}/phpass.php (100%) rename {application/views => views}/example/activation_failed.php (100%) rename {application/views => views}/example/activation_successful.php (100%) rename {application/views => views}/example/add_group.php (100%) rename {application/views => views}/example/add_user.php (100%) rename {application/views => views}/example/edit_group.php (100%) rename {application/views => views}/example/edit_user.php (100%) rename {application/views => views}/example/groups.php (100%) rename {application/views => views}/example/login.php (100%) rename {application/views => views}/example/no_access.php (100%) rename {application/views => views}/example/users.php (100%) diff --git a/application/config/bitauth.php b/config/bitauth.php similarity index 100% rename from application/config/bitauth.php rename to config/bitauth.php diff --git a/application/controllers/example.php b/controllers/example.php similarity index 100% rename from application/controllers/example.php rename to controllers/example.php diff --git a/application/language/english/bitauth_lang.php b/language/english/bitauth_lang.php similarity index 100% rename from application/language/english/bitauth_lang.php rename to language/english/bitauth_lang.php diff --git a/application/libraries/Bitauth.php b/libraries/Bitauth.php similarity index 100% rename from application/libraries/Bitauth.php rename to libraries/Bitauth.php diff --git a/application/libraries/MY_Form_validation.php b/libraries/MY_Form_validation.php similarity index 100% rename from application/libraries/MY_Form_validation.php rename to libraries/MY_Form_validation.php diff --git a/application/libraries/phpass.php b/libraries/phpass.php similarity index 100% rename from application/libraries/phpass.php rename to libraries/phpass.php diff --git a/application/views/example/activation_failed.php b/views/example/activation_failed.php similarity index 100% rename from application/views/example/activation_failed.php rename to views/example/activation_failed.php diff --git a/application/views/example/activation_successful.php b/views/example/activation_successful.php similarity index 100% rename from application/views/example/activation_successful.php rename to views/example/activation_successful.php diff --git a/application/views/example/add_group.php b/views/example/add_group.php similarity index 100% rename from application/views/example/add_group.php rename to views/example/add_group.php diff --git a/application/views/example/add_user.php b/views/example/add_user.php similarity index 100% rename from application/views/example/add_user.php rename to views/example/add_user.php diff --git a/application/views/example/edit_group.php b/views/example/edit_group.php similarity index 100% rename from application/views/example/edit_group.php rename to views/example/edit_group.php diff --git a/application/views/example/edit_user.php b/views/example/edit_user.php similarity index 100% rename from application/views/example/edit_user.php rename to views/example/edit_user.php diff --git a/application/views/example/groups.php b/views/example/groups.php similarity index 100% rename from application/views/example/groups.php rename to views/example/groups.php diff --git a/application/views/example/login.php b/views/example/login.php similarity index 100% rename from application/views/example/login.php rename to views/example/login.php diff --git a/application/views/example/no_access.php b/views/example/no_access.php similarity index 100% rename from application/views/example/no_access.php rename to views/example/no_access.php diff --git a/application/views/example/users.php b/views/example/users.php similarity index 100% rename from application/views/example/users.php rename to views/example/users.php From c11333d3a199da7a2d24bbe981a7268b7ccde745 Mon Sep 17 00:00:00 2001 From: Militis Date: Sat, 4 Feb 2012 11:29:52 -0600 Subject: [PATCH 3/5] Add autoload file. --- config/autoload.php | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 config/autoload.php diff --git a/config/autoload.php b/config/autoload.php new file mode 100644 index 0000000..268289a --- /dev/null +++ b/config/autoload.php @@ -0,0 +1,3 @@ + Date: Sat, 4 Feb 2012 11:34:10 -0600 Subject: [PATCH 4/5] Update readme for sparks. --- README.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 89291e8..eb4e52f 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,7 @@ ##Requirements * PHP 5.1.6+, 5.3+ recommended * CodeIgniter 2.0+ +* CodeIgniter Sparks * MySQL * ~~php-gmp~~ @@ -23,11 +24,12 @@ * Groups and Roles: Create groups, and assign users to your groups. Your roles are set on a group, not a user, so changing roles, whether the scale is large or small, is fast and painless. * Text-based roles: Simply list your roles in the configuration file, then check against them in your code. BitAuth handles everything in between. -##Download -[https://github.com/danmontgomery/codeigniter-bitauth/tarball/v0.2.1](https://github.com/danmontgomery/codeigniter-bitauth/tarball/v0.2.1) - ##Installation -Copy the included files to their appropriate locations in the application/ folder. Import bitauth.sql into your database. **If you would like to change the names of the tables BitAuth uses, you can change them in this .sql file, and must also change them in config/bitauth.php**. + php tools/spark install bitauth +Import bitauth.sql into your database. **If you would like to change the names of the tables BitAuth uses, you can change them in this .sql file, and must also change them in config/bitauth.php**. + +##Usage + $this->load->spark('bitauth/X.X.X'); ##Updating If updating from v0.1.x, there is a convert() function in the Example controller. This will modify the structure of your groups table, as well as convert any roles you have stored to the new format. This function uses base_convert(), which means results may vary depending on the machine you're running this on. After upgrading, be sure to check the roles in your groups for accuracy. @@ -39,4 +41,4 @@ The default login is **admin**/**admin**. I **highly** recommend you not use the default cookie session... [Try my driver replacement](http://getsparks.org/packages/session-driver/show) for CI's session library (end of shameless self promotion). -Currently, only MySQL is supported. This may change in the future. Or not. We'll see. \ No newline at end of file +Currently, only MySQL is supported. This may change in the future. Or not. We'll see. From 038ea1107a8d144ef4b4b88f58b1fec35cbe71ab Mon Sep 17 00:00:00 2001 From: Militis Date: Sat, 4 Feb 2012 13:38:22 -0600 Subject: [PATCH 5/5] Remove XML line form the top of views. Caused a fatal error. --- views/example/activation_failed.php | 43 +++++----- views/example/activation_successful.php | 43 +++++----- views/example/add_group.php | 1 - views/example/add_user.php | 1 - views/example/edit_group.php | 103 ++++++++++++------------ views/example/edit_user.php | 1 - views/example/groups.php | 1 - views/example/login.php | 1 - views/example/no_access.php | 43 +++++----- views/example/users.php | 1 - 10 files changed, 114 insertions(+), 124 deletions(-) diff --git a/views/example/activation_failed.php b/views/example/activation_failed.php index 3e24382..3b578ff 100644 --- a/views/example/activation_failed.php +++ b/views/example/activation_failed.php @@ -1,22 +1,21 @@ - - - - - - BitAuth: Activation Failed - - - '; - echo 'BitAuth Example: Activation Failed!'; - echo ''.anchor('example', 'Continue').''; - echo ''; - ?> - - \ No newline at end of file + + + + + BitAuth: Activation Failed + + + '; + echo ''; + echo ''; + echo '
BitAuth Example: Activation Failed!
'.anchor('example', 'Continue').'
'; + ?> + + diff --git a/views/example/activation_successful.php b/views/example/activation_successful.php index 799cdaf..c34f211 100644 --- a/views/example/activation_successful.php +++ b/views/example/activation_successful.php @@ -1,22 +1,21 @@ - - - - - - BitAuth: Activation Successful - - - '; - echo ''; - echo ''; - echo '
BitAuth Example: Activation Successful
'.anchor('example', 'Continue').'
'; - ?> - - \ No newline at end of file + + + + + BitAuth: Activation Successful + + + '; + echo ''; + echo ''; + echo '
BitAuth Example: Activation Successful
'.anchor('example', 'Continue').'
'; + ?> + + diff --git a/views/example/add_group.php b/views/example/add_group.php index f016d36..68c5f97 100644 --- a/views/example/add_group.php +++ b/views/example/add_group.php @@ -1,4 +1,3 @@ - diff --git a/views/example/add_user.php b/views/example/add_user.php index 41ab339..a291832 100644 --- a/views/example/add_user.php +++ b/views/example/add_user.php @@ -1,4 +1,3 @@ - diff --git a/views/example/edit_group.php b/views/example/edit_group.php index deadff0..c5e31eb 100644 --- a/views/example/edit_group.php +++ b/views/example/edit_group.php @@ -1,52 +1,51 @@ - - - - - - BitAuth: Edit Group - - - '; - echo ''; - - if( ! empty($group)) - { - echo ''; - echo ''; - echo ''; - echo ''; - - if(validation_errors()) - { - echo ''; - } - - echo ''; - } else { - echo ''; - } - - echo '
BitAuth Example: Edit Group
Group Name'.form_input('name', set_value('name', $group->name)).'
Description'.form_textarea('description', set_value('description', $group->description)).'
Roles'.form_multiselect('roles[]', $roles, set_value('roles[]', $group_roles)).'
Members'.form_multiselect('members[]', $users, set_value('members[]', $group->members)).'
'.validation_errors().'
'.anchor('example/groups', 'Cancel').' '.form_submit('submit','Update').'

Group Not Found

'.anchor('example/groups', 'Go Back').'

'; - echo form_close(); - - echo '
'; - echo anchor('example/logout', 'Logout', 'style="float: right;"'); - echo '
'; - - ?> - - + + + + + BitAuth: Edit Group + + + '; + echo 'BitAuth Example: Edit Group'; + + if( ! empty($group)) + { + echo 'Group Name'.form_input('name', set_value('name', $group->name)).''; + echo 'Description'.form_textarea('description', set_value('description', $group->description)).''; + echo 'Roles'.form_multiselect('roles[]', $roles, set_value('roles[]', $group_roles)).''; + echo 'Members'.form_multiselect('members[]', $users, set_value('members[]', $group->members)).''; + + if(validation_errors()) + { + echo ''.validation_errors().''; + } + + echo ''.anchor('example/groups', 'Cancel').' '.form_submit('submit','Update').''; + } else { + echo '

Group Not Found

'.anchor('example/groups', 'Go Back').'

'; + } + + echo ''; + echo form_close(); + + echo '
'; + echo anchor('example/logout', 'Logout', 'style="float: right;"'); + echo '
'; + + ?> + + diff --git a/views/example/edit_user.php b/views/example/edit_user.php index 07673a9..f157228 100644 --- a/views/example/edit_user.php +++ b/views/example/edit_user.php @@ -1,4 +1,3 @@ - diff --git a/views/example/groups.php b/views/example/groups.php index 8e420c9..3e556c9 100644 --- a/views/example/groups.php +++ b/views/example/groups.php @@ -1,4 +1,3 @@ - diff --git a/views/example/login.php b/views/example/login.php index 672aab8..ed215e1 100644 --- a/views/example/login.php +++ b/views/example/login.php @@ -1,4 +1,3 @@ - diff --git a/views/example/no_access.php b/views/example/no_access.php index 0a5a0e5..7fc5d60 100644 --- a/views/example/no_access.php +++ b/views/example/no_access.php @@ -1,22 +1,21 @@ - - - - - - BitAuth: Access Denied - - - '; - echo 'BitAuth Example: Access Denied'; - echo 'Nope.
'.anchor('example', 'Continue').''; - echo ''; - ?> - - \ No newline at end of file + + + + + BitAuth: Access Denied + + + '; + echo ''; + echo ''; + echo '
BitAuth Example: Access Denied
Nope.
'.anchor('example', 'Continue').'
'; + ?> + + diff --git a/views/example/users.php b/views/example/users.php index 6a7cb54..893c9e3 100644 --- a/views/example/users.php +++ b/views/example/users.php @@ -1,4 +1,3 @@ -