From 487e0193c6d3093651c15b478e9e56b6a2f550f9 Mon Sep 17 00:00:00 2001 From: Mart Lubbers Date: Mon, 10 Oct 2016 14:05:42 +0200 Subject: [PATCH] add cms, add todo --- testcms-final-anon/.gitignore | 14 + .../Installation Instructions.txt | 10 + testcms-final-anon/config.default.php | 48 ++ testcms-final-anon/htaccess.txt | 15 + testcms-final-anon/index.php | 16 + testcms-final-anon/install/assets/css/app.css | 171 +++++ .../install/assets/img/logo.gif | Bin 0 -> 2116 bytes testcms-final-anon/install/assets/js/app.js | 96 +++ .../install/assets/js/jquery.js | 4 + testcms-final-anon/install/diagnose.php | 40 ++ testcms-final-anon/install/index.php | 165 +++++ testcms-final-anon/install/installer.php | 159 +++++ testcms-final-anon/install/test.sql | 94 +++ .../system/admin/controllers/comments.php | 32 + .../system/admin/controllers/metadata.php | 29 + .../system/admin/controllers/pages.php | 40 ++ .../system/admin/controllers/posts.php | 56 ++ .../system/admin/controllers/users.php | 79 +++ .../system/admin/theme/assets/css/admin.css | 585 ++++++++++++++++++ .../system/admin/theme/assets/css/popup.css | 32 + .../system/admin/theme/assets/img/active.png | Bin 0 -> 1899 bytes .../system/admin/theme/assets/img/bg.gif | Bin 0 -> 1676 bytes .../system/admin/theme/assets/img/logo.png | Bin 0 -> 2537 bytes .../system/admin/theme/assets/js/comments.js | 146 +++++ .../admin/theme/assets/js/custom_fields.js | 78 +++ .../system/admin/theme/assets/js/helpers.js | 25 + .../system/admin/theme/assets/js/mootools.js | 515 +++++++++++++++ .../system/admin/theme/assets/js/popup.js | 90 +++ .../system/admin/theme/assets/js/tabs.js | 34 + .../system/admin/theme/error_500.php | 29 + .../system/admin/theme/error_config.php | 38 ++ .../system/admin/theme/error_php.php | 71 +++ .../system/admin/theme/functions.php | 127 ++++ .../system/admin/theme/includes/footer.php | 61 ++ .../system/admin/theme/includes/header.php | 32 + .../system/admin/theme/metadata/index.php | 107 ++++ .../system/admin/theme/pages/add.php | 77 +++ .../system/admin/theme/pages/edit.php | 89 +++ .../system/admin/theme/pages/index.php | 20 + .../system/admin/theme/posts/add.php | 136 ++++ .../system/admin/theme/posts/edit.php | 197 ++++++ .../system/admin/theme/posts/index.php | 23 + .../system/admin/theme/users/add.php | 86 +++ .../system/admin/theme/users/amnesia.php | 23 + .../system/admin/theme/users/edit.php | 89 +++ .../system/admin/theme/users/index.php | 18 + .../system/admin/theme/users/login.php | 29 + .../system/admin/theme/users/reset.php | 24 + testcms-final-anon/system/bootstrap.php | 101 +++ .../system/classes/autoload.php | 67 ++ .../system/classes/comments.php | 158 +++++ testcms-final-anon/system/classes/config.php | 132 ++++ testcms-final-anon/system/classes/cookie.php | 25 + testcms-final-anon/system/classes/curl.php | 87 +++ testcms-final-anon/system/classes/db.php | 227 +++++++ testcms-final-anon/system/classes/email.php | 19 + testcms-final-anon/system/classes/error.php | 88 +++ testcms-final-anon/system/classes/events.php | 41 ++ testcms-final-anon/system/classes/helpers.php | 18 + testcms-final-anon/system/classes/input.php | 92 +++ testcms-final-anon/system/classes/ioc.php | 33 + testcms-final-anon/system/classes/items.php | 46 ++ testcms-final-anon/system/classes/log.php | 30 + .../system/classes/metadata.php | 41 ++ .../system/classes/notifications.php | 37 ++ testcms-final-anon/system/classes/pages.php | 166 +++++ testcms-final-anon/system/classes/posts.php | 326 ++++++++++ testcms-final-anon/system/classes/request.php | 46 ++ .../system/classes/response.php | 109 ++++ testcms-final-anon/system/classes/routes.php | 102 +++ testcms-final-anon/system/classes/rss.php | 80 +++ testcms-final-anon/system/classes/session.php | 34 + .../system/classes/template.php | 63 ++ testcms-final-anon/system/classes/testcms.php | 152 +++++ testcms-final-anon/system/classes/themes.php | 60 ++ testcms-final-anon/system/classes/url.php | 104 ++++ testcms-final-anon/system/classes/users.php | 260 ++++++++ .../system/functions/articles.php | 142 +++++ .../system/functions/comments.php | 116 ++++ .../system/functions/helpers.php | 107 ++++ testcms-final-anon/system/functions/menus.php | 74 +++ .../system/functions/metadata.php | 24 + testcms-final-anon/system/functions/pages.php | 64 ++ testcms-final-anon/system/functions/posts.php | 71 +++ .../system/functions/search.php | 68 ++ testcms-final-anon/system/functions/users.php | 48 ++ testcms-final-anon/themes/default/404.php | 9 + testcms-final-anon/themes/default/about.txt | 5 + testcms-final-anon/themes/default/article.php | 15 + .../themes/default/css/reset.css | 58 ++ .../themes/default/css/style.css | 551 +++++++++++++++++ .../themes/default/functions.php | 59 ++ .../themes/default/img/attribution.gif | Bin 0 -> 2116 bytes .../themes/default/img/close.gif | Bin 0 -> 140 bytes .../themes/default/img/search.gif | Bin 0 -> 210 bytes .../themes/default/includes/comment_form.php | 48 ++ .../themes/default/includes/footer.php | 51 ++ .../themes/default/includes/header.php | 57 ++ testcms-final-anon/themes/default/js/main.js | 52 ++ testcms-final-anon/themes/default/page.php | 12 + testcms-final-anon/themes/default/posts.php | 21 + testcms-final-anon/themes/default/search.php | 25 + testcms-final-anon/upgrade/assets/css/app.css | 171 +++++ .../upgrade/assets/img/logo.gif | Bin 0 -> 2116 bytes .../upgrade/classes/migrations.php | 23 + testcms-final-anon/upgrade/classes/schema.php | 16 + testcms-final-anon/upgrade/complete.php | 22 + testcms-final-anon/upgrade/index.php | 62 ++ testcms-final-anon/upgrade/migrations.php | 97 +++ testcms-final-anon/upgrade/run.php | 81 +++ todo.txt | 10 + 111 files changed, 8752 insertions(+) create mode 100644 testcms-final-anon/.gitignore create mode 100644 testcms-final-anon/Installation Instructions.txt create mode 100644 testcms-final-anon/config.default.php create mode 100644 testcms-final-anon/htaccess.txt create mode 100644 testcms-final-anon/index.php create mode 100644 testcms-final-anon/install/assets/css/app.css create mode 100644 testcms-final-anon/install/assets/img/logo.gif create mode 100644 testcms-final-anon/install/assets/js/app.js create mode 100644 testcms-final-anon/install/assets/js/jquery.js create mode 100644 testcms-final-anon/install/diagnose.php create mode 100644 testcms-final-anon/install/index.php create mode 100644 testcms-final-anon/install/installer.php create mode 100644 testcms-final-anon/install/test.sql create mode 100644 testcms-final-anon/system/admin/controllers/comments.php create mode 100644 testcms-final-anon/system/admin/controllers/metadata.php create mode 100644 testcms-final-anon/system/admin/controllers/pages.php create mode 100644 testcms-final-anon/system/admin/controllers/posts.php create mode 100644 testcms-final-anon/system/admin/controllers/users.php create mode 100644 testcms-final-anon/system/admin/theme/assets/css/admin.css create mode 100644 testcms-final-anon/system/admin/theme/assets/css/popup.css create mode 100644 testcms-final-anon/system/admin/theme/assets/img/active.png create mode 100644 testcms-final-anon/system/admin/theme/assets/img/bg.gif create mode 100644 testcms-final-anon/system/admin/theme/assets/img/logo.png create mode 100644 testcms-final-anon/system/admin/theme/assets/js/comments.js create mode 100644 testcms-final-anon/system/admin/theme/assets/js/custom_fields.js create mode 100644 testcms-final-anon/system/admin/theme/assets/js/helpers.js create mode 100644 testcms-final-anon/system/admin/theme/assets/js/mootools.js create mode 100644 testcms-final-anon/system/admin/theme/assets/js/popup.js create mode 100644 testcms-final-anon/system/admin/theme/assets/js/tabs.js create mode 100644 testcms-final-anon/system/admin/theme/error_500.php create mode 100644 testcms-final-anon/system/admin/theme/error_config.php create mode 100644 testcms-final-anon/system/admin/theme/error_php.php create mode 100644 testcms-final-anon/system/admin/theme/functions.php create mode 100644 testcms-final-anon/system/admin/theme/includes/footer.php create mode 100644 testcms-final-anon/system/admin/theme/includes/header.php create mode 100644 testcms-final-anon/system/admin/theme/metadata/index.php create mode 100644 testcms-final-anon/system/admin/theme/pages/add.php create mode 100644 testcms-final-anon/system/admin/theme/pages/edit.php create mode 100644 testcms-final-anon/system/admin/theme/pages/index.php create mode 100644 testcms-final-anon/system/admin/theme/posts/add.php create mode 100644 testcms-final-anon/system/admin/theme/posts/edit.php create mode 100644 testcms-final-anon/system/admin/theme/posts/index.php create mode 100644 testcms-final-anon/system/admin/theme/users/add.php create mode 100644 testcms-final-anon/system/admin/theme/users/amnesia.php create mode 100644 testcms-final-anon/system/admin/theme/users/edit.php create mode 100644 testcms-final-anon/system/admin/theme/users/index.php create mode 100644 testcms-final-anon/system/admin/theme/users/login.php create mode 100644 testcms-final-anon/system/admin/theme/users/reset.php create mode 100644 testcms-final-anon/system/bootstrap.php create mode 100644 testcms-final-anon/system/classes/autoload.php create mode 100644 testcms-final-anon/system/classes/comments.php create mode 100644 testcms-final-anon/system/classes/config.php create mode 100644 testcms-final-anon/system/classes/cookie.php create mode 100644 testcms-final-anon/system/classes/curl.php create mode 100644 testcms-final-anon/system/classes/db.php create mode 100644 testcms-final-anon/system/classes/email.php create mode 100644 testcms-final-anon/system/classes/error.php create mode 100644 testcms-final-anon/system/classes/events.php create mode 100644 testcms-final-anon/system/classes/helpers.php create mode 100644 testcms-final-anon/system/classes/input.php create mode 100644 testcms-final-anon/system/classes/ioc.php create mode 100644 testcms-final-anon/system/classes/items.php create mode 100644 testcms-final-anon/system/classes/log.php create mode 100644 testcms-final-anon/system/classes/metadata.php create mode 100644 testcms-final-anon/system/classes/notifications.php create mode 100644 testcms-final-anon/system/classes/pages.php create mode 100644 testcms-final-anon/system/classes/posts.php create mode 100644 testcms-final-anon/system/classes/request.php create mode 100644 testcms-final-anon/system/classes/response.php create mode 100644 testcms-final-anon/system/classes/routes.php create mode 100644 testcms-final-anon/system/classes/rss.php create mode 100644 testcms-final-anon/system/classes/session.php create mode 100644 testcms-final-anon/system/classes/template.php create mode 100644 testcms-final-anon/system/classes/testcms.php create mode 100644 testcms-final-anon/system/classes/themes.php create mode 100644 testcms-final-anon/system/classes/url.php create mode 100644 testcms-final-anon/system/classes/users.php create mode 100644 testcms-final-anon/system/functions/articles.php create mode 100644 testcms-final-anon/system/functions/comments.php create mode 100644 testcms-final-anon/system/functions/helpers.php create mode 100644 testcms-final-anon/system/functions/menus.php create mode 100644 testcms-final-anon/system/functions/metadata.php create mode 100644 testcms-final-anon/system/functions/pages.php create mode 100644 testcms-final-anon/system/functions/posts.php create mode 100644 testcms-final-anon/system/functions/search.php create mode 100644 testcms-final-anon/system/functions/users.php create mode 100644 testcms-final-anon/themes/default/404.php create mode 100644 testcms-final-anon/themes/default/about.txt create mode 100644 testcms-final-anon/themes/default/article.php create mode 100644 testcms-final-anon/themes/default/css/reset.css create mode 100644 testcms-final-anon/themes/default/css/style.css create mode 100644 testcms-final-anon/themes/default/functions.php create mode 100644 testcms-final-anon/themes/default/img/attribution.gif create mode 100644 testcms-final-anon/themes/default/img/close.gif create mode 100644 testcms-final-anon/themes/default/img/search.gif create mode 100644 testcms-final-anon/themes/default/includes/comment_form.php create mode 100644 testcms-final-anon/themes/default/includes/footer.php create mode 100644 testcms-final-anon/themes/default/includes/header.php create mode 100644 testcms-final-anon/themes/default/js/main.js create mode 100644 testcms-final-anon/themes/default/page.php create mode 100644 testcms-final-anon/themes/default/posts.php create mode 100644 testcms-final-anon/themes/default/search.php create mode 100644 testcms-final-anon/upgrade/assets/css/app.css create mode 100644 testcms-final-anon/upgrade/assets/img/logo.gif create mode 100644 testcms-final-anon/upgrade/classes/migrations.php create mode 100644 testcms-final-anon/upgrade/classes/schema.php create mode 100644 testcms-final-anon/upgrade/complete.php create mode 100644 testcms-final-anon/upgrade/index.php create mode 100644 testcms-final-anon/upgrade/migrations.php create mode 100644 testcms-final-anon/upgrade/run.php create mode 100644 todo.txt diff --git a/testcms-final-anon/.gitignore b/testcms-final-anon/.gitignore new file mode 100644 index 0000000..d40e4dc --- /dev/null +++ b/testcms-final-anon/.gitignore @@ -0,0 +1,14 @@ +# ignore os/app generated files +Thumbs.db +.DS_Store +*.esproj + +# ignore generated config +/config.php + +# ignore user mod_rewrite +/.htaccess + +# ignore debug and custom themes +/themes/* +!/themes/default diff --git a/testcms-final-anon/Installation Instructions.txt b/testcms-final-anon/Installation Instructions.txt new file mode 100644 index 0000000..e5b3c5d --- /dev/null +++ b/testcms-final-anon/Installation Instructions.txt @@ -0,0 +1,10 @@ +Installation Instructions: + +Extract the testcms.zip to your desired folder. +Change the file permissions to allow all users write access to the folder you extracted testcms to. +Create a database in MySQL for TestCMS. +Register that folder with your webserver of choice. +Assure that htaccess.txt or .htaccess is accessable for Apache on your webserver. +Go to a web browser and go to the index page of testcms and follow the further instructions to finish your setup. + +If you have any questions, email wagnertrust2012@gmail.com. diff --git a/testcms-final-anon/config.default.php b/testcms-final-anon/config.default.php new file mode 100644 index 0000000..49fe3f0 --- /dev/null +++ b/testcms-final-anon/config.default.php @@ -0,0 +1,48 @@ + array( + 'host' => '127.0.0.1', + 'username' => 'root', + 'password' => '', + 'name' => 'testcms' + ), + + // Application settings + 'application' => array( + // url paths + 'base_url' => '/', + 'index_page' => 'index.php', + + // your time zone + 'timezone' => 'UTC', + + // access to admin + 'admin_folder' => 'admin', + + // your unique application key used for signing passwords + 'key' => '' + ), + + // Session details + 'session' => array( + 'name' => 'testcms', + 'expire' => 3600, + 'path' => '/', + 'domain' => '' + ), + + // Error handling + 'error' => array( + 'ignore' => array(E_NOTICE, E_USER_NOTICE, E_DEPRECATED, E_USER_DEPRECATED), + 'detail' => false, + 'log' => false + ), + + // Show database profile + 'debug' => false +); diff --git a/testcms-final-anon/htaccess.txt b/testcms-final-anon/htaccess.txt new file mode 100644 index 0000000..3b425b8 --- /dev/null +++ b/testcms-final-anon/htaccess.txt @@ -0,0 +1,15 @@ + + RewriteEngine On + # RewriteBase / + + # Allow any files or directories that exist to be displayed directly + RewriteCond %{REQUEST_FILENAME} !-f + RewriteCond %{REQUEST_FILENAME} !-d + + # Rewrite all other URLs to index.php/URL + RewriteRule ^(.*)$ index.php?/$1 [L,QSA] + + + + ErrorDocument 404 index.php + diff --git a/testcms-final-anon/index.php b/testcms-final-anon/index.php new file mode 100644 index 0000000..e92d81c --- /dev/null +++ b/testcms-final-anon/index.php @@ -0,0 +1,16 @@ + button, form > p { + margin-right: 75px; + } + + button:hover, .button:hover { + opacity: .9; + } + button:active, .button:active { + opacity: 1; + + background-color: #3a5968; + background-image: -webkit-gradient(linear, left top, left bottom, from(#365361), to(#587684)); + background-image: -webkit-linear-gradient(top, #365361, #587684); + background-image: -moz-linear-gradient(top, #365361, #587684); + background-image: -o-linear-gradient(top, #365361, #587684); + background-image: -ms-linear-gradient(top, #365361, #587684); + background-image: linear-gradient(top, #365361, #587684); + filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0,StartColorStr='#365361', EndColorStr='#587684'); + + box-shadow: inset 0 1px 1px rgba(0,0,0,.15), 0 -1px 1px rgba(0,0,0,.1); + + border-color: #192e39; + } + +p.footer { + font-size: 12px; + text-align: center; + + padding-top: 40px; +} + p.footer a { + color: #587684; + } diff --git a/testcms-final-anon/install/assets/img/logo.gif b/testcms-final-anon/install/assets/img/logo.gif new file mode 100644 index 0000000000000000000000000000000000000000..1f876bf3080d08cbdd548754d431d8b484d87ac5 GIT binary patch literal 2116 zcmah~VN4rk7=GLPS|s4b5QPp5-Zpf&0BM;)2yRMSC}r3+rA&sJd0embN6$T-J z?9YsUocd3HIO`Jqu{jep;+$dg$5@QZW)?IkSu|NPmZ>3yzlqjccE}!XBS@!9>@bUH8su8&o3-2EG;eRx(>x_=ij6fzy&+?s&F6>3;9Dn zudf~b6(952tnB0fCexaN4sPVgC|9uxPS^oeP!CnSpk{lb(LtJua*HYL`@J8*L7#54 zmiODtGN>vcsse!H0rX`OsxXQ87)q6etfB$9Z=t<&TFWA?cogx&3JOH*rFh)LL5jyr zJYsO-u>f+YR#r&y3B+@VTgFQ4`0(Pl)IOj43X!(k5p<1S&| z4^GNCEZVplajaG+h7RJrnHHZ?`eOxrO5l5k5I3RyN>=kz`xA(N&rJ;XAl?h$tVt?; z!zSPP%xo(D0^(Y55ff6%JZTI$BeNV<3{v4jRpbAbIcj;6gU}DN4#Vo{=3N_*-tu27jWcR z@*Fupf@tj`-IjuAiB1m2;SMS_^SlN*oSEu44E~e#xn?VdJFXm+gllhZpqfIJI+mHS z37E(#8AWGGTL3DypjcjOX``0sE_f^tw?Y3D62ZxLf->1Q@TdsB23XZF;H9Ow* zi)#&ktI&hmWJA#;s*;SQP%U1oT?Dc&;a>wD$KQ~bL9Iol+m@iyv-c(Q@fB6z3~#wg@uoXB*hvY><77eViS%SR7l&`q+MU4|*D`g_CXnwpt`O zg3S{3LSM^IMqdI6hEa+H(=bY_&*!BlWymt40o?P=q_q7|(j%q(1P&ajb z6A!J5w*j`^()EAxy1w-x=3fK2DAVJZp0^$}42+y#`()R5;oCL4?_T|E@#V!zh`y5V ze>e5>*^e5&J$vSdjuW@1cWgEuZT*s|oeAY1@+5o};TPi_x#6MD-F literal 0 HcmV?d00001 diff --git a/testcms-final-anon/install/assets/js/app.js b/testcms-final-anon/install/assets/js/app.js new file mode 100644 index 0000000..2ed7fa3 --- /dev/null +++ b/testcms-final-anon/install/assets/js/app.js @@ -0,0 +1,96 @@ +$(function() { + var body = $('body'), form = $('form'), notes = $('.notes'); + + // remove no js error + body.find('.nojs').remove(); + + // Do some fancy fading in, and get rid of that damn error. + body.hide().fadeIn() + + // remove previous notifications + var remove_notes = function() { + notes.find('p').remove(); + notes.hide(); + }; + + // Check when the MySQL form has been submitted, and AJAX a request off. + var check = function() { + // remove previous notifications + remove_notes(); + + // dim fieldset + $('#diagnose').animate({'opacity': 0.5}, 250, function() { + $.ajax({ + 'type': 'POST', + 'url': 'diagnose.php', + 'data': form.serialize(), + 'success': check_result + }); + }); + + return false; + }; + + var check_result = function(data) { + $('#diagnose').animate({'opacity': 1}); + + if(data == 'good') { + notes.show().append('

✓ Database test successful.

').fadeIn(); + } else { + notes.show().append('

' + data + '

').fadeIn(); + } + }; + + var submit = function() { + $.ajax({ + 'type': 'POST', + 'url': 'installer.php', + 'data': form.serialize(), + 'dataType': 'json', + 'success': submit_result + }); + + return false; + }; + + var submit_result = function(data) { + // remove previous notifications + remove_notes(); + + if(data.installed) { + var content = $('.content'); + + content.animate({'opacity': 0}, function() { + var btn_text = 'Continue to your site.'; + + var html = '

Thanks for installing!

'; + html += '

We created an account for you.
The username is admin, and the password is ' + data.password + '.

'; + + if(data.warnings.length) { + btn_text = 'OK, I understand, Continue to your site.'; + + html += '
    '; + + for(var i = 0; i < data.warnings.length; i++) { + var warn = data.warnings[i]; + html += '
  • ' + warn + '
  • '; + } + + html += '
'; + } + + html += '

' + btn_text + '

'; + + content.html(html).animate({'opacity': 1}); + }); + } else { + notes.show().append('

' + data.errors.join(', ') + '

').fadeIn(); + } + }; + + // Bind normal form submit + form.bind('submit', submit); + + // Bind db check + $('a[href$=#check]').bind('click', check); +}); diff --git a/testcms-final-anon/install/assets/js/jquery.js b/testcms-final-anon/install/assets/js/jquery.js new file mode 100644 index 0000000..308f628 --- /dev/null +++ b/testcms-final-anon/install/assets/js/jquery.js @@ -0,0 +1,4 @@ +/*! jQuery v1.7.1 jquery.com | jquery.org/license */ +(function(a,b){function cy(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cv(a){if(!ck[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){cl||(cl=c.createElement("iframe"),cl.frameBorder=cl.width=cl.height=0),b.appendChild(cl);if(!cm||!cl.createElement)cm=(cl.contentWindow||cl.contentDocument).document,cm.write((c.compatMode==="CSS1Compat"?"":"")+""),cm.close();d=cm.createElement(a),cm.body.appendChild(d),e=f.css(d,"display"),b.removeChild(cl)}ck[a]=e}return ck[a]}function cu(a,b){var c={};f.each(cq.concat.apply([],cq.slice(0,b)),function(){c[this]=a});return c}function ct(){cr=b}function cs(){setTimeout(ct,0);return cr=f.now()}function cj(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ci(){try{return new a.XMLHttpRequest}catch(b){}}function cc(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g0){if(c!=="border")for(;g=0===c})}function S(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function K(){return!0}function J(){return!1}function n(a,b,c){var d=b+"defer",e=b+"queue",g=b+"mark",h=f._data(a,d);h&&(c==="queue"||!f._data(a,e))&&(c==="mark"||!f._data(a,g))&&setTimeout(function(){!f._data(a,e)&&!f._data(a,g)&&(f.removeData(a,d,!0),h.fire())},0)}function m(a){for(var b in a){if(b==="data"&&f.isEmptyObject(a[b]))continue;if(b!=="toJSON")return!1}return!0}function l(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(k,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNumeric(d)?parseFloat(d):j.test(d)?f.parseJSON(d):d}catch(g){}f.data(a,c,d)}else d=b}return d}function h(a){var b=g[a]={},c,d;a=a.split(/\s+/);for(c=0,d=a.length;c)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,n=/^[\],:{}\s]*$/,o=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,p=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,q=/(?:^|:|,)(?:\s*\[)+/g,r=/(webkit)[ \/]([\w.]+)/,s=/(opera)(?:.*version)?[ \/]([\w.]+)/,t=/(msie) ([\w.]+)/,u=/(mozilla)(?:.*? rv:([\w.]+))?/,v=/-([a-z]|[0-9])/ig,w=/^-ms-/,x=function(a,b){return(b+"").toUpperCase()},y=d.userAgent,z,A,B,C=Object.prototype.toString,D=Object.prototype.hasOwnProperty,E=Array.prototype.push,F=Array.prototype.slice,G=String.prototype.trim,H=Array.prototype.indexOf,I={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=m.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.7.1",length:0,size:function(){return this.length},toArray:function(){return F.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?E.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),A.add(a);return this},eq:function(a){a=+a;return a===-1?this.slice(a):this.slice(a,a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(F.apply(this,arguments),"slice",F.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:E,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j0)return;A.fireWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").off("ready")}},bindReady:function(){if(!A){A=e.Callbacks("once memory");if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",B,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",B),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&J()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a&&typeof a=="object"&&"setInterval"in a},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},type:function(a){return a==null?String(a):I[C.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;try{if(a.constructor&&!D.call(a,"constructor")&&!D.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||D.call(a,d)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw new Error(a)},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(n.test(b.replace(o,"@").replace(p,"]").replace(q,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(c){var d,f;try{a.DOMParser?(f=new DOMParser,d=f.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(g){d=b}(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&e.error("Invalid XML: "+c);return d},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(w,"ms-").replace(v,x)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i1?i.call(arguments,0):b,j.notifyWith(k,e)}}function l(a){return function(c){b[a]=arguments.length>1?i.call(arguments,0):c,--g||j.resolveWith(j,b)}}var b=i.call(arguments,0),c=0,d=b.length,e=Array(d),g=d,h=d,j=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred(),k=j.promise();if(d>1){for(;c
a",d=q.getElementsByTagName("*"),e=q.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=q.getElementsByTagName("input")[0],b={leadingWhitespace:q.firstChild.nodeType===3,tbody:!q.getElementsByTagName("tbody").length,htmlSerialize:!!q.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,getSetAttribute:q.className!=="t",enctype:!!c.createElement("form").enctype,html5Clone:c.createElement("nav").cloneNode(!0).outerHTML!=="<:nav>",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0},i.checked=!0,b.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,b.optDisabled=!h.disabled;try{delete q.test}catch(s){b.deleteExpando=!1}!q.addEventListener&&q.attachEvent&&q.fireEvent&&(q.attachEvent("onclick",function(){b.noCloneEvent=!1}),q.cloneNode(!0).fireEvent("onclick")),i=c.createElement("input"),i.value="t",i.setAttribute("type","radio"),b.radioValue=i.value==="t",i.setAttribute("checked","checked"),q.appendChild(i),k=c.createDocumentFragment(),k.appendChild(q.lastChild),b.checkClone=k.cloneNode(!0).cloneNode(!0).lastChild.checked,b.appendChecked=i.checked,k.removeChild(i),k.appendChild(q),q.innerHTML="",a.getComputedStyle&&(j=c.createElement("div"),j.style.width="0",j.style.marginRight="0",q.style.width="2px",q.appendChild(j),b.reliableMarginRight=(parseInt((a.getComputedStyle(j,null)||{marginRight:0}).marginRight,10)||0)===0);if(q.attachEvent)for(o in{submit:1,change:1,focusin:1})n="on"+o,p=n in q,p||(q.setAttribute(n,"return;"),p=typeof q[n]=="function"),b[o+"Bubbles"]=p;k.removeChild(q),k=g=h=j=q=i=null,f(function(){var a,d,e,g,h,i,j,k,m,n,o,r=c.getElementsByTagName("body")[0];!r||(j=1,k="position:absolute;top:0;left:0;width:1px;height:1px;margin:0;",m="visibility:hidden;border:0;",n="style='"+k+"border:5px solid #000;padding:0;'",o="
"+""+"
",a=c.createElement("div"),a.style.cssText=m+"width:0;height:0;position:static;top:0;margin-top:"+j+"px",r.insertBefore(a,r.firstChild),q=c.createElement("div"),a.appendChild(q),q.innerHTML="
t
",l=q.getElementsByTagName("td"),p=l[0].offsetHeight===0,l[0].style.display="",l[1].style.display="none",b.reliableHiddenOffsets=p&&l[0].offsetHeight===0,q.innerHTML="",q.style.width=q.style.paddingLeft="1px",f.boxModel=b.boxModel=q.offsetWidth===2,typeof q.style.zoom!="undefined"&&(q.style.display="inline",q.style.zoom=1,b.inlineBlockNeedsLayout=q.offsetWidth===2,q.style.display="",q.innerHTML="
",b.shrinkWrapBlocks=q.offsetWidth!==2),q.style.cssText=k+m,q.innerHTML=o,d=q.firstChild,e=d.firstChild,h=d.nextSibling.firstChild.firstChild,i={doesNotAddBorder:e.offsetTop!==5,doesAddBorderForTableAndCells:h.offsetTop===5},e.style.position="fixed",e.style.top="20px",i.fixedPosition=e.offsetTop===20||e.offsetTop===15,e.style.position=e.style.top="",d.style.overflow="hidden",d.style.position="relative",i.subtractsBorderForOverflowNotVisible=e.offsetTop===-5,i.doesNotIncludeMarginInBodyOffset=r.offsetTop!==j,r.removeChild(a),q=a=null,f.extend(b,i))});return b}();var j=/^(?:\{.*\}|\[.*\])$/,k=/([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!m(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g,h,i,j=f.expando,k=typeof c=="string",l=a.nodeType,m=l?f.cache:a,n=l?a[j]:a[j]&&j,o=c==="events";if((!n||!m[n]||!o&&!e&&!m[n].data)&&k&&d===b)return;n||(l?a[j]=n=++f.uuid:n=j),m[n]||(m[n]={},l||(m[n].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?m[n]=f.extend(m[n],c):m[n].data=f.extend(m[n].data,c);g=h=m[n],e||(h.data||(h.data={}),h=h.data),d!==b&&(h[f.camelCase(c)]=d);if(o&&!h[c])return g.events;k?(i=h[c],i==null&&(i=h[f.camelCase(c)])):i=h;return i}},removeData:function(a,b,c){if(!!f.acceptData(a)){var d,e,g,h=f.expando,i=a.nodeType,j=i?f.cache:a,k=i?a[h]:h;if(!j[k])return;if(b){d=c?j[k]:j[k].data;if(d){f.isArray(b)||(b in d?b=[b]:(b=f.camelCase(b),b in d?b=[b]:b=b.split(" ")));for(e=0,g=b.length;e-1)return!0;return!1},val:function(a){var c,d,e,g=this[0];{if(!!arguments.length){e=f.isFunction(a);return this.each(function(d){var g=f(this),h;if(this.nodeType===1){e?h=a.call(this,d,g.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.nodeName.toLowerCase()]||f.valHooks[this.type];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}if(g){c=f.valHooks[g.nodeName.toLowerCase()]||f.valHooks[g.type];if(c&&"get"in c&&(d=c.get(g,"value"))!==b)return d;d=g.value;return typeof d=="string"?d.replace(q,""):d==null?"":d}}}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c,d,e,g=a.selectedIndex,h=[],i=a.options,j=a.type==="select-one";if(g<0)return null;c=j?g:0,d=j?g+1:i.length;for(;c=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(a,c,d,e){var g,h,i,j=a.nodeType;if(!!a&&j!==3&&j!==8&&j!==2){if(e&&c in f.attrFn)return f(a)[c](d);if(typeof a.getAttribute=="undefined")return f.prop(a,c,d);i=j!==1||!f.isXMLDoc(a),i&&(c=c.toLowerCase(),h=f.attrHooks[c]||(u.test(c)?x:w));if(d!==b){if(d===null){f.removeAttr(a,c);return}if(h&&"set"in h&&i&&(g=h.set(a,d,c))!==b)return g;a.setAttribute(c,""+d);return d}if(h&&"get"in h&&i&&(g=h.get(a,c))!==null)return g;g=a.getAttribute(c);return g===null?b:g}},removeAttr:function(a,b){var c,d,e,g,h=0;if(b&&a.nodeType===1){d=b.toLowerCase().split(p),g=d.length;for(;h=0}})});var z=/^(?:textarea|input|select)$/i,A=/^([^\.]*)?(?:\.(.+))?$/,B=/\bhover(\.\S+)?\b/,C=/^key/,D=/^(?:mouse|contextmenu)|click/,E=/^(?:focusinfocus|focusoutblur)$/,F=/^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,G=function(a){var b=F.exec(a);b&&(b[1]=(b[1]||"").toLowerCase(),b[3]=b[3]&&new RegExp("(?:^|\\s)"+b[3]+"(?:\\s|$)"));return b},H=function(a,b){var c=a.attributes||{};return(!b[1]||a.nodeName.toLowerCase()===b[1])&&(!b[2]||(c.id||{}).value===b[2])&&(!b[3]||b[3].test((c["class"]||{}).value))},I=function(a){return f.event.special.hover?a:a.replace(B,"mouseenter$1 mouseleave$1")}; +f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3||a.nodeType===8||!c||!d||!(h=f._data(a)))){d.handler&&(p=d,d=p.handler),d.guid||(d.guid=f.guid++),j=h.events,j||(h.events=j={}),i=h.handle,i||(h.handle=i=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.dispatch.apply(i.elem,arguments):b},i.elem=a),c=f.trim(I(c)).split(" ");for(k=0;k=0&&(h=h.slice(0,-1),k=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if((!e||f.event.customEvent[h])&&!f.event.global[h])return;c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.isTrigger=!0,c.exclusive=k,c.namespace=i.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)"):null,o=h.indexOf(":")<0?"on"+h:"";if(!e){j=f.cache;for(l in j)j[l].events&&j[l].events[h]&&f.event.trigger(c,d,j[l].handle.elem,!0);return}c.result=b,c.target||(c.target=e),d=d!=null?f.makeArray(d):[],d.unshift(c),p=f.event.special[h]||{};if(p.trigger&&p.trigger.apply(e,d)===!1)return;r=[[e,p.bindType||h]];if(!g&&!p.noBubble&&!f.isWindow(e)){s=p.delegateType||h,m=E.test(s+h)?e:e.parentNode,n=null;for(;m;m=m.parentNode)r.push([m,s]),n=m;n&&n===e.ownerDocument&&r.push([n.defaultView||n.parentWindow||a,s])}for(l=0;le&&i.push({elem:this,matches:d.slice(e)});for(j=0;j0?this.on(b,null,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0),C.test(b)&&(f.event.fixHooks[b]=f.event.keyHooks),D.test(b)&&(f.event.fixHooks[b]=f.event.mouseHooks)}),function(){function x(a,b,c,e,f,g){for(var h=0,i=e.length;h0){k=j;break}}j=j[a]}e[h]=k}}}function w(a,b,c,e,f,g){for(var h=0,i=e.length;h+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d="sizcache"+(Math.random()+"").replace(".",""),e=0,g=Object.prototype.toString,h=!1,i=!0,j=/\\/g,k=/\r\n/g,l=/\W/;[0,0].sort(function(){i=!1;return 0});var m=function(b,d,e,f){e=e||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return e;var i,j,k,l,n,q,r,t,u=!0,v=m.isXML(d),w=[],x=b;do{a.exec(""),i=a.exec(x);if(i){x=i[3],w.push(i[1]);if(i[2]){l=i[3];break}}}while(i);if(w.length>1&&p.exec(b))if(w.length===2&&o.relative[w[0]])j=y(w[0]+w[1],d,f);else{j=o.relative[w[0]]?[d]:m(w.shift(),d);while(w.length)b=w.shift(),o.relative[b]&&(b+=w.shift()),j=y(b,j,f)}else{!f&&w.length>1&&d.nodeType===9&&!v&&o.match.ID.test(w[0])&&!o.match.ID.test(w[w.length-1])&&(n=m.find(w.shift(),d,v),d=n.expr?m.filter(n.expr,n.set)[0]:n.set[0]);if(d){n=f?{expr:w.pop(),set:s(f)}:m.find(w.pop(),w.length===1&&(w[0]==="~"||w[0]==="+")&&d.parentNode?d.parentNode:d,v),j=n.expr?m.filter(n.expr,n.set):n.set,w.length>0?k=s(j):u=!1;while(w.length)q=w.pop(),r=q,o.relative[q]?r=w.pop():q="",r==null&&(r=d),o.relative[q](k,r,v)}else k=w=[]}k||(k=j),k||m.error(q||b);if(g.call(k)==="[object Array]")if(!u)e.push.apply(e,k);else if(d&&d.nodeType===1)for(t=0;k[t]!=null;t++)k[t]&&(k[t]===!0||k[t].nodeType===1&&m.contains(d,k[t]))&&e.push(j[t]);else for(t=0;k[t]!=null;t++)k[t]&&k[t].nodeType===1&&e.push(j[t]);else s(k,e);l&&(m(l,h,e,f),m.uniqueSort(e));return e};m.uniqueSort=function(a){if(u){h=i,a.sort(u);if(h)for(var b=1;b0},m.find=function(a,b,c){var d,e,f,g,h,i;if(!a)return[];for(e=0,f=o.order.length;e":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!l.test(b)){b=b.toLowerCase();for(;e=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(j,"")},TAG:function(a,b){return a[1].replace(j,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||m.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&m.error(a[0]);a[0]=e++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(j,"");!f&&o.attrMap[g]&&(a[1]=o.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(j,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=m(b[3],null,null,c);else{var g=m.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(o.match.POS.test(b[0])||o.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!m(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return bc[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=o.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||n([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||!!a.nodeName&&a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=m.attr?m.attr(a,c):o.attrHandle[c]?o.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":!f&&m.attr?d!=null:f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=o.setFilters[e];if(f)return f(a,c,b,d)}}},p=o.match.POS,q=function(a,b){return"\\"+(b-0+1)};for(var r in o.match)o.match[r]=new RegExp(o.match[r].source+/(?![^\[]*\])(?![^\(]*\))/.source),o.leftMatch[r]=new RegExp(/(^(?:.|\r|\n)*?)/.source+o.match[r].source.replace(/\\(\d+)/g,q));var s=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(t){s=function(a,b){var c=0,d=b||[];if(g.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var e=a.length;c",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(o.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},o.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(o.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(o.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=m,b=c.createElement("div"),d="__sizzle__";b.innerHTML="

";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){m=function(b,e,f,g){e=e||c;if(!g&&!m.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return s(e.getElementsByTagName(b),f);if(h[2]&&o.find.CLASS&&e.getElementsByClassName)return s(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return s([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return s([],f);if(i.id===h[3])return s([i],f)}try{return s(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var k=e,l=e.getAttribute("id"),n=l||d,p=e.parentNode,q=/^\s*[+~]/.test(b);l?n=n.replace(/'/g,"\\$&"):e.setAttribute("id",n),q&&p&&(e=e.parentNode);try{if(!q||p)return s(e.querySelectorAll("[id='"+n+"'] "+b),f)}catch(r){}finally{l||k.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)m[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}m.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!m.isXML(a))try{if(e||!o.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return m(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="
";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;o.order.splice(1,0,"CLASS"),o.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?m.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?m.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:m.contains=function(){return!1},m.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var y=function(a,b,c){var d,e=[],f="",g=b.nodeType?[b]:b;while(d=o.match.PSEUDO.exec(a))f+=d[0],a=a.replace(o.match.PSEUDO,"");a=o.relative[a]?a+"*":a;for(var h=0,i=g.length;h0)for(h=g;h=0:f.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h=1;while(g&&g.ownerDocument&&g!==b){for(d=0;d-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a)return this[0]&&this[0].parentNode?this.prevAll().length:-1;if(typeof a=="string")return f.inArray(this[0],f(a));return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(S(c[0])||S(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling(a.parentNode.firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c);L.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!R[a]?f.unique(e):e,(this.length>1||N.test(d))&&M.test(a)&&(e=e.reverse());return this.pushStack(e,a,P.call(arguments).join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var V="abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",W=/ jQuery\d+="(?:\d+|null)"/g,X=/^\s+/,Y=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,Z=/<([\w:]+)/,$=/",""],legend:[1,"
","
"],thead:[1,"","
"],tr:[2,"","
"],td:[3,"","
"],col:[2,"","
"],area:[1,"",""],_default:[0,"",""]},bh=U(c);bg.optgroup=bg.option,bg.tbody=bg.tfoot=bg.colgroup=bg.caption=bg.thead,bg.th=bg.td,f.support.htmlSerialize||(bg._default=[1,"div
","
"]),f.fn.extend({text:function(a){if(f.isFunction(a))return this.each(function(b){var c=f(this);c.text(a.call(this,b,c.text()))});if(typeof a!="object"&&a!==b)return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a));return f.text(this)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=f.isFunction(a);return this.each(function(c){f(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f.clean(arguments);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,f.clean(arguments));return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function() +{for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(W,""):null;if(typeof a=="string"&&!ba.test(a)&&(f.support.leadingWhitespace||!X.test(a))&&!bg[(Z.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Y,"<$1>");try{for(var c=0,d=this.length;c1&&l0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d,e,g,h=f.support.html5Clone||!bc.test("<"+a.nodeName)?a.cloneNode(!0):bo(a);if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bk(a,h),d=bl(a),e=bl(h);for(g=0;d[g];++g)e[g]&&bk(d[g],e[g])}if(b){bj(a,h);if(c){d=bl(a),e=bl(h);for(g=0;d[g];++g)bj(d[g],e[g])}}d=e=null;return h},clean:function(a,b,d,e){var g;b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);var h=[],i;for(var j=0,k;(k=a[j])!=null;j++){typeof k=="number"&&(k+="");if(!k)continue;if(typeof k=="string")if(!_.test(k))k=b.createTextNode(k);else{k=k.replace(Y,"<$1>");var l=(Z.exec(k)||["",""])[1].toLowerCase(),m=bg[l]||bg._default,n=m[0],o=b.createElement("div");b===c?bh.appendChild(o):U(b).appendChild(o),o.innerHTML=m[1]+k+m[2];while(n--)o=o.lastChild;if(!f.support.tbody){var p=$.test(k),q=l==="table"&&!p?o.firstChild&&o.firstChild.childNodes:m[1]===""&&!p?o.childNodes:[];for(i=q.length-1;i>=0;--i)f.nodeName(q[i],"tbody")&&!q[i].childNodes.length&&q[i].parentNode.removeChild(q[i])}!f.support.leadingWhitespace&&X.test(k)&&o.insertBefore(b.createTextNode(X.exec(k)[0]),o.firstChild),k=o.childNodes}var r;if(!f.support.appendChecked)if(k[0]&&typeof (r=k.length)=="number")for(i=0;i=0)return b+"px"}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return br.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=f.isNumeric(b)?"alpha(opacity="+b*100+")":"",g=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&f.trim(g.replace(bq,""))===""){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bq.test(g)?g.replace(bq,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){var c;f.swap(a,{display:"inline-block"},function(){b?c=bz(a,"margin-right","marginRight"):c=a.style.marginRight});return c}})}),c.defaultView&&c.defaultView.getComputedStyle&&(bA=function(a,b){var c,d,e;b=b.replace(bs,"-$1").toLowerCase(),(d=a.ownerDocument.defaultView)&&(e=d.getComputedStyle(a,null))&&(c=e.getPropertyValue(b),c===""&&!f.contains(a.ownerDocument.documentElement,a)&&(c=f.style(a,b)));return c}),c.documentElement.currentStyle&&(bB=function(a,b){var c,d,e,f=a.currentStyle&&a.currentStyle[b],g=a.style;f===null&&g&&(e=g[b])&&(f=e),!bt.test(f)&&bu.test(f)&&(c=g.left,d=a.runtimeStyle&&a.runtimeStyle.left,d&&(a.runtimeStyle.left=a.currentStyle.left),g.left=b==="fontSize"?"1em":f||0,f=g.pixelLeft+"px",g.left=c,d&&(a.runtimeStyle.left=d));return f===""?"auto":f}),bz=bA||bB,f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style&&a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)});var bD=/%20/g,bE=/\[\]$/,bF=/\r?\n/g,bG=/#.*$/,bH=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bI=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bJ=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,bK=/^(?:GET|HEAD)$/,bL=/^\/\//,bM=/\?/,bN=/)<[^<]*)*<\/script>/gi,bO=/^(?:select|textarea)/i,bP=/\s+/,bQ=/([?&])_=[^&]*/,bR=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bS=f.fn.load,bT={},bU={},bV,bW,bX=["*/"]+["*"];try{bV=e.href}catch(bY){bV=c.createElement("a"),bV.href="",bV=bV.href}bW=bR.exec(bV.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!="string"&&bS)return bS.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f("
").append(c.replace(bN,"")).find(g):c)),d&&i.each(d,[c,b,a])}});return this},serialize:function(){return f.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bO.test(this.nodeName)||bI.test(this.type))}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bF,"\r\n")}}):{name:b.name,value:c.replace(bF,"\r\n")}}).get()}}),f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.on(b,a)}}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g})}}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script")},getJSON:function(a,b,c){return f.get(a,b,c,"json")},ajaxSetup:function(a,b){b?b_(a,f.ajaxSettings):(b=a,a=f.ajaxSettings),b_(a,b);return a},ajaxSettings:{url:bV,isLocal:bJ.test(bW[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":bX},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:bZ(bT),ajaxTransport:bZ(bU),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a>0?4:0;var o,r,u,w=c,x=l?cb(d,v,l):b,y,z;if(a>=200&&a<300||a===304){if(d.ifModified){if(y=v.getResponseHeader("Last-Modified"))f.lastModified[k]=y;if(z=v.getResponseHeader("Etag"))f.etag[k]=z}if(a===304)w="notmodified",o=!0;else try{r=cc(d,x),w="success",o=!0}catch(A){w="parsererror",u=A}}else{u=w;if(!w||a)w="error",a<0&&(a=0)}v.status=a,v.statusText=""+(c||w),o?h.resolveWith(e,[r,w,v]):h.rejectWith(e,[v,w,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.fireWith(e,[v,w]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f.Callbacks("once memory"),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},getAllResponseHeaders:function(){return s===2?n:null},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bH.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){s||(d.mimeType=a);return this},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.add,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},d.url=((a||d.url)+"").replace(bG,"").replace(bL,bW[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bP),d.crossDomain==null&&(r=bR.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bW[1]&&r[2]==bW[2]&&(r[3]||(r[1]==="http:"?80:443))==(bW[3]||(bW[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),b$(bT,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bK.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bM.test(d.url)?"&":"?")+d.data,delete d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bQ,"$1_="+x);d.url=y+(y===d.url?(bM.test(d.url)?"&":"?")+"_="+x:"")}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", "+bX+"; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=b$(bU,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout")},d.timeout));try{s=1,p.send(l,w)}catch(z){if(s<2)w(-1,z);else throw z}}return v},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value)});else for(var g in a)ca(g,a[g],c,e);return d.join("&").replace(bD,"+")}}),f.extend({active:0,lastModified:{},etag:{}});var cd=f.now(),ce=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+cd++}}),f.ajaxPrefilter("json jsonp",function(b,c,d){var e=b.contentType==="application/x-www-form-urlencoded"&&typeof b.data=="string";if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(ce.test(b.url)||e&&ce.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.jsonp!==!1&&(j=j.replace(ce,l),b.url===j&&(e&&(k=k.replace(ce,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0])}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var cf=a.ActiveXObject?function(){for(var a in ch)ch[a](0,1)}:!1,cg=0,ch;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&ci()||cj()}:ci,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c){if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j])}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,cf&&delete ch[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n),m.text=h.responseText;try{k=h.statusText}catch(o){k=""}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204)}}}catch(p){e||g(-1,p)}m&&g(j,k,m,l)},!c.async||h.readyState===4?d():(i=++cg,cf&&(ch||(ch={},f(a).unload(cf)),ch[i]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var ck={},cl,cm,cn=/^(?:toggle|show|hide)$/,co=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,cp,cq=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],cr;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(cu("show",3),a,b,c);for(var g=0,h=this.length;g=i.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),i.animatedProperties[this.prop]=!0;for(b in i.animatedProperties)i.animatedProperties[b]!==!0&&(g=!1);if(g){i.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(["","X","Y"],function(a,b){h.style["overflow"+b]=i.overflow[a]}),i.hide&&f(h).hide();if(i.hide||i.show)for(b in i.animatedProperties)f.style(h,b,i.orig[b]),f.removeData(h,"fxshow"+b,!0),f.removeData(h,"toggle"+b,!0);d=i.complete,d&&(i.complete=!1,d.call(h))}return!1}i.duration==Infinity?this.now=e:(c=e-this.startTime,this.state=c/i.duration,this.pos=f.easing[i.animatedProperties[this.prop]](this.state,c,0,1,i.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}},f.extend(f.fx,{tick:function(){var a,b=f.timers,c=0;for(;c-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):e.css(k)}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=cx.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,"marginTop"))||0,c.left-=parseFloat(f.css(a,"marginLeft"))||0,d.top+=parseFloat(f.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(f.css(b[0],"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!cx.test(a.nodeName)&&f.css(a,"position")==="static")a=a.offsetParent;return a})}}),f.each(["Left","Top"],function(a,c){var d="scroll"+c;f.fn[d]=function(c){var e,g;if(c===b){e=this[0];if(!e)return null;g=cy(e);return g?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:f.support.boxModel&&g.document.documentElement[d]||g.document.body[d]:e[d]}return this.each(function(){g=cy(this),g?g.scrollTo(a?f(g).scrollLeft():c,a?c:f(g).scrollTop()):this[d]=c})}}),f.each(["Height","Width"],function(a,c){var d=c.toLowerCase();f.fn["inner"+c]=function(){var a=this[0];return a?a.style?parseFloat(f.css(a,d,"padding")):this[d]():null},f.fn["outer"+c]=function(a){var b=this[0];return b?b.style?parseFloat(f.css(b,d,a?"margin":"border")):this[d]():null},f.fn[d]=function(a){var e=this[0];if(!e)return a==null?null:this;if(f.isFunction(a))return this.each(function(b){var c=f(this);c[d](a.call(this,b,c[d]()))});if(f.isWindow(e)){var g=e.document.documentElement["client"+c],h=e.document.body;return e.document.compatMode==="CSS1Compat"&&g||h&&h["client"+c]||g}if(e.nodeType===9)return Math.max(e.documentElement["client"+c],e.body["scroll"+c],e.documentElement["scroll"+c],e.body["offset"+c],e.documentElement["offset"+c]);if(a===b){var i=f.css(e,d),j=parseFloat(i);return f.isNumeric(j)?j:i}return this.css(d,typeof a=="string"?a:a+"px")}}),a.jQuery=a.$=f,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return f})})(window); diff --git a/testcms-final-anon/install/diagnose.php b/testcms-final-anon/install/diagnose.php new file mode 100644 index 0000000..7a7e13c --- /dev/null +++ b/testcms-final-anon/install/diagnose.php @@ -0,0 +1,40 @@ +getMessage(); + } +} + +// output response +header('Content-Type: text/plain'); + +if(empty($errors)) { + //no errors we're all gooood + echo 'good'; +} else { + echo implode(', ', $errors); +} diff --git a/testcms-final-anon/install/index.php b/testcms-final-anon/install/index.php new file mode 100644 index 0000000..4e640d1 --- /dev/null +++ b/testcms-final-anon/install/index.php @@ -0,0 +1,165 @@ + + + + + Install Test CMS CMS + + + + + + + + + + +

Test CMS install logo

+ + Your current environment is running PHP ' . PHP_VERSION . ''; + } + + // PDO + if(class_exists('PDO') === false) { + $compat[] = 'Test CMS requires PDO (PHP Data Objects)
+ You can find more about installing and setting up PHP Data Objects + on the php.net website'; + } else { + if(in_array('mysql', PDO::getAvailableDrivers()) === false) { + $compat[] = 'Test CMS requires the MySQL PDO Driver
+ You can find more about installing and setting up MySQL PDO Driver + on the php.net website'; + } + } + + // can we write a config file? + // note: on win the only way to really test is to try and write a new file to disk. + if(@file_put_contents('../test.php', ' + + + +
+

Woops.

+ +

Test CMS is missing some requirements:

+ +
    + +
  • + +
+ +

Ok, I've fixed these, run the installer.

+
+ + + +
+

Woops.

+ +

Test CMS is already installed. You should really delete this folder!

+ +

Return to the main site.

+
+ + + +

You will need Javascript enabled for this installation. Sorry :(

+ +
+

Welcome to Test CMS.

+ +

If you were looking for a truly lightweight blogging experience, you’ve + found the right place. Simply fill in the details below, and you’ll have your + new blog set up in no time.

+ + If you want a more custom install, feel free to edit config.default.php + (before or after this installation, it doesn't really matter, as long as you rename it to + config.php). + +
+ +
+
+ Your database details + +

+ + +

+

+ + +

+

+ + +

+

+ + +

+ + Check database details +
+ +
+ About your site + +

+ + +

+ +

+ + +

+ +

+ + +

+ +

+ + +

+ +

+ + +

+ +
+ +
+ + +
+ + + + + diff --git a/testcms-final-anon/install/installer.php b/testcms-final-anon/install/installer.php new file mode 100644 index 0000000..cc94b94 --- /dev/null +++ b/testcms-final-anon/install/installer.php @@ -0,0 +1,159 @@ +getMessage(); + } +} + +// create config file +if(empty($errors)) { + $template = file_get_contents('../config.default.php'); + + $base_url = ($path = trim($post['path'], '/')) == '' ? '' : $path . '/'; + $index_page = ($post['clean_urls'] === false ? 'index.php' : ''); + + $search = array( + "'host' => 'localhost'", + "'username' => 'root'", + "'password' => ''", + "'name' => 'testcms'", + + // apllication paths + "'base_url' => '/'", + "'index_page' => 'index.php'", + "'key' => ''" + ); + $replace = array( + "'host' => '" . $post['host'] . "'", + "'username' => '" . $post['user'] . "'", + "'password' => '" . $post['pass'] . "'", + "'name' => '" . $post['db'] . "'", + + // apllication paths + "'base_url' => '/" . $base_url . "'", + "'index_page' => '" . $index_page . "'", + "'key' => '" . random(32) . "'" + ); + $config = str_replace($search, $replace, $template); + + if(file_put_contents('../config.php', $config) === false) { + $errors[] = 'Failed to create config file'; + } + + // if we have clean urls enabled let setup a + // basic htaccess file is there isnt one + if($post['clean_urls']) { + // dont overwrite existing htaccess file + if(file_exists('../.htaccess') === false) { + $htaccess = file_get_contents('../htaccess.txt'); + $htaccess = str_replace('# RewriteBase /', 'RewriteBase /' . $base_url, $htaccess); + + if(file_put_contents('../.htaccess', $htaccess) === false) { + $errors[] = 'Unable to create .htaccess file. Make to create one to enable clean urls.'; + } + } else { + $warnings[] = 'It looks like you already have a htaccess file in place, to use clean URLs please copy and paste our sample htaccess.txt file, remember to update the RewriteBase option if you have installed TestCMS in a subfolder.'; + } + } +} + +// create db +if(empty($errors)) { + // create a unique password for our installation + $password = random(8); + + $sql = str_replace('[[now]]', time(), file_get_contents('test.sql')); + $sql = str_replace('[[password]]', crypt($password), $sql); + $sql = str_replace('[[email]]', strtolower(trim($post['email'])), $sql); + + try { + $dbh->beginTransaction(); + $dbh->exec($sql); + + $sql= "INSERT INTO `meta` (`key`, `value`) VALUES ('sitename', ?), ('description', ?), ('theme', ?);"; + $statement = $dbh->prepare($sql); + $statement->execute(array($post['name'], $post['description'], $post['theme'])); + + $dbh->commit(); + } catch(PDOException $e) { + $errors[] = $e->getMessage(); + + // rollback any changes + if($dbh->inTransaction()) { + $dbh->rollBack(); + } + } +} + +// output response +header('Content-Type: application/json'); + +if(empty($errors)) { + //no errors we're all gooood + $response['installed'] = true; + $response['password'] = $password; + $response['warnings'] = $warnings; +} else { + $response['installed'] = false; + $response['errors'] = $errors; + $response['warnings'] = $warnings; +} + +// output json formatted string +echo json_encode($response); diff --git a/testcms-final-anon/install/test.sql b/testcms-final-anon/install/test.sql new file mode 100644 index 0000000..f307f02 --- /dev/null +++ b/testcms-final-anon/install/test.sql @@ -0,0 +1,94 @@ + +DROP TABLE IF EXISTS `comments`; + +CREATE TABLE IF NOT EXISTS `comments` ( + `id` int(6) NOT NULL AUTO_INCREMENT, + `post` int(6) NOT NULL, + `status` enum('pending','published','spam') NOT NULL, + `date` int(11) NOT NULL, + `name` varchar(140) NOT NULL, + `email` varchar(140) NOT NULL, + `text` text NOT NULL, + PRIMARY KEY (`id`), + KEY `post` (`post`), + KEY `status` (`status`) +) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci; + +DROP TABLE IF EXISTS `meta`; + +CREATE TABLE `meta` ( + `key` varchar(140) NOT NULL, + `value` text NOT NULL, + PRIMARY KEY (`key`) +) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci; + +INSERT INTO `meta` (`key`, `value`) VALUES ('posts_page', '1'), ('home_page', '1'), ('twitter', ''), ('date_format', 'jS M, Y'), ('auto_published_comments', '1'), ('posts_per_page', '10'); + +DROP TABLE IF EXISTS `pages`; + +CREATE TABLE `pages` ( + `id` int(6) NOT NULL AUTO_INCREMENT, + `slug` varchar(150) NOT NULL, + `name` varchar(64) NOT NULL, + `title` varchar(150) NOT NULL, + `content` text NOT NULL, + `status` enum('draft','published','archived') NOT NULL, + PRIMARY KEY (`id`), + KEY `status` (`status`), + KEY `slug` (`slug`) +) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci; + +INSERT INTO `pages` (`slug`, `name`, `title`, `content`, `status`) VALUES +('posts', 'Posts', 'My posts and thoughts', '

Welcome!

', 'published'), +('about', 'About', 'A little bit about me', '

This is a little bit of text about me.

', 'published'); + +DROP TABLE IF EXISTS `posts`; + +CREATE TABLE `posts` ( + `id` int(6) NOT NULL AUTO_INCREMENT, + `title` varchar(150) NOT NULL, + `slug` varchar(150) NOT NULL, + `description` text NOT NULL, + `html` text NOT NULL, + `css` text NOT NULL, + `js` text NOT NULL, + `custom_fields` text, + `created` int(11) NOT NULL, + `author` int(6) NOT NULL, + `status` enum('draft','published','archived') NOT NULL, + `comments` TINYINT( 1 ) NOT NULL, + PRIMARY KEY (`id`), + KEY `status` (`status`), + KEY `slug` (`slug`) +) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci; + +INSERT INTO `posts` (`title`, `slug`, `description`, `html`, `css`, `js`, `created`, `author`, `status`, `comments`) VALUES +('Hello World', 'hello', 'Hello World.', '

My first post.

', '', '', '[[now]]', 1, 'published', 1); + +DROP TABLE IF EXISTS `users`; + +CREATE TABLE `users` ( + `id` int(6) NOT NULL AUTO_INCREMENT, + `username` varchar(100) NOT NULL, + `password` varchar(140) NOT NULL, + `email` varchar(140) NOT NULL, + `real_name` varchar(140) NOT NULL, + `bio` text NOT NULL, + `status` enum('inactive','active') NOT NULL, + `role` enum('administrator','editor','user') NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci; + +INSERT INTO `users` (`username`, `password`, `email`, `real_name`, `bio`, `status`, `role`) VALUES +('admin', '[[password]]', '[[email]]', 'Administrator', 'Default account for TestCMS +.', 'active', 'administrator'); + +DROP TABLE IF EXISTS `sessions`; + +CREATE TABLE IF NOT EXISTS `sessions` ( + `id` CHAR( 32 ) NOT NULL , + `date` DATETIME NOT NULL , + `ip` VARCHAR( 15 ) NOT NULL , + `ua` TEXT NOT NULL , + `data` TEXT NOT NULL +) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci; diff --git a/testcms-final-anon/system/admin/controllers/comments.php b/testcms-final-anon/system/admin/controllers/comments.php new file mode 100644 index 0000000..2d4da93 --- /dev/null +++ b/testcms-final-anon/system/admin/controllers/comments.php @@ -0,0 +1,32 @@ +admin_url = Config::get('application.admin_folder'); + } + + public function index() { + if(Input::method() == 'POST') { + if(Metadata::update()) { + return Response::redirect($this->admin_url . '/metadata'); + } + } + + // provide a list to set for our home page and posts page + $pages = Pages::list_all(array('status' => 'published')); + + // list valid themes + $themes = Themes::list_all(); + + Template::render('metadata/index', array( + 'pages' => $pages, + 'themes' => $themes, + 'metadata' => (object) Config::get('metadata') + )); + } + +} diff --git a/testcms-final-anon/system/admin/controllers/pages.php b/testcms-final-anon/system/admin/controllers/pages.php new file mode 100644 index 0000000..15a65ca --- /dev/null +++ b/testcms-final-anon/system/admin/controllers/pages.php @@ -0,0 +1,40 @@ +admin_url = Config::get('application.admin_folder'); + } + + public function index() { + $pages = Pages::list_all(); + Template::render('pages/index', array('pages' => $pages)); + } + + public function add() { + if(Input::method() == 'POST') { + if(Pages::add()) { + return Response::redirect($this->admin_url . '/pages/edit/' . Db::insert_id()); + } + } + Template::render('pages/add'); + } + + public function edit($id) { + // find page + if(($page = Pages::find(array('id' => $id))) === false) { + return Response::redirect($this->admin_url . '/pages'); + } + + // process post request + if(Input::method() == 'POST') { + if(Pages::update($id)) { + // redirect path + return Response::redirect($this->admin_url . '/pages/edit/' . $id); + } + } + + Template::render('pages/edit', array('page' => $page)); + } + +} diff --git a/testcms-final-anon/system/admin/controllers/posts.php b/testcms-final-anon/system/admin/controllers/posts.php new file mode 100644 index 0000000..3e173e3 --- /dev/null +++ b/testcms-final-anon/system/admin/controllers/posts.php @@ -0,0 +1,56 @@ +admin_url = Config::get('application.admin_folder'); + } + + public function index() { + $data['posts'] = Posts::list_all(array('sortby' => 'id', 'sortmode' => 'desc')); + Template::render('posts/index', $data); + } + + public function add() { + if(Input::method() == 'POST') { + if(Posts::add()) { + return Response::redirect($this->admin_url . '/posts/edit/' . Db::insert_id()); + } + } + + Template::render('posts/add'); + } + + public function edit($id) { + // find article + if(($article = Posts::find(array('id' => $id))) === false) { + return Response::redirect($this->admin_url . '/posts'); + } + + // process post request + if(Input::method() == 'POST') { + if(Posts::update($id)) { + // redirect path + return Response::redirect($this->admin_url . '/posts/edit/' . $id); + } + } + + // get comments + $comments = Comments::list_all(array('post' => $id)); + $pending = array(); + + foreach($comments as $comment) { + if($comment->status == 'pending') { + $pending[] = $comment->id; + } + } + + $pending = count($pending); + + // get posts page + $page = Pages::find(array('id' => Config::get('metadata.posts_page'))); + + Template::render('posts/edit', array('article' => $article, 'comments' => $comments, 'page' => $page, 'pending' => $pending)); + } + +} diff --git a/testcms-final-anon/system/admin/controllers/users.php b/testcms-final-anon/system/admin/controllers/users.php new file mode 100644 index 0000000..c43db55 --- /dev/null +++ b/testcms-final-anon/system/admin/controllers/users.php @@ -0,0 +1,79 @@ +admin_url = Config::get('application.admin_folder'); + } + + public function index() { + $users = Users::list_all(); + Template::render('users/index', array('users' => $users)); + } + + public function login() { + if(Input::method() == 'POST') { + if(Users::login()) { + return Response::redirect($this->admin_url . '/posts'); + } + } + Template::render('users/login'); + } + + public function logout() { + Users::logout(); + return Response::redirect($this->admin_url . '/login'); + } + + public function amnesia() { + if(Input::method() == 'POST') { + if(Users::recover_password()) { + return Response::redirect($this->admin_url . '/users/login'); + } + } + Template::render('users/amnesia'); + } + + public function reset($hash) { + // find user + if(($user = Users::find(array('hash' => $hash))) === false) { + Notifications::set('error', 'User not found'); + return Response::redirect($this->admin_url . '/users'); + } + + if(Input::method() == 'POST') { + if(Users::reset_password($user->id)) { + return Response::redirect($this->admin_url); + } + } + + Template::render('users/reset', array('user' => $user)); + } + + public function add() { + if(Input::method() == 'POST') { + if(Users::add()) { + return Response::redirect($this->admin_url . '/users/edit/' . Db::insert_id()); + } + } + Template::render('users/add'); + } + + public function edit($id) { + // find user + if(($user = Users::find(array('id' => $id))) === false) { + return Response::redirect($this->admin_url . '/users'); + } + + // process post request + if(Input::method() == 'POST') { + if(Users::update($id)) { + // redirect path + return Response::redirect($this->admin_url . '/users/edit/' . $id); + } + } + + Template::render('users/edit', array('user' => $user)); + } + +} diff --git a/testcms-final-anon/system/admin/theme/assets/css/admin.css b/testcms-final-anon/system/admin/theme/assets/css/admin.css new file mode 100644 index 0000000..f7a9fc0 --- /dev/null +++ b/testcms-final-anon/system/admin/theme/assets/css/admin.css @@ -0,0 +1,585 @@ +* { + margin: 0; + padding: 0; + + list-style: none; +} + +::selection { + color: #fff; + background: rgba(57,115,169,.7); + + text-shadow: 0 1px 1px rgba(0,0,0,.3); +} + ::-webkit-selection { + background: rgba(57,115,169,.7); + color: #fff; + + text-shadow: 0 1px 1px rgba(0,0,0,.3); + } + ::-moz-selection { + background: rgba(57,115,169,.7); + color: #fff; + + text-shadow: 0 1px 1px rgba(0,0,0,.3); + } + +body { + background: #e7f0f9 url('../img/bg.gif') repeat-x 0 0; + + font: 13px/22px "Helvetica Neue", sans-serif; + color: #75818c; + + width: 900px; + margin: 0 auto; +} + +a { + -webkit-transition: color .25s; + -moz-transition: color .25s; + -ms-transition: color .25s; + -o-transition: color .25s; + transition: color .25s; +} + +i, em { + font-family: Georgia, serif; +} + +header#top { + height: 61px; + line-height: 61px; +} + header#top a#logo { + display: block; + float: left; + + margin: 20px 0 0; + height: 24px; + } + header#top a#logo img { + display: block; + } + header#top a#logo:hover { + opacity: .8; + } + header#top nav { + float: left; + padding-left: 20px; + } + header#top nav li { + display: inline-block; + float: left; + } + header#top nav li a { + color: #909eab; + + font-weight: bold; + text-decoration: none; + + display: block; + padding: 0 20px; + + text-shadow: 0 1px 0 rgba(0,0,0,.3); + } + header#top nav li a:hover { + color: #b7cbdf; + } + header#top nav li.active a { + color: #fff; + + background: url('../img/active.png') no-repeat 50% 0; + } + header#top p { + color: #91969c; + float: right; + } + header#top p a { + color: #d7dfe7; + padding-left: 15px; + } + header#top p a:hover { + color: #fff; + } + +h1 { + height: 86px; + line-height: 86px; + + font-weight: lighter; + color: #304355; + text-shadow: 0 1px 0 rgba(255,255,255,.25); + + position: relative; +} + h1 a, button { + background-color: #4375a7; + background-image: -webkit-gradient(linear, left top, left bottom, from(#5e92be), to(#285890)); + background-image: -webkit-linear-gradient(top, #5e92be, #285890); + background-image: -moz-linear-gradient(top, #5e92be, #285890); + background-image: -o-linear-gradient(top, #5e92be, #285890); + background-image: -ms-linear-gradient(top, #5e92be, #285890); + background-image: linear-gradient(top, #5e92be, #285890); + filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0,StartColorStr='#5e92be', EndColorStr='#285890'); + + border: 1px solid #164773; + + border-radius: 4px; + + -webkit-box-shadow: inset 0 1px 0 rgba(255,255,255,.25),0 1px 1px rgba(0,0,0,.05), inset 0 -1px 1px rgba(0,0,0,.1); + -moz-box-shadow: inset 0 1px 0 rgba(255,255,255,.25),0 1px 1px rgba(0,0,0,.05), inset 0 -1px 1px rgba(0,0,0,.1); + box-shadow: inset 0 1px 0 rgba(255,255,255,.25),0 1px 1px rgba(0,0,0,.05), inset 0 -1px 1px rgba(0,0,0,.1); + + font: bold 13px "Helvetica Neue", sans-serif; + color: #fff; + text-shadow: 0 1px 1px rgba(0,0,0,.3); + text-decoration: none; + + float: right; + padding: 8px 14px; + margin-top: 28px; + + cursor: pointer; + } + h1 a:active, button:active, section.content nav.tabs ul li a.active { + -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.3), inset 0 -1px 1px rgba(0,0,0,.2),0 1px 1px rgba(0,0,0,.1); + -moz-box-shadow: inset 0 1px 1px rgba(0,0,0,.3), inset 0 -1px 1px rgba(0,0,0,.2),0 1px 1px rgba(0,0,0,.1); + box-shadow: inset 0 1px 1px rgba(0,0,0,.3), inset 0 -1px 1px rgba(0,0,0,.2),0 1px 1px rgba(0,0,0,.1); + + background-color: #2d5d8a; + background-image: -webkit-gradient(linear, left top, left bottom, from(#386c98), to(#224f7d)); + background-image: -webkit-linear-gradient(top, #386c98, #224f7d); + background-image: -moz-linear-gradient(top, #386c98, #224f7d); + background-image: -o-linear-gradient(top, #386c98, #224f7d); + background-image: -ms-linear-gradient(top, #386c98, #224f7d); + background-image: linear-gradient(top, #386c98, #224f7d); + filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0,StartColorStr='#386c98', EndColorStr='#224f7d'); + + border: 1px solid #0d3355; + } + button[name=delete] { + border-color: #681a1c; + + background-color: #b04e51; + background-image: -webkit-gradient(linear, left top, left bottom, from(#c86a6d), to(#983336)); + background-image: -webkit-linear-gradient(top, #c86a6d, #983336); + background-image: -moz-linear-gradient(top, #c86a6d, #983336); + background-image: -o-linear-gradient(top, #c86a6d, #983336); + background-image: -ms-linear-gradient(top, #c86a6d, #983336); + background-image: linear-gradient(top, #c86a6d, #983336); + filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0,StartColorStr='#c86a6d', EndColorStr='#983336'); + } + button[name=delete]:active { + border-color: #501314; + + background-color: #802d30; + background-image: -webkit-gradient(linear, left top, left bottom, from(#984447), to(#69171a)); + background-image: -webkit-linear-gradient(top, #984447, #69171a); + background-image: -moz-linear-gradient(top, #984447, #69171a); + background-image: -o-linear-gradient(top, #984447, #69171a); + background-image: -ms-linear-gradient(top, #984447, #69171a); + background-image: linear-gradient(top, #984447, #69171a); + filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0,StartColorStr='#984447', EndColorStr='#69171a'); + } + +button#create { + float: left; + margin-bottom: 30px; + margin-left: 120px; +} + +section.content { + background: #fff; + + -webkit-border-radius: 5px; + -moz-border-radius: 5px; + border-radius: 5px; + + -webkit-box-shadow: inset 0 -1px 1px #f5f5f5,0 1px 1px rgba(0,0,0,.1); + -moz-box-shadow: inset 0 -1px 1px #f5f5f5,0 1px 1px rgba(0,0,0,.1); + box-shadow: inset 0 -1px 1px #f5f5f5,0 1px 1px rgba(0,0,0,.1); + + margin: 40px 0; + padding: 30px 40px; + + width: 550px; + float: left; +} + + section.content nav.tabs { + margin-bottom: 2em; + } + section.content nav.tabs ul { + margin: 0; + padding: 0 0 1em 0; + border-bottom: 1px solid #ebf0f3; + } + section.content nav.tabs ul li { + display: inline-block; + margin-right: 15px; + } + section.content nav.tabs ul li a { + display: inline-block; + padding: 5px 12px; + + position: relative; + text-decoration: none; + font-weight: bold; + + background: #f2f4f5; + + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + border-radius: 4px; + + -webkit-box-shadow: inset 0 -1px 1px rgba(0,0,0,.05); + -moz-box-shadow: inset 0 -1px 1px rgba(0,0,0,.05); + box-shadow: inset 0 -1px 1px rgba(0,0,0,.05); + } + section.content nav.tabs ul li a.active { + color: #fff; + } + section.content nav.tabs ul li span { + display: inline-block; + position: relative; + top: -10px; + + margin-right: -24px; + + padding: 6px; + min-width: 10px; + height: 10px; + + font-weight: bold; + font-size: 10px; + line-height: 10px; + + color: #fff; + + text-align: center; + text-shadow: 0 1px 1px rgba(0,0,0,.4); + text-decoration: none; + + background-color: #b63538; + background-image: -webkit-gradient(linear, left top, left bottom, from(#ca4d4f), to(#a31d21)); + background-image: -webkit-linear-gradient(top, #ca4d4f, #a31d21); + background-image: -moz-linear-gradient(top, #ca4d4f, #a31d21); + background-image: -o-linear-gradient(top, #ca4d4f, #a31d21); + background-image: -ms-linear-gradient(top, #ca4d4f, #a31d21); + background-image: linear-gradient(top, #ca4d4f, #a31d21); + filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0,StartColorStr='#ca4d4f', EndColorStr='#a31d21'); + + -webkit-border-radius: 20px; + -moz-border-radius: 20px; + border-radius: 20px; + + border: 1px solid #730707; + + box-shadow: inset 0 1px 0 rgba(255,255,255,.25), 0 1px 1px rgba(0,0,0,.05); + } + + section.content a, .popup_wrapper a { + color: #527ba5; + } + section.content a:hover, .popup_wrapper a:hover { + color: #3b444d; + } + + section.content ul.list { + list-style: none; + } + section.content ul.list li { + position: relative; + border-bottom: 1px solid #f5f7f8; + } + section.content ul.list li:last-child { + border-bottom: none; + } + section.content ul.list a { + display: block; + + padding: 15px 0; + + text-decoration: none; + } + section.content ul.list strong { + display: block; + padding-bottom: 3px; + + font-size: 20px; + } + section.content ul.list span { + display: block; + opacity: .6; + } + section.content ul.list i { + position: absolute; + right: 0; + top: 18px; + } + +p.notification { + position: relative; + + margin: 20px 0 -20px; + padding: 10px 20px; + + color: #fff; + text-shadow: 0 1px 0 rgba(0,0,0,.3); + + -webkit-box-shadow: inset 0 2px 1px rgba(0,0,0,.15), inset 0 1px 1px rgba(0,0,0,.05),0 1px 1px rgba(0,0,0,.05); + -moz-box-shadow: inset 0 2px 1px rgba(0,0,0,.15), inset 0 1px 1px rgba(0,0,0,.05),0 1px 1px rgba(0,0,0,.05); + box-shadow: inset 0 2px 1px rgba(0,0,0,.15), inset 0 1px 1px rgba(0,0,0,.05),0 1px 1px rgba(0,0,0,.05); + + -webkit-border-radius: 5px; + -moz-border-radius: 5px; + border-radius: 5px; + + background-image: -webkit-gradient(linear, left top, left bottom, from(rgba(0,0,0,.15)), to(transparent)); + background-image: -webkit-linear-gradient(top, rgba(0,0,0,.15), transparent); + background-image: -moz-linear-gradient(top, rgba(0,0,0,.15), transparent); + background-image: -o-linear-gradient(top, rgba(0,0,0,.15), transparent); + background-image: -ms-linear-gradient(top, rgba(0,0,0,.15), transparent); + background-image: linear-gradient(top, rgba(0,0,0,.15), transparent); +} + p.notification.error { + background-color: #911; + } + p.notification.success { + background-color: #757e0e; + } + p.notification.notice { + background-color: #FFC800; + } + +fieldset { + position: relative; + border: none; +} + fieldset + fieldset { + margin-top: 40px; + } + legend { + font-size: 18px; + font-weight: bold; + + color: #284769; + + padding-left: 120px; + } + legend + em { + display: block; + padding: 5px 0 25px 120px; + } + + fieldset p { + padding-bottom: 20px; + clear: both; + overflow: hidden; + } + fieldset p em { + display: block; + clear: both; + + padding-top: 5px; + padding-left: 120px; + } + + fieldset label { + display: block; + float: left; + + width: 100px; + text-align: right; + + padding: 6px 0; + padding-right: 20px; + + cursor: pointer; + + font-weight: bold; + color: #5e6c7b; + } + fieldset input, fieldset textarea { + display: block; + float: left; + + width: 404px; + padding: 8px 12px; + + border: 1px solid #a8acb1; + + -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.1), 0 1px 1px #f5f7f8; + -moz-box-shadow: inset 0 1px 1px #ebeef1, 0 1px 1px #f5f7f8; + box-shadow: inset 0 1px 1px rgba(0,0,0,.1), 0 1px 1px #f5f7f8; + + font: 13px "Helvetica Neue", sans-serif; + color: #50575d; + } + fieldset .key { + width: 128px; + margin-right: -1px; + + margin-bottom: 10px; + } + fieldset .value { + width: 250px; + margin-bottom: 10px; + } + fieldset textarea, input[type=url] { + font: 13px/16px "Anonymous Pro", monospace; + } + fieldset textarea { + line-height: 24px; + + resize: vertical; + min-height: 150px; + max-height: 500px; + } + fieldset input:focus, fieldset textarea:focus { + background: #f3f7fc; + outline: none; + } + fieldset select { + margin-top: 9px; + min-width: 150px; + } + fieldset select + em { + position: relative; + top: -8px; + + margin-bottom: -8px; + } + + +p.buttons { + overflow: hidden; + padding-top: 20px; + + border-top: 1px solid #f5f7f8; +} + p.buttons a { + float: left; + line-height: 34px; + } + p.buttons button { + margin-top: 0; + margin-left: 25px; + } + +aside#sidebar { + float: right; + width: 200px; + + margin-top: 40px; + padding: 20px; + + background: #d6e3f0; + color: #667a8e; + + text-shadow: 0 1px 0 rgba(255,255,255,.3); + + -webkit-border-radius: 5px; + -moz-border-radius: 5px; + border-radius: 5px; + + -webkit-box-shadow: inset 0 -1px 1px rgba(0,0,0,.02), 0 1px 0 #eff6fc; + -moz-box-shadow: inset 0 -1px 1px rgba(0,0,0,.02), 0 1px 0 #eff6fc; + box-shadow: inset 0 -1px 1px rgba(0,0,0,.02), 0 1px 0 #eff6fc; +} + aside#sidebar h2 { + color: #384f66; + padding-bottom: 8px; + } + aside#sidebar ul { + margin: 15px 18px -5px; + } + aside#sidebar li { + list-style: square; + padding-bottom: 5px; + + font-size: 12px; + line-height: 20px; + } + aside#sidebar a { + color: #244f7c; + } + aside#sidebar a:hover { + color: #102e4d; + } + +ul#comments { + position: relative; + overflow: hidden; +} + ul#comments li { + border-top: 1px solid #f2f4f5; + padding: 20px 0; + + overflow: hidden; + } + ul#comments li header { + width: 100px; + float: left; + } + ul#comments li header strong { + color: #506171; + display: block; + } + ul#comments li header em { + padding: 10px 0 0; + + font-size: 12px; + } + ul#comments li p.comment { + width: 430px; + + float: left; + clear: none; + + padding-left: 20px; + padding-bottom: 20px; + } + ul#comments li ul { + position: relative; + left: 20px; + } + ul#comments li li { + border: none; + overflow: auto; + float: left; + + padding: 0 15px 0 0; + } + +footer#bottom { + clear: both; + padding: 20px 0 60px; + margin-top: 20px; + + border-top: 1px solid #dde7f0; + + text-shadow: 0 1px 0 #f7fbff; +} + footer#bottom a { + color: #474e56; + } + footer#bottom a:hover { + color: #2d353d; + } + footer#bottom small { + float: left; + font-size: 13px; + } + + footer#bottom em { + float: right; + font-size: 11px; + + color: #93a8bd; + } + +.debug {display: none; font-size: 13px; margin-bottom: 1em;} +.debug td, .debug th {padding: 4px 6px; border-bottom: 1px solid #ddd;} +.debug th {font-weight: bold; text-align: center;} +.debug tfoot td:first-child {text-align: right;} \ No newline at end of file diff --git a/testcms-final-anon/system/admin/theme/assets/css/popup.css b/testcms-final-anon/system/admin/theme/assets/css/popup.css new file mode 100644 index 0000000..8d7395b --- /dev/null +++ b/testcms-final-anon/system/admin/theme/assets/css/popup.css @@ -0,0 +1,32 @@ + +.popup_overlay { + background: #173553; + + position: fixed; + top: 0; + left: 0; + bottom: 0; + right: 0; + z-index: 1000; + + opacity: .6; + filter: alpha(opacity=60); +} + +.popup_box { + background: #fff; + position: absolute; + z-index: 1001; + + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + border-radius: 3px; + + -webkit-box-shadow: 0 1px 2px rgba(0,0,0,.3); + -moz-box-shadow: 0 1px 2px rgba(0,0,0,.3); + box-shadow: 0 1px 2px rgba(0,0,0,.3); +} + +.popup_wrapper { + padding: 20px; +} \ No newline at end of file diff --git a/testcms-final-anon/system/admin/theme/assets/img/active.png b/testcms-final-anon/system/admin/theme/assets/img/active.png new file mode 100644 index 0000000000000000000000000000000000000000..62977a2c797b26c7acd65033a45b30369f57a81c GIT binary patch literal 1899 zcmaJ?X;c$e7)=pDQ8}O>6%@ump#_tfB#@AlfC&MKWCTN0RH%l@AOVtz$v`4XD~f`E z3L=|TKwPPSO63U1qEt|V;#LuC71txyx_|-#E}f`of0WKSGw*%x+2m=ISVk8r<*#r~fd!;&~fEZ@rexY~>7Kv-6YLvv2VG$@GR7h8$VpJ+y zv$_@aB9X?C<&sc56c%w1OhJ_zFjSpFMX*UEFCU#sio~Ee5P`0eE4k$7ry9wCT*f6Y z@qi&%<%>qi0}|9|NWuaMk`RNiWn>?3z)Qy=1QaMP1$2s7rG}&9l0WEjh`C`IBm*BH zcnp{Pv8Yfu81Ti^DBwYbCSVddNgJ zwJee&7WjY4MMPY36ppJnAgI-9saggVQ?CMPY&P4VL8ns)1Vyt(iA!}9rN(hoL4axy zwOobEF(qJ7lty52IG0RR`f&>i)n{3y=2M%9hJiY%3ZzjX!gNxBG z_5P=@MzThQf?`yI#iURphuSo_ZX(1ZA%27jgKk`x2p+TH=nh7K-`vYp@1jR-3*h!QDKX$-nG{Z*5?(p zibM>#A_5+t!=HOhk_PxC7jLLm@BMZHb^iEX8-W>B(7Y*qv5m5_!p=I(c=htKTav&l z(II@8AG2fI;}d&|E{xO++F$y)lzjW{g;R`2e`*?DCO-1!yxVx0-#@wi>DL2Y+~0d1 zc4UP{Oylv%cZ@TV{aj;%OPvocJ}T&Uy0>d~T9<|IdJ89AmX{m<{Q&TMf5EHzyd;Y$ z7EX=8G3~BaBjc+ZYX^DjRoZaA6UF%Z?C2Q;%DWx>EGA5ivmJ}vX@;}yvY1z`WmtQ0lmibSY?gr zMc#aBR8dE^^8;uD!{}^+#NB41)%wG2N9GCVS_16r&lrB~47>*428xY-f^%+vd+2JM*|8jPU&(cAaLE)W&3sZxtBnl3bd2 zt*`H{{CIa`QOS_h!Sq~oer9cTiFKc+QCDTSYt;?wI?CRpzGBHEztp-EA^R}hw*{YU zC1ShGt|qzWcRu!MU;7pggMMW&`us{xydrW_!q> z{~p^M=j)ddm)!F0TXk2wZm(~id*0Z%W43*?{Zi^g-d)MMX2wjT%mLu5LW$+R%$!Nt zruF6xhc3p)Gn)$8=MQ?N1{Ham$P>SF1Zv~C1D<=l63oKD9%oKZMzi~~C;D|QFLL?& zH}>dTB(k7{QoL-D=%+(@Vu$Db%1vRNq3AhNq&&ESm$f8u2L#Qki8*mUAH?3fAKZ;DTAIhY)P7!nn_aUbJZJfhj{V2Grksqg7%7XM#p-KXSop_oO$ z#M7?R9j*>Q^j8}$ino+pux*dceb{cbsl#p9`hIP_Pa=X?EL)x@<0{&Q-j2K&xWTvw zR_J~DDeuB*H?vQhrt4oG4SaQB%f8AdePDj7eeSXY+n=dZhF=cuW9I<38s@jgCzm<6 zJsGaO5@c;&wRw2gEXkorGzOW4{40XnAXu%WQkpDvkm73D%Y3KNV{*A zQd9UF{#*$+W|*2gG_76xzA0#W_ literal 0 HcmV?d00001 diff --git a/testcms-final-anon/system/admin/theme/assets/img/bg.gif b/testcms-final-anon/system/admin/theme/assets/img/bg.gif new file mode 100644 index 0000000000000000000000000000000000000000..a213440e161d02bc2546e19ba311cff2bda8fdd5 GIT binary patch literal 1676 zcmcIkX;c$e6b|l+8}8Mr!{9E-%w(I)kZm%PK!89K|u+N$|hDo2vBXcw$)nO+6fxlp5yUH&*}Ry^X_}!cfWhzyZ6N#4GN5o z5Nr|z1%gBE1G@rUb?yCiZT_U>sub+9$KyP;biN9;XvN^3~Q)YO5NzRJdKr7l5= zscku{;#)6=}}Mli?aEu1Pd!ph}$~*`lEm z^+{>Q)bx(vd6PA}qP|O)kWx{9Qi^G+n|dr+`KXdO)ZSm!)NRdPiKxf&u59Q| zwqzxw*izGTab7zubNlYv+O}YAYtWjNzja@`EKZwZ%TcIF6=_sc#`K(3X_+fFZ?E5b zq?a_N208~N3U&SQfx{gG4V{C6|9?bZiOe#Y0gC2m{;$;dJ+!@u;eY~Wjnl0H&+e=Q z0jEO+X39*k$wM-Q&V+I=V=Ygy*~^RUm;=AGXLPc)Q}$j-VTKkb1K5e&Ipp}dCBKF-4Y z9mWmOK3kcGfh>%VE%DkJ9v%}W^JjN+p%9Rd22b@m`AeaTDb`-%V%(gOQi1%A$l-M0 zFrt7F1eL<57?vv#L`Uglgcz0*C?S>W2}9V&jkr>o0+lNaQi+_R5JZn)3Ijsv2nvHG zFp5gWVXo2b<7l^?3F|s}-D_OQO}RMfWoVA|+E}(YTmj}nmScT|tOp>iGQdRJo$inw zx}K}qQjFKRmT?%otP2=AU)*^EeOU7EycG&kj!6hH0iy~^kMgl!!r^d*PDlN^Bv>mTO;DipMU&*`L|2IUcB(j&p)02@!Z)TzCUyNyTO6} zU|;X4p6;%b-=63^-qGIH+H&mZk>;kxhCuz{Lv^(W57g}6w|7r{;wI&8%bhf3 zj4m>2;?n4GNsAWeSMSNs*`G6OR$g7*k`;k~ph+|A=Wn zun=qwy`O(OM8vK$KWK@Vy+VY0d)LwRp~2BRrKQ#$WAmK6^sSfJ(w8^1RGwIwcdnFX zzx{ICD*x(6bGAQ>4mX+kJ!}+t*^;Vnemk(mGq_!Am8VDbizEDsYHwLXAMP$oQV%{7 z^Yzzh%lnqkt)Iu;cCn4m+&W7#v}4-pb#u?FOr5-3Y|1>}u1lM*cr#yF{nAf&;_0(O zdIv?npL_jKwu|HR+llY~`F&H~U)6o*VyBY-fjm*!TFDH{>~~jtd^13c=4<1>lr7M zEv}cQ3vFH^-ta!`$Cew(FD9-y5uEuT@xei_+Ep{-XBCD$Yq@)RbJWZ;Ov?Q!`gg=639rprmb!54gW@ zaZ&aY(@na%(#v{Dz&xWVNA|jz*{B+wXlXrsI?+(c|B_J7-Ac>;$H!ZGHi_@mT@<*~ z`uO^S{U<~L@);qX3ab&!vht0>n>RO@oB#@Ek#{7XZ` zto#B#{c)((=mSa7L;5CA;O>+4gVvY)-N5 z{&DW@zU=IhKZT!r?{?=NH`|bRY}=t9H`Z^|{gWHSWSvmeHErRk4`qiqE0kqzV;C>1 z^1jZ05P9KN(5;P&m%jShctKh1p#2HEGnaNgys+xuqJJy%R>ZFmzjEI?t3}d!nM$oz zt@dAyTJ>7}zdl_hk-L=ss>Dv+H&Kt(a`*ea^HpzDua8d@zS|X>aW#9ssd}*Asp==< zPpACZ^JkNd^ahcg@p6-wKiT`?4d=JBJbz{PN|bPI&hp(_t^1Kh!h~OyZ7$pOViAiFE5Lk^K@EQh1I++b&t;X-Tp_8KQd<8K5x&DxF2d8mN9?* zH(A)g%IZO`j*sdI<41F?3d3B#aFxuya5lD%?LOZk&(&qu%ub1h-(0_Hy(VYPsU1eK zSKZr1&zgvyf2v_tzGLs9?!_wmnw9!qINtlc&$a9>Pwu;Dm-hdMtY3#^M6VF8eJk*F zztpX^4}LYzj2CsYf8DkB(euR~PuL~~TWz@iTlS^*qq`;BFIF^s4?VB$Vl8hj^?#kY zly$t)f3b_HpY0uUJ1zwU1)HLjG^-#NH>h?X&sHg;q@=(~U%$M(T(8_%FTW^V-_X+1 zQs2Nx-^fT8s6w~6GOr}DLN~8i8Da>`9GBGMtKo*2* zu+awvB2u7&V+<4;XySwdJGCMcM__|wFasMTY88-Kk(v|Xl9`*D2M#(TU{GL{K=K|~ z-Z?)fzbLpMF*y|!8t6jks=?MoB3WaCYz>kGwF4z38J^M$N{e#9={zM_KQ$*6=;M-N zV5k_PCc%_stK!n6tkmQZSUf<|G&nY#64UjOgl+UORZ}fGfjJ)Tbd;=9kywBknLyQ6 zzWFJcX_YRCC8>5s28Kqu24=cOh9QQgRt9EP#^yHqXljt+2qfcNl$uzQUlfv`pJNA( zu3QjT!AQ?Q5160ORp5;$NEiUi8#^wbPFUGx$F;b%*#%gfHF~-@hIsJ4oqCb;fC7)p z>`Rd`hc6zvIOokPQJb8D{2TwN+IPCmFJd{zAY=VV$>jMTaaql!lh3f9Q95>Fi^x)u zY=*|$$FleoLrNQ;-(J1peeLRvtY_L~bauvaO?Tp2@nL0w=8}f4X9_QJUGJV;WS;g~ pe9KhNYaf1O_q_}~JXx5xDDOe0vd`S(_Dev8tEa1<%Q~loCIIlu-kJaa literal 0 HcmV?d00001 diff --git a/testcms-final-anon/system/admin/theme/assets/js/comments.js b/testcms-final-anon/system/admin/theme/assets/js/comments.js new file mode 100644 index 0000000..092b3e3 --- /dev/null +++ b/testcms-final-anon/system/admin/theme/assets/js/comments.js @@ -0,0 +1,146 @@ +(function(base_url) { + + var p = new Popup(); + + var publish = function() { + var a = this, li = a.getParent(); + var url = base_url + 'comments/status'; + var id = a.getParent('li[data-id]').get('data-id'); + + new Request.JSON({ + 'url': url, + 'method': 'post', + 'data': {'id': id, 'status': 'published'}, + 'onRequest': function() { + li.setStyle('opacity', 0.5); + a.removeEvent('click', publish); + }, + 'onSuccess': function() { + li.dispose(); + $$('[data-status=' + id + ']').set('html', 'Published'); + } + }).send(); + + return false; + }; + + var edit = function() { + var a = this; + var url = base_url + 'comments/update'; + var id = a.getParent('li[data-id]').get('data-id'); + var text = $$('[data-text=' + id + ']').get('html'); + var status = $$('[data-status=' + id + ']').get('html'); + + var html = '
Edit CommentUpdate the comment text here.'; + html +='

'; + html +='

'; + html += '
'; + html +='

Close

'; + + var content = new Element('div', { + 'class': 'popup_wrapper', + 'html': html + }); + + p.open({ + 'content': content + }); + + // bind functions + $$('button[name=update]').addEvent('click', function() { + update(id); + }); + $$('a[href$=#close]').addEvent('click', function() { + p.close(); + return false; + }); + + return false; + }; + + var update = function(id) { + var url = base_url + 'comments/update', + comment_text_input = $$('textarea[name=comment_text]').pop(), + comment_status_input = $$('select[name=comment_status]').pop(); + + // get values + var text = comment_text_input.get('value'), + status = comment_status_input.get('value'); + + // get elements + var comment_text_output = $$('[data-text=' + id + ']').pop(), + comment_status_output = $$('[data-status=' + id + ']').pop(), + li = $$('li[data-id=' + id + ']').pop(); + + new Request.JSON({ + 'url': url, + 'method': 'post', + 'data': {'id': id, 'text': text, 'status': status}, + 'onRequest': function() { + li.setStyle('opacity', 0.5); + }, + 'onSuccess': function() { + li.setStyle('opacity', 1); + comment_text_output.set('html', text); + comment_status_output.set('html', status); + + // get publish button if it exists + var btn = li.getElement('a[href$=#publish]'); + + // hide publish button + if(btn) { + if(status == 'published') { + btn.dispose(); + } + } else { + if(status == 'pending') { + var ul = li.getElement('ul'); + btn = new Element('li'); + btn.grab(new Element('a', { + 'html': 'Publish', + 'href': '#publish', + 'events': { + 'click': publish + } + })); + ul.grab(btn, 'top'); + } + } + + p.close(); + } + }).send(); + }; + + var remove = function() { + var a = this, li = a.getParent('li[data-id]'); + var url = base_url + 'comments/remove'; + var id = li.get('data-id'); + + new Request.JSON({ + 'url': url, + 'method': 'post', + 'data': {'id': id}, + 'onRequest': function() { + li.setStyle('opacity', 0.5); + }, + 'onSuccess': function() { + li.dispose(); + } + }).send(); + + return false; + }; + + // bindings + $$('#comments a[href$=publish]').addEvent('click', publish); + $$('#comments a[href$=edit]').addEvent('click', edit); + $$('#comments a[href$=delete]').addEvent('click', remove); + +}('../../')); diff --git a/testcms-final-anon/system/admin/theme/assets/js/custom_fields.js b/testcms-final-anon/system/admin/theme/assets/js/custom_fields.js new file mode 100644 index 0000000..2e5d71b --- /dev/null +++ b/testcms-final-anon/system/admin/theme/assets/js/custom_fields.js @@ -0,0 +1,78 @@ + +(function() { + var a = $('create'), fields = $('fields'); + + var p = new Popup(); + + var create_field = function(key, label) { + var p = new Element('p', { + 'id': 'field_' + key + }), + l = new Element('label', { + 'html': label + ':' + }), + i = new Element('input', { + 'name': 'field[' + key + ':' + label + ']', + 'type': 'text' + }); + + p.grab(l); + p.grab(i); + + fields.grab(p); + }; + + var add_field = function() { + // get data + var label = $$('input[name=field_label]').pop().get('value'), + key = $$('input[name=field_key]').pop().get('value'), + errors = []; + + if(label.length == 0) { + errors.push('Please enter a field label'); + } + + if(key.length == 0) { + errors.push('Please enter a field key'); + } + + if(errors.length) { + // show errors + return false; + } + + create_field(key, label); + + p.close(); + }; + + var show_add_field = function() { + var html = '
Custom FieldPlease enter the label and the key for your field.'; + html +='

'; + html +='

'; + html += '
'; + html +='

Close

'; + + var box = new Element('div', { + 'class': 'popup_wrapper', + 'html': html + }); + + p.open({ + 'content': box + }); + + // bind popup events + $$('button[name=create]').addEvent('click', add_field); + $$('a[href$=#close]').addEvent('click', function() { + p.close(); + return false; + }); + + return false; + }; + + // bind create method + a.addEvent('click', show_add_field); +}()); + diff --git a/testcms-final-anon/system/admin/theme/assets/js/helpers.js b/testcms-final-anon/system/admin/theme/assets/js/helpers.js new file mode 100644 index 0000000..2407e5c --- /dev/null +++ b/testcms-final-anon/system/admin/theme/assets/js/helpers.js @@ -0,0 +1,25 @@ +function formatSlug(slug, output) { + var val = slug.get('value'); + + // replace spaces + val = val.replace(/\s+/, '-'); + + // replace crazy characters + val = val.replace(/[^0-9a-z\-]/i, ''); + + // convert to lower case + val = val.toLowerCase(); + + output.set('html', (val.length ? val : 'slug')); + slug.set('value', val); +} + +function formatTwitter(tweet, output) { + var val = tweet.get('value'); + + // replace crazy characters + val = val.replace(/[^0-9a-z\_]/i, ''); + + output.set('html', (val.length ? val : 'example')); + tweet.set('value', val); +} diff --git a/testcms-final-anon/system/admin/theme/assets/js/mootools.js b/testcms-final-anon/system/admin/theme/assets/js/mootools.js new file mode 100644 index 0000000..1313a50 --- /dev/null +++ b/testcms-final-anon/system/admin/theme/assets/js/mootools.js @@ -0,0 +1,515 @@ +/* +--- +MooTools: the javascript framework + +web build: + - http://mootools.net/core/76bf47062d6c1983d66ce47ad66aa0e0 + +packager build: + - packager build Core/Core Core/Array Core/String Core/Number Core/Function Core/Object Core/Event Core/Browser Core/Class Core/Class.Extras Core/Slick.Parser Core/Slick.Finder Core/Element Core/Element.Style Core/Element.Event Core/Element.Delegation Core/Element.Dimensions Core/Fx Core/Fx.CSS Core/Fx.Tween Core/Fx.Morph Core/Fx.Transitions Core/Request Core/Request.HTML Core/Request.JSON Core/Cookie Core/JSON Core/DOMReady Core/Swiff + +copyrights: + - [MooTools](http://mootools.net) + +licenses: + - [MIT License](http://mootools.net/license.txt) +... +*/ +(function(){this.MooTools={version:"1.4.1",build:"d1fb25710e3c5482a219ab9dc675a4e0ad2176b6"};var e=this.typeOf=function(i){if(i==null){return"null";}if(i.$family){return i.$family(); +}if(i.nodeName){if(i.nodeType==1){return"element";}if(i.nodeType==3){return(/\S/).test(i.nodeValue)?"textnode":"whitespace";}}else{if(typeof i.length=="number"){if(i.callee){return"arguments"; +}if("item" in i){return"collection";}}}return typeof i;};var u=this.instanceOf=function(w,i){if(w==null){return false;}var v=w.$constructor||w.constructor; +while(v){if(v===i){return true;}v=v.parent;}return w instanceof i;};var f=this.Function;var r=true;for(var q in {toString:1}){r=null;}if(r){r=["hasOwnProperty","valueOf","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","constructor"]; +}f.prototype.overloadSetter=function(v){var i=this;return function(x,w){if(x==null){return this;}if(v||typeof x!="string"){for(var y in x){i.call(this,y,x[y]); +}if(r){for(var z=r.length;z--;){y=r[z];if(x.hasOwnProperty(y)){i.call(this,y,x[y]);}}}}else{i.call(this,x,w);}return this;};};f.prototype.overloadGetter=function(v){var i=this; +return function(x){var y,w;if(v||typeof x!="string"){y=x;}else{if(arguments.length>1){y=arguments;}}if(y){w={};for(var z=0;z>>0; +b>>0;b>>0;for(var a=(d<0)?Math.max(0,b+d):d||0;a>>0,b=Array(d); +for(var a=0;a>>0;b-1:String(this).indexOf(a)>-1;},trim:function(){return String(this).replace(/^\s+|\s+$/g,""); +},clean:function(){return String(this).replace(/\s+/g," ").trim();},camelCase:function(){return String(this).replace(/-\D/g,function(a){return a.charAt(1).toUpperCase(); +});},hyphenate:function(){return String(this).replace(/[A-Z]/g,function(a){return("-"+a.charAt(0).toLowerCase());});},capitalize:function(){return String(this).replace(/\b[a-z]/g,function(a){return a.toUpperCase(); +});},escapeRegExp:function(){return String(this).replace(/([-.*+?^${}()|[\]\/\\])/g,"\\$1");},toInt:function(a){return parseInt(this,a||10);},toFloat:function(){return parseFloat(this); +},hexToRgb:function(b){var a=String(this).match(/^#?(\w{1,2})(\w{1,2})(\w{1,2})$/);return(a)?a.slice(1).hexToRgb(b):null;},rgbToHex:function(b){var a=String(this).match(/\d{1,3}/g); +return(a)?a.rgbToHex(b):null;},substitute:function(a,b){return String(this).replace(b||(/\\?\{([^{}]+)\}/g),function(d,c){if(d.charAt(0)=="\\"){return d.slice(1); +}return(a[c]!=null)?a[c]:"";});}});Number.implement({limit:function(b,a){return Math.min(a,Math.max(b,this));},round:function(a){a=Math.pow(10,a||0).toFixed(a<0?-a:0); +return Math.round(this*a)/a;},times:function(b,c){for(var a=0;a1?Array.slice(arguments,1):null,d=function(){};var c=function(){var g=e,h=arguments.length;if(this instanceof c){d.prototype=a.prototype; +g=new d;}var f=(!b&&!h)?a.call(g):a.apply(g,b&&h?b.concat(Array.slice(arguments)):b||arguments);return g==e?f:g;};return c;},pass:function(b,c){var a=this; +if(b!=null){b=Array.from(b);}return function(){return a.apply(c,b||arguments);};},delay:function(b,c,a){return setTimeout(this.pass((a==null?[]:a),c),b); +},periodical:function(c,b,a){return setInterval(this.pass((a==null?[]:a),b),c);}});delete Function.prototype.bind;Function.implement({create:function(b){var a=this; +b=b||{};return function(d){var c=b.arguments;c=(c!=null)?Array.from(c):Array.slice(arguments,(b.event)?1:0);if(b.event){c=[d||window.event].extend(c);}var e=function(){return a.apply(b.bind||null,c); +};if(b.delay){return setTimeout(e,b.delay);}if(b.periodical){return setInterval(e,b.periodical);}if(b.attempt){return Function.attempt(e);}return e();}; +},bind:function(c,b){var a=this;if(b!=null){b=Array.from(b);}return function(){return a.apply(c,b||arguments);};},bindWithEvent:function(c,b){var a=this; +if(b!=null){b=Array.from(b);}return function(d){return a.apply(c,(b==null)?arguments:[d].concat(b));};},run:function(a,b){return this.apply(b,Array.from(a)); +}});if(Object.create==Function.prototype.create){Object.create=null;}var $try=Function.attempt;(function(){var a=Object.prototype.hasOwnProperty;Object.extend({subset:function(d,g){var f={}; +for(var e=0,b=g.length;e]*>([\s\S]*?)<\/script>/gi,function(s,t){e+=t+"\n"; +return"";});if(q===true){p.exec(e);}else{if(typeOf(q)=="function"){q(e,r);}}return r;});p.extend({Document:this.Document,Window:this.Window,Element:this.Element,Event:this.Event}); +this.Window=this.$constructor=new Type("Window",function(){});this.$family=Function.from("window").hide();Window.mirror(function(e,q){j[e]=q;});this.Document=l.$constructor=new Type("Document",function(){}); +l.$family=Function.from("document").hide();Document.mirror(function(e,q){l[e]=q;});l.html=l.documentElement;if(!l.head){l.head=l.getElementsByTagName("head")[0]; +}if(l.execCommand){try{l.execCommand("BackgroundImageCache",false,true);}catch(h){}}if(this.attachEvent&&!this.addEventListener){var d=function(){this.detachEvent("onunload",d); +l.head=l.html=l.window=null;};this.attachEvent("onunload",d);}var n=Array.from;try{n(l.html.childNodes);}catch(h){Array.from=function(q){if(typeof q!="string"&&Type.isEnumerable(q)&&typeOf(q)!="array"){var e=q.length,r=new Array(e); +while(e--){r[e]=q[e];}return r;}return n(q);};var m=Array.prototype,o=m.slice;["pop","push","reverse","shift","sort","splice","unshift","concat","join","slice"].each(function(e){var q=m[e]; +Array[e]=function(r){return q.apply(Array.from(r),o.call(arguments,1));};});}if(p.Platform.ios){p.Platform.ipod=true;}p.Engine={};var f=function(q,e){p.Engine.name=q; +p.Engine[q+e]=true;p.Engine.version=e;};if(p.ie){p.Engine.trident=true;switch(p.version){case 6:f("trident",4);break;case 7:f("trident",5);break;case 8:f("trident",6); +}}if(p.firefox){p.Engine.gecko=true;if(p.version>=3){f("gecko",19);}else{f("gecko",18);}}if(p.safari||p.chrome){p.Engine.webkit=true;switch(p.version){case 2:f("webkit",419); +break;case 3:f("webkit",420);break;case 4:f("webkit",525);}}if(p.opera){p.Engine.presto=true;if(p.version>=9.6){f("presto",960);}else{if(p.version>=9.5){f("presto",950); +}else{f("presto",925);}}}if(p.name=="unknown"){switch((a.match(/(?:webkit|khtml|gecko)/)||[])[0]){case"webkit":case"khtml":p.Engine.webkit=true;break;case"gecko":p.Engine.gecko=true; +}}this.$exec=p.exec;})();(function(){var b={};var a=this.DOMEvent=new Type("DOMEvent",function(c,g){if(!g){g=window;}c=c||g.event;if(c.$extended){return c; +}this.event=c;this.$extended=true;this.shift=c.shiftKey;this.control=c.ctrlKey;this.alt=c.altKey;this.meta=c.metaKey;var i=this.type=c.type;var h=c.target||c.srcElement; +while(h&&h.nodeType==3){h=h.parentNode;}this.target=document.id(h);if(i.indexOf("key")==0){var d=this.code=(c.which||c.keyCode);this.key=b[d]||Object.keyOf(Event.Keys,d); +if(i=="keydown"){if(d>111&&d<124){this.key="f"+(d-111);}else{if(d>95&&d<106){this.key=d-96;}}}if(this.key==null){this.key=String.fromCharCode(d).toLowerCase(); +}}else{if(i=="click"||i=="dblclick"||i=="contextmenu"||i=="DOMMouseScroll"||i.indexOf("mouse")==0){var j=g.document;j=(!j.compatMode||j.compatMode=="CSS1Compat")?j.html:j.body; +this.page={x:(c.pageX!=null)?c.pageX:c.clientX+j.scrollLeft,y:(c.pageY!=null)?c.pageY:c.clientY+j.scrollTop};this.client={x:(c.pageX!=null)?c.pageX-g.pageXOffset:c.clientX,y:(c.pageY!=null)?c.pageY-g.pageYOffset:c.clientY}; +if(i=="DOMMouseScroll"||i=="mousewheel"){this.wheel=(c.wheelDelta)?c.wheelDelta/120:-(c.detail||0)/3;}this.rightClick=(c.which==3||c.button==2);if(i=="mouseover"||i=="mouseout"){var k=c.relatedTarget||c[(i=="mouseover"?"from":"to")+"Element"]; +while(k&&k.nodeType==3){k=k.parentNode;}this.relatedTarget=document.id(k);}}else{if(i.indexOf("touch")==0||i.indexOf("gesture")==0){this.rotation=c.rotation; +this.scale=c.scale;this.targetTouches=c.targetTouches;this.changedTouches=c.changedTouches;var f=this.touches=c.touches;if(f&&f[0]){var e=f[0];this.page={x:e.pageX,y:e.pageY}; +this.client={x:e.clientX,y:e.clientY};}}}}if(!this.client){this.client={};}if(!this.page){this.page={};}});a.implement({stop:function(){return this.preventDefault().stopPropagation(); +},stopPropagation:function(){if(this.event.stopPropagation){this.event.stopPropagation();}else{this.event.cancelBubble=true;}return this;},preventDefault:function(){if(this.event.preventDefault){this.event.preventDefault(); +}else{this.event.returnValue=false;}return this;}});a.defineKey=function(d,c){b[d]=c;return this;};a.defineKeys=a.defineKey.overloadSetter(true);a.defineKeys({"38":"up","40":"down","37":"left","39":"right","27":"esc","32":"space","8":"backspace","9":"tab","46":"delete","13":"enter"}); +})();var Event=DOMEvent;Event.Keys={};Event.Keys=new Hash(Event.Keys);(function(){var a=this.Class=new Type("Class",function(h){if(instanceOf(h,Function)){h={initialize:h}; +}var g=function(){e(this);if(g.$prototyping){return this;}this.$caller=null;var i=(this.initialize)?this.initialize.apply(this,arguments):this;this.$caller=this.caller=null; +return i;}.extend(this).implement(h);g.$constructor=a;g.prototype.$constructor=g;g.prototype.parent=c;return g;});var c=function(){if(!this.$caller){throw new Error('The method "parent" cannot be called.'); +}var g=this.$caller.$name,h=this.$caller.$owner.parent,i=(h)?h.prototype[g]:null;if(!i){throw new Error('The method "'+g+'" has no parent.');}return i.apply(this,arguments); +};var e=function(g){for(var h in g){var j=g[h];switch(typeOf(j)){case"object":var i=function(){};i.prototype=j;g[h]=e(new i);break;case"array":g[h]=j.clone(); +break;}}return g;};var b=function(g,h,j){if(j.$origin){j=j.$origin;}var i=function(){if(j.$protected&&this.$caller==null){throw new Error('The method "'+h+'" cannot be called.'); +}var l=this.caller,m=this.$caller;this.caller=m;this.$caller=i;var k=j.apply(this,arguments);this.$caller=m;this.caller=l;return k;}.extend({$owner:g,$origin:j,$name:h}); +return i;};var f=function(h,i,g){if(a.Mutators.hasOwnProperty(h)){i=a.Mutators[h].call(this,i);if(i==null){return this;}}if(typeOf(i)=="function"){if(i.$hidden){return this; +}this.prototype[h]=(g)?i:b(this,h,i);}else{Object.merge(this.prototype,h,i);}return this;};var d=function(g){g.$prototyping=true;var h=new g;delete g.$prototyping; +return h;};a.implement("implement",f.overloadSetter());a.Mutators={Extends:function(g){this.parent=g;this.prototype=d(g);},Implements:function(g){Array.from(g).each(function(j){var h=new j; +for(var i in h){f.call(this,i,h[i],true);}},this);}};})();(function(){this.Chain=new Class({$chain:[],chain:function(){this.$chain.append(Array.flatten(arguments)); +return this;},callChain:function(){return(this.$chain.length)?this.$chain.shift().apply(this,arguments):false;},clearChain:function(){this.$chain.empty(); +return this;}});var a=function(b){return b.replace(/^on([A-Z])/,function(c,d){return d.toLowerCase();});};this.Events=new Class({$events:{},addEvent:function(d,c,b){d=a(d); +if(c==$empty){return this;}this.$events[d]=(this.$events[d]||[]).include(c);if(b){c.internal=true;}return this;},addEvents:function(b){for(var c in b){this.addEvent(c,b[c]); +}return this;},fireEvent:function(e,c,b){e=a(e);var d=this.$events[e];if(!d){return this;}c=Array.from(c);d.each(function(f){if(b){f.delay(b,this,c);}else{f.apply(this,c); +}},this);return this;},removeEvent:function(e,d){e=a(e);var c=this.$events[e];if(c&&!d.internal){var b=c.indexOf(d);if(b!=-1){delete c[b];}}return this; +},removeEvents:function(d){var e;if(typeOf(d)=="object"){for(e in d){this.removeEvent(e,d[e]);}return this;}if(d){d=a(d);}for(e in this.$events){if(d&&d!=e){continue; +}var c=this.$events[e];for(var b=c.length;b--;){if(b in c){this.removeEvent(e,c[b]);}}}return this;}});this.Options=new Class({setOptions:function(){var b=this.options=Object.merge.apply(null,[{},this.options].append(arguments)); +if(this.addEvent){for(var c in b){if(typeOf(b[c])!="function"||!(/^on[A-Z]/).test(c)){continue;}this.addEvent(c,b[c]);delete b[c];}}return this;}});})(); +(function(){var k,n,l,g,a={},c={},m=/\\/g;var e=function(q,p){if(q==null){return null;}if(q.Slick===true){return q;}q=(""+q).replace(/^\s+|\s+$/g,"");g=!!p; +var o=(g)?c:a;if(o[q]){return o[q];}k={Slick:true,expressions:[],raw:q,reverse:function(){return e(this.raw,true);}};n=-1;while(q!=(q=q.replace(j,b))){}k.length=k.expressions.length; +return o[k.raw]=(g)?h(k):k;};var i=function(o){if(o==="!"){return" ";}else{if(o===" "){return"!";}else{if((/^!/).test(o)){return o.replace(/^!/,"");}else{return"!"+o; +}}}};var h=function(u){var r=u.expressions;for(var p=0;p+)\\s*|(\\s+)|(+|\\*)|\\#(+)|\\.(+)|\\[\\s*(+)(?:\\s*([*^$!~|]?=)(?:\\s*(?:([\"']?)(.*?)\\9)))?\\s*\\](?!\\])|(:+)(+)(?:\\((?:(?:([\"'])([^\\13]*)\\13)|((?:\\([^)]+\\)|[^()]*)+))\\))?)".replace(//,"["+f(">+~`!@$%^&={}\\;/g,"(?:[\\w\\u00a1-\\uFFFF-]|\\\\[^\\s0-9a-f])").replace(//g,"(?:[:\\w\\u00a1-\\uFFFF-]|\\\\[^\\s0-9a-f])")); +function b(x,s,D,z,r,C,q,B,A,y,u,F,G,v,p,w){if(s||n===-1){k.expressions[++n]=[];l=-1;if(s){return"";}}if(D||z||l===-1){D=D||" ";var t=k.expressions[n]; +if(g&&t[l]){t[l].reverseCombinator=i(D);}t[++l]={combinator:D,tag:"*"};}var o=k.expressions[n][l];if(r){o.tag=r.replace(m,"");}else{if(C){o.id=C.replace(m,""); +}else{if(q){q=q.replace(m,"");if(!o.classList){o.classList=[];}if(!o.classes){o.classes=[];}o.classList.push(q);o.classes.push({value:q,regexp:new RegExp("(^|\\s)"+f(q)+"(\\s|$)")}); +}else{if(G){w=w||p;w=w?w.replace(m,""):null;if(!o.pseudos){o.pseudos=[];}o.pseudos.push({key:G.replace(m,""),value:w,type:F.length==1?"class":"element"}); +}else{if(B){B=B.replace(m,"");u=(u||"").replace(m,"");var E,H;switch(A){case"^=":H=new RegExp("^"+f(u));break;case"$=":H=new RegExp(f(u)+"$");break;case"~=":H=new RegExp("(^|\\s)"+f(u)+"(\\s|$)"); +break;case"|=":H=new RegExp("^"+f(u)+"(-|$)");break;case"=":E=function(I){return u==I;};break;case"*=":E=function(I){return I&&I.indexOf(u)>-1;};break; +case"!=":E=function(I){return u!=I;};break;default:E=function(I){return !!I;};}if(u==""&&(/^[*$^]=$/).test(A)){E=function(){return false;};}if(!E){E=function(I){return I&&H.test(I); +};}if(!o.attributes){o.attributes=[];}o.attributes.push({key:B,operator:A,value:u,test:E});}}}}}return"";}var d=(this.Slick||{});d.parse=function(o){return e(o); +};d.escapeRegExp=f;if(!this.Slick){this.Slick=d;}}).apply((typeof exports!="undefined")?exports:this);(function(){var k={},m={},d=Object.prototype.toString; +k.isNativeCode=function(c){return(/\{\s*\[native code\]\s*\}/).test(""+c);};k.isXML=function(c){return(!!c.xmlVersion)||(!!c.xml)||(d.call(c)=="[object XMLDocument]")||(c.nodeType==9&&c.documentElement.nodeName!="HTML"); +};k.setDocument=function(x){var u=x.nodeType;if(u==9){}else{if(u){x=x.ownerDocument;}else{if(x.navigator){x=x.document;}else{return;}}}if(this.document===x){return; +}this.document=x;var z=x.documentElement,v=this.getUIDXML(z),p=m[v],B;if(p){for(B in p){this[B]=p[B];}return;}p=m[v]={};p.root=z;p.isXMLDocument=this.isXML(x); +p.brokenStarGEBTN=p.starSelectsClosedQSA=p.idGetsName=p.brokenMixedCaseQSA=p.brokenGEBCN=p.brokenCheckedQSA=p.brokenEmptyAttributeQSA=p.isHTMLDocument=p.nativeMatchesSelector=false; +var n,o,y,r,s;var t,c="slick_uniqueid";var A=x.createElement("div");var q=x.body||x.getElementsByTagName("body")[0]||z;q.appendChild(A);try{A.innerHTML=''; +p.isHTMLDocument=!!x.getElementById(c);}catch(w){}if(p.isHTMLDocument){A.style.display="none";A.appendChild(x.createComment(""));o=(A.getElementsByTagName("*").length>1); +try{A.innerHTML="foo";t=A.getElementsByTagName("*");n=(t&&!!t.length&&t[0].nodeName.charAt(0)=="/");}catch(w){}p.brokenStarGEBTN=o||n;try{A.innerHTML=''; +p.idGetsName=x.getElementById(c)===A.firstChild;}catch(w){}if(A.getElementsByClassName){try{A.innerHTML='';A.getElementsByClassName("b").length; +A.firstChild.className="b";r=(A.getElementsByClassName("b").length!=2);}catch(w){}try{A.innerHTML='';y=(A.getElementsByClassName("a").length!=2); +}catch(w){}p.brokenGEBCN=r||y;}if(A.querySelectorAll){try{A.innerHTML="foo";t=A.querySelectorAll("*");p.starSelectsClosedQSA=(t&&!!t.length&&t[0].nodeName.charAt(0)=="/"); +}catch(w){}try{A.innerHTML='';p.brokenMixedCaseQSA=!A.querySelectorAll(".MiX").length;}catch(w){}try{A.innerHTML=''; +p.brokenCheckedQSA=(A.querySelectorAll(":checked").length==0);}catch(w){}try{A.innerHTML='';p.brokenEmptyAttributeQSA=(A.querySelectorAll('[class*=""]').length!=0); +}catch(w){}}try{A.innerHTML='
';s=(A.firstChild.getAttribute("action")!="s");}catch(w){}p.nativeMatchesSelector=z.matchesSelector||z.mozMatchesSelector||z.webkitMatchesSelector; +if(p.nativeMatchesSelector){try{p.nativeMatchesSelector.call(z,":slick");p.nativeMatchesSelector=null;}catch(w){}}}try{z.slick_expando=1;delete z.slick_expando; +p.getUID=this.getUIDHTML;}catch(w){p.getUID=this.getUIDXML;}q.removeChild(A);A=t=q=null;p.getAttribute=(p.isHTMLDocument&&s)?function(E,C){var F=this.attributeGetters[C]; +if(F){return F.call(E);}var D=E.getAttributeNode(C);return(D)?D.nodeValue:null;}:function(D,C){var E=this.attributeGetters[C];return(E)?E.call(D):D.getAttribute(C); +};p.hasAttribute=(z&&this.isNativeCode(z.hasAttribute))?function(D,C){return D.hasAttribute(C);}:function(D,C){D=D.getAttributeNode(C);return !!(D&&(D.specified||D.nodeValue)); +};p.contains=(z&&this.isNativeCode(z.contains))?function(C,D){return C.contains(D);}:(z&&z.compareDocumentPosition)?function(C,D){return C===D||!!(C.compareDocumentPosition(D)&16); +}:function(C,D){if(D){do{if(D===C){return true;}}while((D=D.parentNode));}return false;};p.documentSorter=(z.compareDocumentPosition)?function(D,C){if(!D.compareDocumentPosition||!C.compareDocumentPosition){return 0; +}return D.compareDocumentPosition(C)&4?-1:D===C?0:1;}:("sourceIndex" in z)?function(D,C){if(!D.sourceIndex||!C.sourceIndex){return 0;}return D.sourceIndex-C.sourceIndex; +}:(x.createRange)?function(F,D){if(!F.ownerDocument||!D.ownerDocument){return 0;}var E=F.ownerDocument.createRange(),C=D.ownerDocument.createRange();E.setStart(F,0); +E.setEnd(F,0);C.setStart(D,0);C.setEnd(D,0);return E.compareBoundaryPoints(Range.START_TO_END,C);}:null;z=null;for(B in p){this[B]=p[B];}};var f=/^([#.]?)((?:[\w-]+|\*))$/,h=/\[.+[*$^]=(?:""|'')?\]/,g={}; +k.search=function(U,z,H,s){var p=this.found=(s)?null:(H||[]);if(!U){return p;}else{if(U.navigator){U=U.document;}else{if(!U.nodeType){return p;}}}var F,O,V=this.uniques={},I=!!(H&&H.length),y=(U.nodeType==9); +if(this.document!==(y?U:U.ownerDocument)){this.setDocument(U);}if(I){for(O=p.length;O--;){V[this.getUID(p[O])]=true;}}if(typeof z=="string"){var r=z.match(f); +simpleSelectors:if(r){var u=r[1],v=r[2],A,E;if(!u){if(v=="*"&&this.brokenStarGEBTN){break simpleSelectors;}E=U.getElementsByTagName(v);if(s){return E[0]||null; +}for(O=0;A=E[O++];){if(!(I&&V[this.getUID(A)])){p.push(A);}}}else{if(u=="#"){if(!this.isHTMLDocument||!y){break simpleSelectors;}A=U.getElementById(v); +if(!A){return p;}if(this.idGetsName&&A.getAttributeNode("id").nodeValue!=v){break simpleSelectors;}if(s){return A||null;}if(!(I&&V[this.getUID(A)])){p.push(A); +}}else{if(u=="."){if(!this.isHTMLDocument||((!U.getElementsByClassName||this.brokenGEBCN)&&U.querySelectorAll)){break simpleSelectors;}if(U.getElementsByClassName&&!this.brokenGEBCN){E=U.getElementsByClassName(v); +if(s){return E[0]||null;}for(O=0;A=E[O++];){if(!(I&&V[this.getUID(A)])){p.push(A);}}}else{var T=new RegExp("(^|\\s)"+e.escapeRegExp(v)+"(\\s|$)");E=U.getElementsByTagName("*"); +for(O=0;A=E[O++];){className=A.className;if(!(className&&T.test(className))){continue;}if(s){return A;}if(!(I&&V[this.getUID(A)])){p.push(A);}}}}}}if(I){this.sort(p); +}return(s)?null:p;}querySelector:if(U.querySelectorAll){if(!this.isHTMLDocument||g[z]||this.brokenMixedCaseQSA||(this.brokenCheckedQSA&&z.indexOf(":checked")>-1)||(this.brokenEmptyAttributeQSA&&h.test(z))||(!y&&z.indexOf(",")>-1)||e.disableQSA){break querySelector; +}var S=z,x=U;if(!y){var C=x.getAttribute("id"),t="slickid__";x.setAttribute("id",t);S="#"+t+" "+S;U=x.parentNode;}try{if(s){return U.querySelector(S)||null; +}else{E=U.querySelectorAll(S);}}catch(Q){g[z]=1;break querySelector;}finally{if(!y){if(C){x.setAttribute("id",C);}else{x.removeAttribute("id");}U=x;}}if(this.starSelectsClosedQSA){for(O=0; +A=E[O++];){if(A.nodeName>"@"&&!(I&&V[this.getUID(A)])){p.push(A);}}}else{for(O=0;A=E[O++];){if(!(I&&V[this.getUID(A)])){p.push(A);}}}if(I){this.sort(p); +}return p;}F=this.Slick.parse(z);if(!F.length){return p;}}else{if(z==null){return p;}else{if(z.Slick){F=z;}else{if(this.contains(U.documentElement||U,z)){(p)?p.push(z):p=z; +return p;}else{return p;}}}}this.posNTH={};this.posNTHLast={};this.posNTHType={};this.posNTHTypeLast={};this.push=(!I&&(s||(F.length==1&&F.expressions[0].length==1)))?this.pushArray:this.pushUID; +if(p==null){p=[];}var M,L,K;var B,J,D,c,q,G,W;var N,P,o,w,R=F.expressions;search:for(O=0;(P=R[O]);O++){for(M=0;(o=P[M]);M++){B="combinator:"+o.combinator; +if(!this[B]){continue search;}J=(this.isXMLDocument)?o.tag:o.tag.toUpperCase();D=o.id;c=o.classList;q=o.classes;G=o.attributes;W=o.pseudos;w=(M===(P.length-1)); +this.bitUniques={};if(w){this.uniques=V;this.found=p;}else{this.uniques={};this.found=[];}if(M===0){this[B](U,J,D,q,G,W,c);if(s&&w&&p.length){break search; +}}else{if(s&&w){for(L=0,K=N.length;L1)){this.sort(p);}return(s)?(p[0]||null):p;};k.uidx=1;k.uidk="slick-uniqueid";k.getUIDXML=function(n){var c=n.getAttribute(this.uidk); +if(!c){c=this.uidx++;n.setAttribute(this.uidk,c);}return c;};k.getUIDHTML=function(c){return c.uniqueNumber||(c.uniqueNumber=this.uidx++);};k.sort=function(c){if(!this.documentSorter){return c; +}c.sort(this.documentSorter);return c;};k.cacheNTH={};k.matchNTH=/^([+-]?\d*)?([a-z]+)?([+-]\d+)?$/;k.parseNTHArgument=function(q){var o=q.match(this.matchNTH); +if(!o){return false;}var p=o[2]||false;var n=o[1]||1;if(n=="-"){n=-1;}var c=+o[3]||0;o=(p=="n")?{a:n,b:c}:(p=="odd")?{a:2,b:1}:(p=="even")?{a:2,b:0}:{a:0,b:n}; +return(this.cacheNTH[q]=o);};k.createNTHPseudo=function(p,n,c,o){return function(s,q){var u=this.getUID(s);if(!this[c][u]){var A=s.parentNode;if(!A){return false; +}var r=A[p],t=1;if(o){var z=s.nodeName;do{if(r.nodeName!=z){continue;}this[c][this.getUID(r)]=t++;}while((r=r[n]));}else{do{if(r.nodeType!=1){continue; +}this[c][this.getUID(r)]=t++;}while((r=r[n]));}}q=q||"n";var v=this.cacheNTH[q]||this.parseNTHArgument(q);if(!v){return false;}var y=v.a,x=v.b,w=this[c][u]; +if(y==0){return x==w;}if(y>0){if(w":function(p,c,r,o,n,q){if((p=p.firstChild)){do{if(p.nodeType==1){this.push(p,c,r,o,n,q); +}}while((p=p.nextSibling));}},"+":function(p,c,r,o,n,q){while((p=p.nextSibling)){if(p.nodeType==1){this.push(p,c,r,o,n,q);break;}}},"^":function(p,c,r,o,n,q){p=p.firstChild; +if(p){if(p.nodeType==1){this.push(p,c,r,o,n,q);}else{this["combinator:+"](p,c,r,o,n,q);}}},"~":function(q,c,s,p,n,r){while((q=q.nextSibling)){if(q.nodeType!=1){continue; +}var o=this.getUID(q);if(this.bitUniques[o]){break;}this.bitUniques[o]=true;this.push(q,c,s,p,n,r);}},"++":function(p,c,r,o,n,q){this["combinator:+"](p,c,r,o,n,q); +this["combinator:!+"](p,c,r,o,n,q);},"~~":function(p,c,r,o,n,q){this["combinator:~"](p,c,r,o,n,q);this["combinator:!~"](p,c,r,o,n,q);},"!":function(p,c,r,o,n,q){while((p=p.parentNode)){if(p!==this.document){this.push(p,c,r,o,n,q); +}}},"!>":function(p,c,r,o,n,q){p=p.parentNode;if(p!==this.document){this.push(p,c,r,o,n,q);}},"!+":function(p,c,r,o,n,q){while((p=p.previousSibling)){if(p.nodeType==1){this.push(p,c,r,o,n,q); +break;}}},"!^":function(p,c,r,o,n,q){p=p.lastChild;if(p){if(p.nodeType==1){this.push(p,c,r,o,n,q);}else{this["combinator:!+"](p,c,r,o,n,q);}}},"!~":function(q,c,s,p,n,r){while((q=q.previousSibling)){if(q.nodeType!=1){continue; +}var o=this.getUID(q);if(this.bitUniques[o]){break;}this.bitUniques[o]=true;this.push(q,c,s,p,n,r);}}};for(var i in j){k["combinator:"+i]=j[i];}var l={empty:function(c){var n=c.firstChild; +return !(n&&n.nodeType==1)&&!(c.innerText||c.textContent||"").length;},not:function(c,n){return !this.matchNode(c,n);},contains:function(c,n){return(c.innerText||c.textContent||"").indexOf(n)>-1; +},"first-child":function(c){while((c=c.previousSibling)){if(c.nodeType==1){return false;}}return true;},"last-child":function(c){while((c=c.nextSibling)){if(c.nodeType==1){return false; +}}return true;},"only-child":function(o){var n=o;while((n=n.previousSibling)){if(n.nodeType==1){return false;}}var c=o;while((c=c.nextSibling)){if(c.nodeType==1){return false; +}}return true;},"nth-child":k.createNTHPseudo("firstChild","nextSibling","posNTH"),"nth-last-child":k.createNTHPseudo("lastChild","previousSibling","posNTHLast"),"nth-of-type":k.createNTHPseudo("firstChild","nextSibling","posNTHType",true),"nth-last-of-type":k.createNTHPseudo("lastChild","previousSibling","posNTHTypeLast",true),index:function(n,c){return this["pseudo:nth-child"](n,""+c+1); +},even:function(c){return this["pseudo:nth-child"](c,"2n");},odd:function(c){return this["pseudo:nth-child"](c,"2n+1");},"first-of-type":function(c){var n=c.nodeName; +while((c=c.previousSibling)){if(c.nodeName==n){return false;}}return true;},"last-of-type":function(c){var n=c.nodeName;while((c=c.nextSibling)){if(c.nodeName==n){return false; +}}return true;},"only-of-type":function(o){var n=o,p=o.nodeName;while((n=n.previousSibling)){if(n.nodeName==p){return false;}}var c=o;while((c=c.nextSibling)){if(c.nodeName==p){return false; +}}return true;},enabled:function(c){return !c.disabled;},disabled:function(c){return c.disabled;},checked:function(c){return c.checked||c.selected;},focus:function(c){return this.isHTMLDocument&&this.document.activeElement===c&&(c.href||c.type||this.hasAttribute(c,"tabindex")); +},root:function(c){return(c===this.root);},selected:function(c){return c.selected;}};for(var b in l){k["pseudo:"+b]=l[b];}var a=k.attributeGetters={"class":function(){return this.getAttribute("class")||this.className; +},"for":function(){return("htmlFor" in this)?this.htmlFor:this.getAttribute("for");},href:function(){return("href" in this)?this.getAttribute("href",2):this.getAttribute("href"); +},style:function(){return(this.style)?this.style.cssText:this.getAttribute("style");},tabindex:function(){var c=this.getAttributeNode("tabindex");return(c&&c.specified)?c.nodeValue:null; +},type:function(){return this.getAttribute("type");},maxlength:function(){var c=this.getAttributeNode("maxLength");return(c&&c.specified)?c.nodeValue:null; +}};a.MAXLENGTH=a.maxLength=a.maxlength;var e=k.Slick=(this.Slick||{});e.version="1.1.6";e.search=function(n,o,c){return k.search(n,o,c);};e.find=function(c,n){return k.search(c,n,null,true); +};e.contains=function(c,n){k.setDocument(c);return k.contains(c,n);};e.getAttribute=function(n,c){k.setDocument(n);return k.getAttribute(n,c);};e.hasAttribute=function(n,c){k.setDocument(n); +return k.hasAttribute(n,c);};e.match=function(n,c){if(!(n&&c)){return false;}if(!c||c===n){return true;}k.setDocument(n);return k.matchNode(n,c);};e.defineAttributeGetter=function(c,n){k.attributeGetters[c]=n; +return this;};e.lookupAttributeGetter=function(c){return k.attributeGetters[c];};e.definePseudo=function(c,n){k["pseudo:"+c]=function(p,o){return n.call(p,o); +};return this;};e.lookupPseudo=function(c){var n=k["pseudo:"+c];if(n){return function(o){return n.call(this,o);};}return null;};e.override=function(n,c){k.override(n,c); +return this;};e.isXML=k.isXML;e.uidOf=function(c){return k.getUIDHTML(c);};if(!this.Slick){this.Slick=e;}}).apply((typeof exports!="undefined")?exports:this); +var Element=function(b,g){var h=Element.Constructors[b];if(h){return h(g);}if(typeof b!="string"){return document.id(b).set(g);}if(!g){g={};}if(!(/^[\w-]+$/).test(b)){var e=Slick.parse(b).expressions[0][0]; +b=(e.tag=="*")?"div":e.tag;if(e.id&&g.id==null){g.id=e.id;}var d=e.attributes;if(d){for(var a,f=0,c=d.length;f=this.length){delete this[h--];}return e;}.protect());}Elements.implement(Array.prototype);Array.mirror(Elements);var f;try{var a=document.createElement(""); +f=(a.name=="x");}catch(c){}var d=function(e){return(""+e).replace(/&/g,"&").replace(/"/g,""");};Document.implement({newElement:function(e,h){if(h&&h.checked!=null){h.defaultChecked=h.checked; +}if(f&&h){e="<"+e;if(h.name){e+=' name="'+d(h.name)+'"';}if(h.type){e+=' type="'+d(h.type)+'"';}e+=">";delete h.name;delete h.type;}return this.id(this.createElement(e)).set(h); +}});})();Document.implement({newTextNode:function(a){return this.createTextNode(a);},getDocument:function(){return this;},getWindow:function(){return this.window; +},id:(function(){var a={string:function(d,c,b){d=Slick.find(b,"#"+d.replace(/(\W)/g,"\\$1"));return(d)?a.element(d,c):null;},element:function(b,c){$uid(b); +if(!c&&!b.$family&&!(/^(?:object|embed)$/i).test(b.tagName)){Object.append(b,Element.Prototype);}return b;},object:function(c,d,b){if(c.toElement){return a.element(c.toElement(b),d); +}return null;}};a.textnode=a.whitespace=a.window=a.document=function(b){return b;};return function(c,e,d){if(c&&c.$family&&c.uid){return c;}var b=typeOf(c); +return(a[b])?a[b](c,e,d||document):null;};})()});if(window.$==null){Window.implement("$",function(a,b){return document.id(a,b,this.document);});}Window.implement({getDocument:function(){return this.document; +},getWindow:function(){return this;}});[Document,Element].invoke("implement",{getElements:function(a){return Slick.search(this,a,new Elements);},getElement:function(a){return document.id(Slick.find(this,a)); +}});var contains={contains:function(a){return Slick.contains(this,a);}};if(!document.contains){Document.implement(contains);}if(!document.createElement("div").contains){Element.implement(contains); +}Element.implement("hasChild",function(a){return this!==a&&this.contains(a);});(function(b,d,a){this.Selectors={};var e=this.Selectors.Pseudo=new Hash(); +var c=function(){for(var f in e){if(e.hasOwnProperty(f)){Slick.definePseudo(f,e[f]);delete e[f];}}};Slick.search=function(g,h,f){c();return b.call(this,g,h,f); +};Slick.find=function(f,g){c();return d.call(this,f,g);};Slick.match=function(g,f){c();return a.call(this,g,f);};})(Slick.search,Slick.find,Slick.match); +var injectCombinator=function(d,c){if(!d){return c;}d=Object.clone(Slick.parse(d));var b=d.expressions;for(var a=b.length;a--;){b[a][0].combinator=c;}return d; +};Object.forEach({getNext:"~",getPrevious:"!~",getParent:"!"},function(a,b){Element.implement(b,function(c){return this.getElement(injectCombinator(c,a)); +});});Object.forEach({getAllNext:"~",getAllPrevious:"!~",getSiblings:"~~",getChildren:">",getParents:"!"},function(a,b){Element.implement(b,function(c){return this.getElements(injectCombinator(c,a)); +});});Element.implement({getFirst:function(a){return document.id(Slick.search(this,injectCombinator(a,">"))[0]);},getLast:function(a){return document.id(Slick.search(this,injectCombinator(a,">")).getLast()); +},getWindow:function(){return this.ownerDocument.window;},getDocument:function(){return this.ownerDocument;},getElementById:function(a){return document.id(Slick.find(this,"#"+(""+a).replace(/(\W)/g,"\\$1"))); +},match:function(a){return !a||Slick.match(this,a);}});if(window.$$==null){Window.implement("$$",function(a){var f=new Elements;if(arguments.length==1&&typeof a=="string"){return Slick.search(this.document,a,f); +}var c=Array.flatten(arguments);for(var d=0,b=c.length;d1){p=m=document.createDocumentFragment(); +}for(var o=0;o
";});var t=document.createElement("div"); +var o={table:[1,"
","
"],select:[1,""],tbody:[2,"","
"],tr:[3,"","
"]}; +o.thead=o.tfoot=o.tbody;t.innerHTML="";var n=t.childNodes.length==1;if(!n){var q="abbr article aside audio canvas datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video".split(" "),p=document.createDocumentFragment(),m=q.length; +while(m--){p.createElement(q[m]);}p.appendChild(t);}var r={set:function(v){if(typeOf(v)=="array"){v=v.join("");}var w=(!s&&o[this.get("tag")]);if(!w&&!n){w=[0,"",""]; +}if(w){var x=t;x.innerHTML=w[1]+v+w[2];for(var u=w[0];u--;){x=x.firstChild;}this.empty().adopt(x.childNodes);}else{this.innerHTML=v;}}};r.erase=r.set;return r; +})();var f=document.createElement("form");f.innerHTML="";if(f.firstChild.value!="s"){Element.Properties.value={set:function(r){var n=this.get("tag"); +if(n!="select"){return this.setProperty("value",r);}var o=this.getElements("option");for(var p=0;p0?"visible":"hidden"; +};var d=(h?function(j,i){j.style.opacity=i;}:(a?function(j,i){if(!j.currentStyle||!j.currentStyle.hasLayout){j.style.zoom=1;}i=(i*100).limit(0,100).round(); +i=(i==100)?"":"alpha(opacity="+i+")";var k=j.style.filter||j.getComputedStyle("filter")||"";j.style.filter=g.test(k)?k.replace(g,i):k+i;}:b));var e=(h?function(j){var i=j.style.opacity||j.getComputedStyle("opacity"); +return(i=="")?1:i.toFloat();}:(a?function(j){var k=(j.style.filter||j.getComputedStyle("filter")),i;if(k){i=k.match(g);}return(i==null||k==null)?1:(i[1]/100); +}:function(j){var i=j.retrieve("$opacity");if(i==null){i=(j.style.visibility=="hidden"?0:1);}return i;}));var c=(f.style.cssFloat==null)?"styleFloat":"cssFloat"; +Element.implement({getComputedStyle:function(k){if(this.currentStyle){return this.currentStyle[k.camelCase()];}var j=Element.getDocument(this).defaultView,i=j?j.getComputedStyle(this,null):null; +return(i)?i.getPropertyValue((k==c)?"float":k.hyphenate()):null;},setStyle:function(j,i){if(j=="opacity"){d(this,parseFloat(i));return this;}j=(j=="float"?c:j).camelCase(); +if(typeOf(i)!="string"){var k=(Element.Styles[j]||"@").split(" ");i=Array.from(i).map(function(m,l){if(!k[l]){return"";}return(typeOf(m)=="number")?k[l].replace("@",Math.round(m)):m; +}).join(" ");}else{if(i==String(Number(i))){i=Math.round(i);}}this.style[j]=i;return this;},getStyle:function(o){if(o=="opacity"){return e(this);}o=(o=="float"?c:o).camelCase(); +var i=this.style[o];if(!i||o=="zIndex"){i=[];for(var n in Element.ShortStyles){if(o!=n){continue;}for(var m in Element.ShortStyles[n]){i.push(this.getStyle(m)); +}return i.join(" ");}i=this.getComputedStyle(o);}if(i){i=String(i);var k=i.match(/rgba?\([\d\s,]+\)/);if(k){i=i.replace(k[0],k[0].rgbToHex());}}if(Browser.opera||(Browser.ie&&isNaN(parseFloat(i)))){if((/^(height|width)$/).test(o)){var j=(o=="width")?["left","right"]:["top","bottom"],l=0; +j.each(function(p){l+=this.getStyle("border-"+p+"-width").toInt()+this.getStyle("padding-"+p).toInt();},this);return this["offset"+o.capitalize()]-l+"px"; +}if(Browser.opera&&String(i).indexOf("px")!=-1){return i;}if((/^border(.+)Width|margin|padding/).test(o)){return"0px";}}return i;},setStyles:function(j){for(var i in j){this.setStyle(i,j[i]); +}return this;},getStyles:function(){var i={};Array.flatten(arguments).each(function(j){i[j]=this.getStyle(j);},this);return i;}});Element.Styles={left:"@px",top:"@px",bottom:"@px",right:"@px",width:"@px",height:"@px",maxWidth:"@px",maxHeight:"@px",minWidth:"@px",minHeight:"@px",backgroundColor:"rgb(@, @, @)",backgroundPosition:"@px @px",color:"rgb(@, @, @)",fontSize:"@px",letterSpacing:"@px",lineHeight:"@px",clip:"rect(@px @px @px @px)",margin:"@px @px @px @px",padding:"@px @px @px @px",border:"@px @ rgb(@, @, @) @px @ rgb(@, @, @) @px @ rgb(@, @, @)",borderWidth:"@px @px @px @px",borderStyle:"@ @ @ @",borderColor:"rgb(@, @, @) rgb(@, @, @) rgb(@, @, @) rgb(@, @, @)",zIndex:"@",zoom:"@",fontWeight:"@",textIndent:"@px",opacity:"@"}; +Element.implement({setOpacity:function(i){d(this,i);return this;},getOpacity:function(){return e(this);}});Element.Properties.opacity={set:function(i){d(this,i); +b(this,i);},get:function(){return e(this);}};Element.Styles=new Hash(Element.Styles);Element.ShortStyles={margin:{},padding:{},border:{},borderWidth:{},borderStyle:{},borderColor:{}}; +["Top","Right","Bottom","Left"].each(function(o){var n=Element.ShortStyles;var j=Element.Styles;["margin","padding"].each(function(p){var q=p+o;n[p][q]=j[q]="@px"; +});var m="border"+o;n.border[m]=j[m]="@px @ rgb(@, @, @)";var l=m+"Width",i=m+"Style",k=m+"Color";n[m]={};n.borderWidth[l]=n[m][l]=j[l]="@px";n.borderStyle[i]=n[m][i]=j[i]="@"; +n.borderColor[k]=n[m][k]=j[k]="rgb(@, @, @)";});})();(function(){Element.Properties.events={set:function(b){this.addEvents(b);}};[Element,Window,Document].invoke("implement",{addEvent:function(f,h){var i=this.retrieve("events",{}); +if(!i[f]){i[f]={keys:[],values:[]};}if(i[f].keys.contains(h)){return this;}i[f].keys.push(h);var g=f,b=Element.Events[f],d=h,j=this;if(b){if(b.onAdd){b.onAdd.call(this,h,f); +}if(b.condition){d=function(k){if(b.condition.call(this,k,f)){return h.call(this,k);}return true;};}if(b.base){g=Function.from(b.base).call(this,f);}}var e=function(){return h.call(j); +};var c=Element.NativeEvents[g];if(c){if(c==2){e=function(k){k=new DOMEvent(k,j.getWindow());if(d.call(j,k)===false){k.stop();}};}this.addListener(g,e,arguments[2]); +}i[f].values.push(e);return this;},removeEvent:function(e,d){var c=this.retrieve("events");if(!c||!c[e]){return this;}var h=c[e];var b=h.keys.indexOf(d); +if(b==-1){return this;}var g=h.values[b];delete h.keys[b];delete h.values[b];var f=Element.Events[e];if(f){if(f.onRemove){f.onRemove.call(this,d,e);}if(f.base){e=Function.from(f.base).call(this,e); +}}return(Element.NativeEvents[e])?this.removeListener(e,g,arguments[2]):this;},addEvents:function(b){for(var c in b){this.addEvent(c,b[c]);}return this; +},removeEvents:function(b){var d;if(typeOf(b)=="object"){for(d in b){this.removeEvent(d,b[d]);}return this;}var c=this.retrieve("events");if(!c){return this; +}if(!b){for(d in c){this.removeEvents(d);}this.eliminate("events");}else{if(c[b]){c[b].keys.each(function(e){this.removeEvent(b,e);},this);delete c[b]; +}}return this;},fireEvent:function(e,c,b){var d=this.retrieve("events");if(!d||!d[e]){return this;}c=Array.from(c);d[e].keys.each(function(f){if(b){f.delay(b,this,c); +}else{f.apply(this,c);}},this);return this;},cloneEvents:function(e,d){e=document.id(e);var c=e.retrieve("events");if(!c){return this;}if(!d){for(var b in c){this.cloneEvents(e,b); +}}else{if(c[d]){c[d].keys.each(function(f){this.addEvent(d,f);},this);}}return this;}});Element.NativeEvents={click:2,dblclick:2,mouseup:2,mousedown:2,contextmenu:2,mousewheel:2,DOMMouseScroll:2,mouseover:2,mouseout:2,mousemove:2,selectstart:2,selectend:2,keydown:2,keypress:2,keyup:2,orientationchange:2,touchstart:2,touchmove:2,touchend:2,touchcancel:2,gesturestart:2,gesturechange:2,gestureend:2,focus:2,blur:2,change:2,reset:2,select:2,submit:2,paste:2,input:2,load:2,unload:1,beforeunload:2,resize:1,move:1,DOMContentLoaded:1,readystatechange:1,error:1,abort:1,scroll:1}; +var a=function(b){var c=b.relatedTarget;if(c==null){return true;}if(!c){return false;}return(c!=this&&c.prefix!="xul"&&typeOf(this)!="document"&&!this.contains(c)); +};Element.Events={mouseenter:{base:"mouseover",condition:a},mouseleave:{base:"mouseout",condition:a},mousewheel:{base:(Browser.firefox)?"DOMMouseScroll":"mousewheel"}}; +if(!window.addEventListener){Element.NativeEvents.propertychange=2;Element.Events.change={base:function(){var b=this.type;return(this.get("tag")=="input"&&(b=="radio"||b=="checkbox"))?"propertychange":"change"; +},condition:function(b){return !!(this.type!="radio"||this.checked);}};}Element.Events=new Hash(Element.Events);})();(function(){var c=!!window.addEventListener; +Element.NativeEvents.focusin=Element.NativeEvents.focusout=2;var k=function(l,m,n,o,p){while(p&&p!=l){if(m(p,o)){return n.call(p,o,p);}p=document.id(p.parentNode); +}};var a={mouseenter:{base:"mouseover"},mouseleave:{base:"mouseout"},focus:{base:"focus"+(c?"":"in"),capture:true},blur:{base:c?"blur":"focusout",capture:true}}; +var b="$delegation:";var i=function(l){return{base:"focusin",remove:function(m,o){var p=m.retrieve(b+l+"listeners",{})[o];if(p&&p.forms){for(var n=p.forms.length; +n--;){p.forms[n].removeEvent(l,p.fns[n]);}}},listen:function(x,r,v,n,t,s){var o=(t.get("tag")=="form")?t:n.target.getParent("form");if(!o){return;}var u=x.retrieve(b+l+"listeners",{}),p=u[s]||{forms:[],fns:[]},m=p.forms,w=p.fns; +if(m.indexOf(o)!=-1){return;}m.push(o);var q=function(y){k(x,r,v,y,t);};o.addEvent(l,q);w.push(q);u[s]=p;x.store(b+l+"listeners",u);}};};var d=function(l){return{base:"focusin",listen:function(m,n,p,q,r){var o={blur:function(){this.removeEvents(o); +}};o[l]=function(s){k(m,n,p,s,r);};q.target.addEvents(o);}};};if(!c){Object.append(a,{submit:i("submit"),reset:i("reset"),change:d("change"),select:d("select")}); +}var h=Element.prototype,f=h.addEvent,j=h.removeEvent;var e=function(l,m){return function(r,q,n){if(r.indexOf(":relay")==-1){return l.call(this,r,q,n); +}var o=Slick.parse(r).expressions[0][0];if(o.pseudos[0].key!="relay"){return l.call(this,r,q,n);}var p=o.tag;o.pseudos.slice(1).each(function(s){p+=":"+s.key+(s.value?"("+s.value+")":""); +});l.call(this,r,q);return m.call(this,p,o.pseudos[0].value,q);};};var g={addEvent:function(v,q,x){var t=this.retrieve("$delegates",{}),r=t[v];if(r){for(var y in r){if(r[y].fn==x&&r[y].match==q){return this; +}}}var p=v,u=q,o=x,n=a[v]||{};v=n.base||p;q=function(B){return Slick.match(B,u);};var w=Element.Events[p];if(w&&w.condition){var l=q,m=w.condition;q=function(C,B){return l(C,B)&&m.call(C,B,v); +};}var z=this,s=String.uniqueID();var A=n.listen?function(B,C){if(!C&&B&&B.target){C=B.target;}if(C){n.listen(z,q,x,B,C,s);}}:function(B,C){if(!C&&B&&B.target){C=B.target; +}if(C){k(z,q,x,B,C);}};if(!r){r={};}r[s]={match:u,fn:o,delegator:A};t[p]=r;return f.call(this,v,A,n.capture);},removeEvent:function(r,n,t,u){var q=this.retrieve("$delegates",{}),p=q[r]; +if(!p){return this;}if(u){var m=r,w=p[u].delegator,l=a[r]||{};r=l.base||m;if(l.remove){l.remove(this,u);}delete p[u];q[m]=p;return j.call(this,r,w);}var o,v; +if(t){for(o in p){v=p[o];if(v.match==n&&v.fn==t){return g.removeEvent.call(this,r,n,t,o);}}}else{for(o in p){v=p[o];if(v.match==n){g.removeEvent.call(this,r,n,v.fn,o); +}}}return this;}};[Element,Window,Document].invoke("implement",{addEvent:e(f,g.addEvent),removeEvent:e(j,g.removeEvent)});})();(function(){var h=document.createElement("div"),e=document.createElement("div"); +h.style.height="0";h.appendChild(e);var d=(e.offsetParent===h);h=e=null;var l=function(m){return k(m,"position")!="static"||a(m);};var i=function(m){return l(m)||(/^(?:table|td|th)$/i).test(m.tagName); +};Element.implement({scrollTo:function(m,n){if(a(this)){this.getWindow().scrollTo(m,n);}else{this.scrollLeft=m;this.scrollTop=n;}return this;},getSize:function(){if(a(this)){return this.getWindow().getSize(); +}return{x:this.offsetWidth,y:this.offsetHeight};},getScrollSize:function(){if(a(this)){return this.getWindow().getScrollSize();}return{x:this.scrollWidth,y:this.scrollHeight}; +},getScroll:function(){if(a(this)){return this.getWindow().getScroll();}return{x:this.scrollLeft,y:this.scrollTop};},getScrolls:function(){var n=this.parentNode,m={x:0,y:0}; +while(n&&!a(n)){m.x+=n.scrollLeft;m.y+=n.scrollTop;n=n.parentNode;}return m;},getOffsetParent:d?function(){var m=this;if(a(m)||k(m,"position")=="fixed"){return null; +}var n=(k(m,"position")=="static")?i:l;while((m=m.parentNode)){if(n(m)){return m;}}return null;}:function(){var m=this;if(a(m)||k(m,"position")=="fixed"){return null; +}try{return m.offsetParent;}catch(n){}return null;},getOffsets:function(){if(this.getBoundingClientRect&&!Browser.Platform.ios){var r=this.getBoundingClientRect(),o=document.id(this.getDocument().documentElement),q=o.getScroll(),t=this.getScrolls(),s=(k(this,"position")=="fixed"); +return{x:r.left.toInt()+t.x+((s)?0:q.x)-o.clientLeft,y:r.top.toInt()+t.y+((s)?0:q.y)-o.clientTop};}var n=this,m={x:0,y:0};if(a(this)){return m;}while(n&&!a(n)){m.x+=n.offsetLeft; +m.y+=n.offsetTop;if(Browser.firefox){if(!c(n)){m.x+=b(n);m.y+=g(n);}var p=n.parentNode;if(p&&k(p,"overflow")!="visible"){m.x+=b(p);m.y+=g(p);}}else{if(n!=this&&Browser.safari){m.x+=b(n); +m.y+=g(n);}}n=n.offsetParent;}if(Browser.firefox&&!c(this)){m.x-=b(this);m.y-=g(this);}return m;},getPosition:function(p){var q=this.getOffsets(),n=this.getScrolls(); +var m={x:q.x-n.x,y:q.y-n.y};if(p&&(p=document.id(p))){var o=p.getPosition();return{x:m.x-o.x-b(p),y:m.y-o.y-g(p)};}return m;},getCoordinates:function(o){if(a(this)){return this.getWindow().getCoordinates(); +}var m=this.getPosition(o),n=this.getSize();var p={left:m.x,top:m.y,width:n.x,height:n.y};p.right=p.left+p.width;p.bottom=p.top+p.height;return p;},computePosition:function(m){return{left:m.x-j(this,"margin-left"),top:m.y-j(this,"margin-top")}; +},setPosition:function(m){return this.setStyles(this.computePosition(m));}});[Document,Window].invoke("implement",{getSize:function(){var m=f(this);return{x:m.clientWidth,y:m.clientHeight}; +},getScroll:function(){var n=this.getWindow(),m=f(this);return{x:n.pageXOffset||m.scrollLeft,y:n.pageYOffset||m.scrollTop};},getScrollSize:function(){var o=f(this),n=this.getSize(),m=this.getDocument().body; +return{x:Math.max(o.scrollWidth,m.scrollWidth,n.x),y:Math.max(o.scrollHeight,m.scrollHeight,n.y)};},getPosition:function(){return{x:0,y:0};},getCoordinates:function(){var m=this.getSize(); +return{top:0,left:0,bottom:m.y,right:m.x,height:m.y,width:m.x};}});var k=Element.getComputedStyle;function j(m,n){return k(m,n).toInt()||0;}function c(m){return k(m,"-moz-box-sizing")=="border-box"; +}function g(m){return j(m,"border-top-width");}function b(m){return j(m,"border-left-width");}function a(m){return(/^(?:body|html)$/i).test(m.tagName); +}function f(m){var n=m.getDocument();return(!n.compatMode||n.compatMode=="CSS1Compat")?n.html:n.body;}})();Element.alias({position:"setPosition"});[Window,Document,Element].invoke("implement",{getHeight:function(){return this.getSize().y; +},getWidth:function(){return this.getSize().x;},getScrollTop:function(){return this.getScroll().y;},getScrollLeft:function(){return this.getScroll().x; +},getScrollHeight:function(){return this.getScrollSize().y;},getScrollWidth:function(){return this.getScrollSize().x;},getTop:function(){return this.getPosition().y; +},getLeft:function(){return this.getPosition().x;}});(function(){var f=this.Fx=new Class({Implements:[Chain,Events,Options],options:{fps:60,unit:false,duration:500,frames:null,frameSkip:true,link:"ignore"},initialize:function(g){this.subject=this.subject||this; +this.setOptions(g);},getTransition:function(){return function(g){return -(Math.cos(Math.PI*g)-1)/2;};},step:function(g){if(this.options.frameSkip){var h=(this.time!=null)?(g-this.time):0,i=h/this.frameInterval; +this.time=g;this.frame+=i;}else{this.frame++;}if(this.frame=(7-4*d)/11){e=c*c-Math.pow((11-6*d-11*f)/4,2);break;}}return e;},Elastic:function(b,a){return Math.pow(2,10*--b)*Math.cos(20*b*Math.PI*(a&&a[0]||1)/3); +}});["Quad","Cubic","Quart","Quint"].each(function(b,a){Fx.Transitions[b]=new Fx.Transition(function(c){return Math.pow(c,a+2);});});(function(){var d=function(){},a=("onprogress" in new Browser.Request); +var c=this.Request=new Class({Implements:[Chain,Events,Options],options:{url:"",data:"",headers:{"X-Requested-With":"XMLHttpRequest",Accept:"text/javascript, text/html, application/xml, text/xml, */*"},async:true,format:false,method:"post",link:"ignore",isSuccess:null,emulation:true,urlEncoded:true,encoding:"utf-8",evalScripts:false,evalResponse:false,timeout:0,noCache:false},initialize:function(e){this.xhr=new Browser.Request(); +this.setOptions(e);this.headers=this.options.headers;},onStateChange:function(){var e=this.xhr;if(e.readyState!=4||!this.running){return;}this.running=false; +this.status=0;Function.attempt(function(){var f=e.status;this.status=(f==1223)?204:f;}.bind(this));e.onreadystatechange=d;if(a){e.onprogress=e.onloadstart=d; +}clearTimeout(this.timer);this.response={text:this.xhr.responseText||"",xml:this.xhr.responseXML};if(this.options.isSuccess.call(this,this.status)){this.success(this.response.text,this.response.xml); +}else{this.failure();}},isSuccess:function(){var e=this.status;return(e>=200&&e<300);},isRunning:function(){return !!this.running;},processScripts:function(e){if(this.options.evalResponse||(/(ecma|java)script/).test(this.getHeader("Content-type"))){return Browser.exec(e); +}return e.stripScripts(this.options.evalScripts);},success:function(f,e){this.onSuccess(this.processScripts(f),e);},onSuccess:function(){this.fireEvent("complete",arguments).fireEvent("success",arguments).callChain(); +},failure:function(){this.onFailure();},onFailure:function(){this.fireEvent("complete").fireEvent("failure",this.xhr);},loadstart:function(e){this.fireEvent("loadstart",[e,this.xhr]); +},progress:function(e){this.fireEvent("progress",[e,this.xhr]);},timeout:function(){this.fireEvent("timeout",this.xhr);},setHeader:function(e,f){this.headers[e]=f; +return this;},getHeader:function(e){return Function.attempt(function(){return this.xhr.getResponseHeader(e);}.bind(this));},check:function(){if(!this.running){return true; +}switch(this.options.link){case"cancel":this.cancel();return true;case"chain":this.chain(this.caller.pass(arguments,this));return false;}return false;},send:function(o){if(!this.check(o)){return this; +}this.options.isSuccess=this.options.isSuccess||this.isSuccess;this.running=true;var l=typeOf(o);if(l=="string"||l=="element"){o={data:o};}var h=this.options; +o=Object.append({data:h.data,url:h.url,method:h.method},o);var j=o.data,f=String(o.url),e=o.method.toLowerCase();switch(typeOf(j)){case"element":j=document.id(j).toQueryString(); +break;case"object":case"hash":j=Object.toQueryString(j);}if(this.options.format){var m="format="+this.options.format;j=(j)?m+"&"+j:m;}if(this.options.emulation&&!["get","post"].contains(e)){var k="_method="+e; +j=(j)?k+"&"+j:k;e="post";}if(this.options.urlEncoded&&["post","put"].contains(e)){var g=(this.options.encoding)?"; charset="+this.options.encoding:"";this.headers["Content-type"]="application/x-www-form-urlencoded"+g; +}if(!f){f=document.location.pathname;}var i=f.lastIndexOf("/");if(i>-1&&(i=f.indexOf("#"))>-1){f=f.substr(0,i);}if(this.options.noCache){f+=(f.contains("?")?"&":"?")+String.uniqueID(); +}if(j&&e=="get"){f+=(f.contains("?")?"&":"?")+j;j=null;}var n=this.xhr;if(a){n.onloadstart=this.loadstart.bind(this);n.onprogress=this.progress.bind(this); +}n.open(e.toUpperCase(),f,this.options.async,this.options.user,this.options.password);if(this.options.user&&"withCredentials" in n){n.withCredentials=true; +}n.onreadystatechange=this.onStateChange.bind(this);Object.each(this.headers,function(q,p){try{n.setRequestHeader(p,q);}catch(r){this.fireEvent("exception",[p,q]); +}},this);this.fireEvent("request");n.send(j);if(!this.options.async){this.onStateChange();}if(this.options.timeout){this.timer=this.timeout.delay(this.options.timeout,this); +}return this;},cancel:function(){if(!this.running){return this;}this.running=false;var e=this.xhr;e.abort();clearTimeout(this.timer);e.onreadystatechange=d; +if(a){e.onprogress=e.onloadstart=d;}this.xhr=new Browser.Request();this.fireEvent("cancel");return this;}});var b={};["get","post","put","delete","GET","POST","PUT","DELETE"].each(function(e){b[e]=function(g){var f={method:e}; +if(g!=null){f.data=g;}return this.send(f);};});c.implement(b);Element.Properties.send={set:function(e){var f=this.get("send").cancel();f.setOptions(e); +return this;},get:function(){var e=this.retrieve("send");if(!e){e=new c({data:this,link:"cancel",method:this.get("method")||"post",url:this.get("action")}); +this.store("send",e);}return e;}};Element.implement({send:function(e){var f=this.get("send");f.send({data:this,url:e||f.options.url});return this;}});})(); +Request.HTML=new Class({Extends:Request,options:{update:false,append:false,evalScripts:true,filter:false,headers:{Accept:"text/html, application/xml, text/xml, */*"}},success:function(f){var e=this.options,c=this.response; +c.html=f.stripScripts(function(h){c.javascript=h;});var d=c.html.match(/]*>([\s\S]*?)<\/body>/i);if(d){c.html=d[1];}var b=new Element("div").set("html",c.html); +c.tree=b.childNodes;c.elements=b.getElements(e.filter||"*");if(e.filter){c.tree=c.elements;}if(e.update){var g=document.id(e.update).empty();if(e.filter){g.adopt(c.elements); +}else{g.set("html",c.html);}}else{if(e.append){var a=document.id(e.append);if(e.filter){c.elements.reverse().inject(a);}else{a.adopt(b.getChildren());}}}if(e.evalScripts){Browser.exec(c.javascript); +}this.onSuccess(c.tree,c.elements,c.html,c.javascript);}});Element.Properties.load={set:function(a){var b=this.get("load").cancel();b.setOptions(a);return this; +},get:function(){var a=this.retrieve("load");if(!a){a=new Request.HTML({data:this,link:"cancel",update:this,method:"get"});this.store("load",a);}return a; +}};Element.implement({load:function(){this.get("load").send(Array.link(arguments,{data:Type.isObject,url:Type.isString}));return this;}});if(typeof JSON=="undefined"){this.JSON={}; +}JSON=new Hash({stringify:JSON.stringify,parse:JSON.parse});(function(){var special={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"}; +var escape=function(chr){return special[chr]||"\\u"+("0000"+chr.charCodeAt(0).toString(16)).slice(-4);};JSON.validate=function(string){string=string.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""); +return(/^[\],:{}\s]*$/).test(string);};JSON.encode=JSON.stringify?function(obj){return JSON.stringify(obj);}:function(obj){if(obj&&obj.toJSON){obj=obj.toJSON(); +}switch(typeOf(obj)){case"string":return'"'+obj.replace(/[\x00-\x1f\\"]/g,escape)+'"';case"array":return"["+obj.map(JSON.encode).clean()+"]";case"object":case"hash":var string=[]; +Object.each(obj,function(value,key){var json=JSON.encode(value);if(json){string.push(JSON.encode(key)+":"+json);}});return"{"+string+"}";case"number":case"boolean":return""+obj; +case"null":return"null";}return null;};JSON.decode=function(string,secure){if(!string||typeOf(string)!="string"){return null;}if(secure||JSON.secure){if(JSON.parse){return JSON.parse(string); +}if(!JSON.validate(string)){throw new Error("JSON could not decode the input; security is enabled and the value is not secure.");}}return eval("("+string+")"); +};})();Request.JSON=new Class({Extends:Request,options:{secure:true},initialize:function(a){this.parent(a);Object.append(this.headers,{Accept:"application/json","X-Request":"JSON"}); +},success:function(c){var b;try{b=this.response.json=JSON.decode(c,this.options.secure);}catch(a){this.fireEvent("error",[c,a]);return;}if(b==null){this.onFailure(); +}else{this.onSuccess(b,c);}}});var Cookie=new Class({Implements:Options,options:{path:"/",domain:false,duration:false,secure:false,document:document,encode:true},initialize:function(b,a){this.key=b; +this.setOptions(a);},write:function(b){if(this.options.encode){b=encodeURIComponent(b);}if(this.options.domain){b+="; domain="+this.options.domain;}if(this.options.path){b+="; path="+this.options.path; +}if(this.options.duration){var a=new Date();a.setTime(a.getTime()+this.options.duration*24*60*60*1000);b+="; expires="+a.toGMTString();}if(this.options.secure){b+="; secure"; +}this.options.document.cookie=this.key+"="+b;return this;},read:function(){var a=this.options.document.cookie.match("(?:^|;)\\s*"+this.key.escapeRegExp()+"=([^;]*)"); +return(a)?decodeURIComponent(a[1]):null;},dispose:function(){new Cookie(this.key,Object.merge({},this.options,{duration:-1})).write("");return this;}}); +Cookie.write=function(b,c,a){return new Cookie(b,a).write(c);};Cookie.read=function(a){return new Cookie(a).read();};Cookie.dispose=function(b,a){return new Cookie(b,a).dispose(); +};(function(i,k){var l,f,e=[],c,b,d=k.createElement("div");var g=function(){clearTimeout(b);if(l){return;}Browser.loaded=l=true;k.removeListener("DOMContentLoaded",g).removeListener("readystatechange",a); +k.fireEvent("domready");i.fireEvent("domready");};var a=function(){for(var m=e.length;m--;){if(e[m]()){g();return true;}}return false;};var j=function(){clearTimeout(b); +if(!a()){b=setTimeout(j,10);}};k.addListener("DOMContentLoaded",g);var h=function(){try{d.doScroll();return true;}catch(m){}return false;};if(d.doScroll&&!h()){e.push(h); +c=true;}if(k.readyState){e.push(function(){var m=k.readyState;return(m=="loaded"||m=="complete");});}if("onreadystatechange" in k){k.addListener("readystatechange",a); +}else{c=true;}if(c){j();}Element.Events.domready={onAdd:function(m){if(l){m.call(this);}}};Element.Events.load={base:"load",onAdd:function(m){if(f&&this==i){m.call(this); +}},condition:function(){if(this==i){g();delete Element.Events.load;}return true;}};i.addEvent("load",function(){f=true;});})(window,document);(function(){var Swiff=this.Swiff=new Class({Implements:Options,options:{id:null,height:1,width:1,container:null,properties:{},params:{quality:"high",allowScriptAccess:"always",wMode:"window",swLiveConnect:true},callBacks:{},vars:{}},toElement:function(){return this.object; +},initialize:function(path,options){this.instance="Swiff_"+String.uniqueID();this.setOptions(options);options=this.options;var id=this.id=options.id||this.instance; +var container=document.id(options.container);Swiff.CallBacks[this.instance]={};var params=options.params,vars=options.vars,callBacks=options.callBacks; +var properties=Object.append({height:options.height,width:options.width},options.properties);var self=this;for(var callBack in callBacks){Swiff.CallBacks[this.instance][callBack]=(function(option){return function(){return option.apply(self.object,arguments); +};})(callBacks[callBack]);vars[callBack]="Swiff.CallBacks."+this.instance+"."+callBack;}params.flashVars=Object.toQueryString(vars);if(Browser.ie){properties.classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"; +params.movie=path;}else{properties.type="application/x-shockwave-flash";}properties.data=path;var build='';}}build+="";this.object=((container)?container.empty():new Element("div")).set("html",build).firstChild; +},replaces:function(element){element=document.id(element,true);element.parentNode.replaceChild(this.toElement(),element);return this;},inject:function(element){document.id(element,true).appendChild(this.toElement()); +return this;},remote:function(){return Swiff.remote.apply(Swiff,[this.toElement()].append(arguments));}});Swiff.CallBacks={};Swiff.remote=function(obj,fn){var rs=obj.CallFunction(''+__flash__argumentsToXML(arguments,2)+""); +return eval(rs);};})(); \ No newline at end of file diff --git a/testcms-final-anon/system/admin/theme/assets/js/popup.js b/testcms-final-anon/system/admin/theme/assets/js/popup.js new file mode 100644 index 0000000..37d76c9 --- /dev/null +++ b/testcms-final-anon/system/admin/theme/assets/js/popup.js @@ -0,0 +1,90 @@ + +var Popup = function() { + + var $id = Number.random(100, 1000); + + var overlay = new Element('div', { + 'id': 'popup_overlay_' + $id, + 'class': 'popup_overlay' + }); + + var box = new Element('div', { + 'id': 'popup_box_' + $id, + 'class': 'popup_box', + 'styles': { + 'opacity': 0 + } + }); + + var position = function() { + var body = $$('body').pop(), + offset = body.getScroll(), + screen = body.getScrollSize(), + size = box.getSize(); + + return { + 'left': (screen.x / 2) - (size.x / 2), + 'top': offset.y + 50 + }; + }; + + var open = function() { + var body = $$('body'), options = arguments[0] || {}; + + // default options + var defaults = { + 'content': new Element('p'), + 'handle': false, + 'width': 600 + } + + for(var key in defaults) { + options[key] = (options[key] === undefined) ? defaults[key] : options[key]; + } + + // append overlay + body.grab(overlay); + + // apply box styles + box.setStyles({ + 'width': options.width + }); + + // append box + body.grab(box); + + // add content + box.empty(); + box.grab(options.content); + + // position box and show + var pos = position(); + + box.setStyles({ + 'top': pos.top, + 'left': pos.left + }); + + box.fade('in'); + + // bind events + overlay.addEvent('click', close); + + if(options.handle.addEvent) { + options.handle.addEvent('click', close); + } + }; + + var close = function() { + overlay.dispose(); + box.dispose(); + return false; + }; + + return { + 'open': open, + 'close': close + }; + +}; + diff --git a/testcms-final-anon/system/admin/theme/assets/js/tabs.js b/testcms-final-anon/system/admin/theme/assets/js/tabs.js new file mode 100644 index 0000000..49ddc84 --- /dev/null +++ b/testcms-final-anon/system/admin/theme/assets/js/tabs.js @@ -0,0 +1,34 @@ +(function() { + var hide = function() { + $$('.tab').setStyles({ + 'display': 'none' + }); + + $$('.tabs a').removeClass('active'); + }; + + var show = function(id) { + $$('[data-tab=' + id + ']').setStyles({ + 'display': 'block' + }); + + $$('a[href$=#' + id + ']').addClass('active'); + }; + + var tab = function() { + var id = this.get('href').split('#').pop(); + + hide(); + show(id); + }; + + // hide all + hide(); + + // show first + var hash = window.location.hash, first = hash.length ? hash.split('#').pop() : 'post'; + show(first); + + // bind to menu + $$('.tabs a').addEvent('click', tab); +}()); \ No newline at end of file diff --git a/testcms-final-anon/system/admin/theme/error_500.php b/testcms-final-anon/system/admin/theme/error_500.php new file mode 100644 index 0000000..eed38ea --- /dev/null +++ b/testcms-final-anon/system/admin/theme/error_500.php @@ -0,0 +1,29 @@ + + + + + 500 - Internal Server Error + + + + +

Internal Server Error

+ +

An error occured while we were processing your request.

+ + diff --git a/testcms-final-anon/system/admin/theme/error_config.php b/testcms-final-anon/system/admin/theme/error_config.php new file mode 100644 index 0000000..ef33814 --- /dev/null +++ b/testcms-final-anon/system/admin/theme/error_config.php @@ -0,0 +1,38 @@ + + + + + Missing config file + + + + +

It looks like the config file is missing or unreadable.

+ +

Run the installer

+ + diff --git a/testcms-final-anon/system/admin/theme/error_php.php b/testcms-final-anon/system/admin/theme/error_php.php new file mode 100644 index 0000000..98ed703 --- /dev/null +++ b/testcms-final-anon/system/admin/theme/error_php.php @@ -0,0 +1,71 @@ + + + + + Error + + + + +

Unhandled Exception

+ +
+

Message:

+ in on line . +
+ +
+

Stack Trace:

+ +
+
+ +
+

Context:

+ + + $context): ?> +
+ + + Context unavailable. + +
+ +
+

Additional information

+ +
    +
  • PHP Version:
  • +
  • Operating System:
  • +
  • Server Software:
  • +
  • User Agent:
  • +
  • Request Uri:
  • +
+
+ + diff --git a/testcms-final-anon/system/admin/theme/functions.php b/testcms-final-anon/system/admin/theme/functions.php new file mode 100644 index 0000000..6504d17 --- /dev/null +++ b/testcms-final-anon/system/admin/theme/functions.php @@ -0,0 +1,127 @@ + $prefix . '/posts', + 'Pages' => $prefix . '/pages', + 'Users' => $prefix . '/users', + 'Metadata' => $prefix . '/metadata' + ); + + return $pages; +} + +/** + Custom fields +*/ +function parse_fields($str) { + $data = json_decode($str, true); + return is_array($data) ? $data : array(); +} + +/** + Url helpers +*/ +function theme_url($file = '') { + return Config::get('application.base_url') . 'system/admin/theme/' . ltrim($file, '/'); +} + +function admin_url($url = '') { + return Url::make(Config::get('application.admin_folder') . '/' . ltrim($url, '/')); +} + +/** + String helpers +*/ +function pluralise($amount, $str, $alt = '') { + return $amount === 1 ? $str : $str . ($alt !== '' ? $alt : 's'); +} + +function truncate($str, $limit = 10, $elipse = ' [...]') { + $words = preg_split('/\s+/', $str); + + if(count($words) <= $limit) { + return $str; + } + + return implode(' ', array_slice($words, 0, $limit)) . $elipse; +} + +/** + Error checking +*/ +function latest_version() { + // check we have curl support + if(Curl::support() === false) { + return 0; + } + + // only run the version check once per session + if(($version = Session::get('latest_version')) === false) { + // returns plain text string with version number or 0 on failure. + $version = "0.6"; + Session::set('latest_version', $version); + } + + return $version; +} + +function error_check() { + $errors = array(); + + // Check for older versions + if(version_compare(VERSION, ($version = latest_version()), '<')) { + $errors[] = 'Your version of Test CMS is out of date. Please download the latest version.'; + } + + // do something useful with it + return count($errors) ? $errors : false; +} + +/** + Benchmarking +*/ +function execution_time() { + $miliseconds = microtime(true) - START; + return round($miliseconds, 4); +} + +// return in mb +function memory_usage() { + return memory_get_peak_usage(true) / 1024; +} + +// database profile information +function db_profile() { + // total query time + $total = 0; + + $html = ''; + $html .= ''; + $html .= ''; + + $html .= ''; + + foreach(Db::profile() as $row) { + $html .= ''; + $total += $row['time']; + } + + $html .= ''; + + $html .= ''; + $html .= ''; + $html .= ''; + $html .= ''; + $html .= ''; + + $html .= '
SQLBindingsRowsTime
' . $row['sql'] . '' . implode(', ', $row['binds']) . '' . $row['rows'] . '' . $row['time'] . '
Query Time' . round($total, 4) . '
Execution Time' . execution_time() . '
Memory Usage' . memory_usage() . 'Kb
'; + + return $html; +} diff --git a/testcms-final-anon/system/admin/theme/includes/footer.php b/testcms-final-anon/system/admin/theme/includes/footer.php new file mode 100644 index 0000000..ad4749b --- /dev/null +++ b/testcms-final-anon/system/admin/theme/includes/footer.php @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + diff --git a/testcms-final-anon/system/admin/theme/includes/header.php b/testcms-final-anon/system/admin/theme/includes/header.php new file mode 100644 index 0000000..e1e9d46 --- /dev/null +++ b/testcms-final-anon/system/admin/theme/includes/header.php @@ -0,0 +1,32 @@ + + + + + Manage <?php echo Config::get('metadata.sitename'); ?> + + + + + + +
+ + + + + +

Logged in as real_name; ?>. + Logout + +

+ diff --git a/testcms-final-anon/system/admin/theme/metadata/index.php b/testcms-final-anon/system/admin/theme/metadata/index.php new file mode 100644 index 0000000..1f54bc0 --- /dev/null +++ b/testcms-final-anon/system/admin/theme/metadata/index.php @@ -0,0 +1,107 @@ +

Site metadata

+ + + +
+ +
+
+

+ + + + Your site’s name. +

+ +

+ + + + A short paragraph to describe your site. +

+ +

+ + + + Your current home page. +

+ +

+ + + + Your page that will show your posts. +

+ +

+ + + + The number of posts to display per page. +

+ +

+ + + + Your current theme. +

+ +

+ + auto_published_comments) ? ' checked' : ''; ?> + > +

+ +

+ + + + Your twitter account. Displayed as @twitter; ?>. +

+
+ +

+ +

+
+ +
+ + + + + + diff --git a/testcms-final-anon/system/admin/theme/pages/add.php b/testcms-final-anon/system/admin/theme/pages/add.php new file mode 100644 index 0000000..63b0d12 --- /dev/null +++ b/testcms-final-anon/system/admin/theme/pages/add.php @@ -0,0 +1,77 @@ + +

Add a Page

+ + + +
+ +
+
+

+ + + + The name of your page. This gets shown in the navigation. +

+ +

+ + + + The title of your page, which gets shown in the <title>. +

+ +

+ + + + The slug for your post (/slug). +

+ +

+ + + + Your page's content. Accepts valid HTML. +

+ +

+ + + + Do you want your page to be live (published), pending (draft), or hidden (archived)? +

+
+ +

+ + Return to pages +

+
+ +
+ + + + + + + + + diff --git a/testcms-final-anon/system/admin/theme/pages/edit.php b/testcms-final-anon/system/admin/theme/pages/edit.php new file mode 100644 index 0000000..7e61f30 --- /dev/null +++ b/testcms-final-anon/system/admin/theme/pages/edit.php @@ -0,0 +1,89 @@ +

Editing “name, 4); ?>”

+ + + +
+ +
+
+

+ + + + The name of your page. This gets shown in the navigation. +

+ +

+ + + + The title of your page, which gets shown in the <title>. +

+ +

+ + + + The slug for your page (slug). +

+ +

+ + + + Your page's content. Accepts valid HTML. +

+ +

+ + + + Do you want your page to be live (published), pending (draft), or hidden (archived)? +

+
+ +

+ + + id, array(Config::get('metadata.home_page'), Config::get('metadata.posts_page'))) === false): ?> + + + + Return to pages +

+
+ +
+ + + + + + + + diff --git a/testcms-final-anon/system/admin/theme/pages/index.php b/testcms-final-anon/system/admin/theme/pages/index.php new file mode 100644 index 0000000..4fabbbd --- /dev/null +++ b/testcms-final-anon/system/admin/theme/pages/index.php @@ -0,0 +1,20 @@ +

Pages Create a new page

+ + + +
+ length()): ?> + + +

No pages just yet. Why not write a new one?

+ +
diff --git a/testcms-final-anon/system/admin/theme/posts/add.php b/testcms-final-anon/system/admin/theme/posts/add.php new file mode 100644 index 0000000..cc16c58 --- /dev/null +++ b/testcms-final-anon/system/admin/theme/posts/add.php @@ -0,0 +1,136 @@ + +

Add a Post

+ + + +
+ +
+
+ +
+

+ + + + Your post’s title. +

+ +

+ + + + The slug for your post (slug). +

+ +

+ + + + A brief outline of what your post is about. Used in the post introduction, RSS feed, and <meta name="description" />. +

+ +

+ + + + Your post's main content. Enjoys a healthy dose of valid HTML. +

+ +

+ + + + Statuses: live (published), pending (draft), or hidden (archived). +

+ +

+ + > + This will allow users to comment on your posts. +

+
+ +
+
+ +
+ Customise + Here, you can customise your posts. This section is optional. + +

+ + + + Custom CSS. Will be wrapped in a <style> block. +

+ +

+ + + + Custom Javascript. Will be wrapped in a <script> block. +

+
+ +
+
+ +
+ Custom fields + Create custom fields here. + +
+ + $value): ?> + +

+ + +

+ +
+
+ + +
+ +

+ + Return to posts +

+
+ +
+ + + + + + + + \ No newline at end of file diff --git a/testcms-final-anon/system/admin/theme/posts/edit.php b/testcms-final-anon/system/admin/theme/posts/edit.php new file mode 100644 index 0000000..958f8d7 --- /dev/null +++ b/testcms-final-anon/system/admin/theme/posts/edit.php @@ -0,0 +1,197 @@ + +

Editing “title, 4); ?>”

+ + + +
+ +
+ +
+ +
+

+ + + + Your post’s title. +

+ +

+ + + + The slug for your post (slug). +

+ +

+ + + + A brief outline of what your post is about. Used in the post introduction, RSS feed, and <meta name="description" />. +

+ +

+ + + + Your post's main content. Enjoys a healthy dose of valid HTML. +

+ +

+ + + + Statuses: live (published), pending (draft), or hidden (archived). +

+ +

+ + comments)) echo ' checked'; ?>> + This will allow users to comment on your posts. +

+
+ +
+
+ +
+ Customise + Here, you can customise your posts. This section is optional. + +

+ + + + Custom CSS. Will be wrapped in a <style> block. +

+ +

+ + + + Custom Javascript. Will be wrapped in a <script> block. +

+
+ +
+
+ +
+ Custom fields + Create custom fields here. + +
+ + custom_fields) as $key => $data): ?> +

+ + +

+ + + + $value): ?> + +

+ + +

+ +
+ + + +
+ +
+
+ +
+ Comments + Here, you can moderate your comments. + + +
    + +
  • +
    +

    name; ?> + date); ?>
    + Status: status; ?>

    +
    + +

    text; ?>

    + + +
  • + +
+ +

No comments yet.

+ +
+ +
+ +

+ + + Return to posts +

+ +
+
+ + + + + + + + + + + \ No newline at end of file diff --git a/testcms-final-anon/system/admin/theme/posts/index.php b/testcms-final-anon/system/admin/theme/posts/index.php new file mode 100644 index 0000000..074239f --- /dev/null +++ b/testcms-final-anon/system/admin/theme/posts/index.php @@ -0,0 +1,23 @@ +

Posts Create a new post

+ + + +
+ length()): ?> + + +

No posts just yet. Why not write a new one?

+ +
diff --git a/testcms-final-anon/system/admin/theme/users/add.php b/testcms-final-anon/system/admin/theme/users/add.php new file mode 100644 index 0000000..4707ecc --- /dev/null +++ b/testcms-final-anon/system/admin/theme/users/add.php @@ -0,0 +1,86 @@ +

Add a new user

+ + + +
+ +
+
+

+ + + + The user’s real name. Used in author bylines (visible to public). +

+ +

+ + + + A short biography for your user. Accepts valid HTML. +

+ +

+ + + + If inactive, the user will not be able to log in. +

+ +

+ + + + The user’s role. See here for more info. +

+
+ +
+ + User details + Create the details for your new user to log in to TestCMS. + +

+ + + + The desired username. Can be changed later. +

+ +

+ + + + And the matching password. Can be changed later. +

+ +

+ + + + The user’s email address. Needed if the user forgets their password. +

+
+ +

+ + Return to users +

+
+ +
+ diff --git a/testcms-final-anon/system/admin/theme/users/amnesia.php b/testcms-final-anon/system/admin/theme/users/amnesia.php new file mode 100644 index 0000000..1686470 --- /dev/null +++ b/testcms-final-anon/system/admin/theme/users/amnesia.php @@ -0,0 +1,23 @@ +

Recover Password

+ + + +
+ +
+
+ +

+ + +

+ +

+ + Back to +

+
+
+ +
+ diff --git a/testcms-final-anon/system/admin/theme/users/edit.php b/testcms-final-anon/system/admin/theme/users/edit.php new file mode 100644 index 0000000..c6f9e99 --- /dev/null +++ b/testcms-final-anon/system/admin/theme/users/edit.php @@ -0,0 +1,89 @@ +

Editing username; ?>’s profile

+ + + +
+ +
+
+

+ + + + The user’s real name. Used in author bylines (visible to public). +

+ +

+ + + + A short biography for your user. Accepts valid HTML. +

+ +

+ + + + If inactive, the user will not be able to log in. +

+ +

+ + + + The user’s role. See here for more info. +

+
+ +
+ + User details + Create the details for your new user to log in to Test CMS. + +

+ + + + The desired username. Can be changed later. +

+ +

+ + + + Leave blank for no change. +

+ +

+ + + + The user’s email address. Needed if the user forgets their password. +

+
+ +

+ + id !== $user->id): ?> + + + + Return to users +

+
+ +
diff --git a/testcms-final-anon/system/admin/theme/users/index.php b/testcms-final-anon/system/admin/theme/users/index.php new file mode 100644 index 0000000..2eded72 --- /dev/null +++ b/testcms-final-anon/system/admin/theme/users/index.php @@ -0,0 +1,18 @@ +

Users Create a new user

+ + + +
+ +
diff --git a/testcms-final-anon/system/admin/theme/users/login.php b/testcms-final-anon/system/admin/theme/users/login.php new file mode 100644 index 0000000..c5c94de --- /dev/null +++ b/testcms-final-anon/system/admin/theme/users/login.php @@ -0,0 +1,29 @@ +

Log in

+ + + +
+ +
+
+ +

+ + +

+ +

+ + + + Forgotten your password? +

+ +

+ + Back to +

+
+
+ +
\ No newline at end of file diff --git a/testcms-final-anon/system/admin/theme/users/reset.php b/testcms-final-anon/system/admin/theme/users/reset.php new file mode 100644 index 0000000..3367907 --- /dev/null +++ b/testcms-final-anon/system/admin/theme/users/reset.php @@ -0,0 +1,24 @@ +

Reset Password

+ + + +
+ +
+
+ Password reset for real_name; ?> + Please enter a new password that you won’t forget this time. + +

+ + +

+ +

+ + Back to +

+
+
+ +
\ No newline at end of file diff --git a/testcms-final-anon/system/bootstrap.php b/testcms-final-anon/system/bootstrap.php new file mode 100644 index 0000000..d4f43e3 --- /dev/null +++ b/testcms-final-anon/system/bootstrap.php @@ -0,0 +1,101 @@ + PATH . 'system/classes/config.php', + 'Error' => PATH . 'system/classes/error.php', + 'Session' => PATH . 'system/classes/session.php', + 'TestCMS' => PATH . 'system/classes/testcms.php', + 'Template' => PATH . 'system/classes/template.php', + 'Request' => PATH . 'system/classes/request.php', + 'Response' => PATH . 'system/classes/response.php', + 'Log' => PATH . 'system/classes/log.php', + 'Db' => PATH . 'system/classes/db.php', + 'IoC' => PATH . 'system/classes/ioc.php', + 'Url' => PATH . 'system/classes/url.php' +)); + +// tell the autoloader where to find classes +Autoloader::directory(array( + PATH . 'system/classes/' +)); + +// register the auto loader +Autoloader::register(); + +/** + Report all errors let our error class decide which to display +*/ +error_reporting(-1); + +/** + Error display will be handled by our error class +*/ +ini_safe_set('display_errors', false); + +/** + Disable magic quotes + note: magic quotes is deprecated in PHP 5.3 + src: php.net/manual/en/security.magicquotes.disabling.php +*/ +if(function_exists('get_magic_quotes_gpc')) { + if(get_magic_quotes_gpc()) { + ini_safe_set('magic_quotes_gpc', false); + ini_safe_set('magic_quotes_runtime', false); + ini_safe_set('magic_quotes_sybase', false); + } +} + +/** + Check our installation +*/ +if(Config::load(PATH . 'config.php') === false) { + // looks like we are missing a config file + echo file_get_contents(PATH . 'system/admin/theme/error_config.php'); + exit(1); +} + +// Register the default timezone for the application. +date_default_timezone_set(Config::get('application.timezone')); + +// Register the PHP exception handler. +set_exception_handler(array('Error', 'exception')); + +// Register the PHP error handler. +set_error_handler(array('Error', 'native')); + +// Register the shutdown handler. +register_shutdown_function(array('Error', 'shutdown')); + +/** + Start session handler +*/ +Session::start(); + +/** + Handle routing +*/ +TestCMS::run(); + +/** + Close and end session +*/ +Session::end(); + +/** + Output awesomeness! +*/ +Response::send(); diff --git a/testcms-final-anon/system/classes/autoload.php b/testcms-final-anon/system/classes/autoload.php new file mode 100644 index 0000000..5893972 --- /dev/null +++ b/testcms-final-anon/system/classes/autoload.php @@ -0,0 +1,67 @@ + $value) { + $keys[] = '`' . $key . '`'; + $values[] = '\'' . $value . '\''; + } + + $sql = "insert into comments (" . implode(', ', $keys) . ") values (" . implode(', ', $values) . ")"; + + Db::query($sql, $args); + + Notifications::set('success', 'Your comment has been sent'); + + return true; + } + + public static function update() { + $post = Input::post(array('id', 'text', 'status')); + $errors = array(); + + if(empty($post['text'])) { + $errors[] = 'Please enter comment text'; + } + + if(count($errors)) { + $output = json_encode(array('result' => false, 'errors' => $errors)); + Response::content($output); + return false; + } + + $id = $post['id']; + unset($post['id']); + + $updates = array(); + $args = array(); + + foreach($post as $key => $value) { + $updates[] = '`' . $key . '` = ?'; + $args[] = $value; + } + + $sql = "update comments set " . implode(', ', $updates) . " where id = ?"; + $args[] = $id; + + Db::query($sql, $args); + + $output = json_encode(array('result' => true)); + Response::content($output); + } + + public static function update_status() { + $post = Input::post(array('id', 'status')); + $errors = array(); + + if(in_array($post['status'], array('published', 'pending', 'spam')) === false) { + $errors[] = 'Invalid comment status'; + } + + if(count($errors)) { + $output = json_encode(array('result' => false, 'errors' => $errors)); + Response::content($output); + return false; + } + + $id = $post['id']; + unset($post['id']); + + $updates = array(); + $args = array(); + + foreach($post as $key => $value) { + $updates[] = '`' . $key . '` = ?'; + $args[] = $value; + } + + $sql = "update comments set " . implode(', ', $updates) . " where id = ?"; + $args[] = $id; + + Db::query($sql, $args); + + $output = json_encode(array('result' => true)); + Response::content($output); + } + + public static function remove() { + $id = Input::post('id'); + + $sql = "delete from comments where id = ?"; + $args = array($id); + + Db::query($sql, $args); + + $output = json_encode(array('result' => true)); + Response::content($output); + } + +} diff --git a/testcms-final-anon/system/classes/config.php b/testcms-final-anon/system/classes/config.php new file mode 100644 index 0000000..c0337d2 --- /dev/null +++ b/testcms-final-anon/system/classes/config.php @@ -0,0 +1,132 @@ + $value) { + $php .= "\t'" . $key . "' => "; + + if(is_array($value)) { + $php .= 'array(' . PHP_EOL; + foreach($value as $k => $v) { + $php .= "\t\t'" . $k . "' => " . static::format($v) . "," .PHP_EOL; + } + $php .= "\t)," . PHP_EOL; + } else { + $php .= static::format($value) . ',' .PHP_EOL; + } + } + + $php .= ');'; + + return file_put_contents(PATH . 'config.php', $php); + } + + public static function format($value) { + if(is_int($value)) { + return $value; + } + if(is_bool($value)) { + return $value ? 'true' : 'false'; + } + if(is_array($value)) { + $var = array_map(function($itm) { + return Config::format($itm); + }, $value); + + return "array(" . implode(",", $var) . ")"; + } + return "'" . (string) $value . "'"; + } + + /* + Set a config item + */ + public static function set($key, $value) { + // array pointer for search + $array =& static::$items; + + $keys = explode('.', $key); + + while(count($keys) > 1) { + $key = array_shift($keys); + + if(!isset($array[$key]) or !is_array($array[$key])) { + $array[$key] = array(); + } + + $array =& $array[$key]; + } + + $array[array_shift($keys)] = $value; + } + + /* + Retrive a config param + */ + public static function get($key = null, $default = false) { + // return all items + if(is_null($key)) return static::$items; + + // copy array for search + $array = static::$items; + + // search array + foreach(explode('.', $key) as $segment) { + if (!is_array($array) or array_key_exists($segment, $array) === false) { + return $default; + } + + $array = $array[$segment]; + } + + return $array; + } + + /* + Remove a config param + */ + public static function forget($key) { + // array pointer for search + $array =& static::$items; + + $keys = explode('.', $key); + + while(count($keys) > 1) { + $key = array_shift($keys); + + if(!isset($array[$key]) or !is_array($array[$key])) { + return; + } + + $array =& $array[$key]; + } + + unset($array[array_shift($keys)]); + } +} diff --git a/testcms-final-anon/system/classes/cookie.php b/testcms-final-anon/system/classes/cookie.php new file mode 100644 index 0000000..923fafd --- /dev/null +++ b/testcms-final-anon/system/classes/cookie.php @@ -0,0 +1,25 @@ +session = curl_init(); + } + + public static function support() { + return function_exists('curl_init'); + } + + public function set_options($options) { + curl_setopt_array($this->session, $options); + } + + public function get_error() { + return $this->error; + } + + public function get_info() { + return $this->info; + } + + public function send() { + if(($response = curl_exec($this->session)) === false) { + $this->error = curl_errno($this->session) . ': ' . curl_error($this->session); + } + + $this->info = curl_getinfo($this->session); + + return $response; + } + + public function close() { + curl_close($this->session); + } + + public static function post($url, $data = array(), $headers = array()) { + $session = new static; + + $options = array( + CURLOPT_URL => $url, + CURLOPT_POST => true, + CURLOPT_POSTFIELDS => http_build_query($data), + CURLOPT_HEADER => false, + CURLOPT_RETURNTRANSFER => true + ); + + if(count($headers)) { + $options[CURLOPT_HTTPHEADER] = $headers; + } + + $session->set_options($options); + + $response = $session->send(); + + $session->close(); + + return $response; + } + + public static function get($url, $headers = array()) { + $session = new static; + + $options = array( + CURLOPT_URL => $url, + CURLOPT_HEADER => false, + CURLOPT_RETURNTRANSFER => true + ); + + if(count($headers)) { + $options[CURLOPT_HTTPHEADER] = $headers; + } + + $session->set_options($options); + + $response = $session->send(); + + $session->close(); + + return $response; + } + +} diff --git a/testcms-final-anon/system/classes/db.php b/testcms-final-anon/system/classes/db.php new file mode 100644 index 0000000..1ab826a --- /dev/null +++ b/testcms-final-anon/system/classes/db.php @@ -0,0 +1,227 @@ +setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); + + return true; + } + + public static function close() { + static::$dbh = null; + } + + private static function profiling($statement, $binds, $start) { + static::$profile[] = array( + 'sql' => $statement->queryString, + 'binds' => $binds, + 'time' => round(microtime(true) - $start, 4), + 'rows' => $statement->rowCount() + ); + } + + public static function profile() { + return static::$profile; + } + + /* + * Querying + */ + public static function query($sql, $binds = array()) { + // make sure we have a connection + if(is_null(static::$dbh)) { + static::connect(); + } + + // check binds + if(!is_array($binds)) { + $binds = array($binds); + } + + // profile in debug mode + if(static::$debug) { + $start = microtime(true); + } + + // prepare + $sth = static::$dbh->prepare($sql); + + // bind params + $reflector = new ReflectionMethod('PDOStatement', 'bindValue'); + + foreach($binds as $index => $value) { + $key = is_int($index) ? $index + 1 : $index; + $type = is_bool($value) ? PDO::PARAM_BOOL : (is_int($value) ? PDO::PARAM_INT : PDO::PARAM_STR); + $reflector->invokeArgs($sth, array($key, $value, $type)); + } + + // get results + $sth->execute(); + + // profile in debug mode + if(static::$debug) { + static::profiling($sth, $binds, $start); + } + + // update affected rows + static::$affected_rows = $sth->rowCount(); + + // return statement + return $sth; + } + + /* + * Simple query, returns TRUE or FALSE + */ + public static function exec($sql, $binds = array()) { + // make sure we have a connection + if(is_null(static::$dbh)) { + static::connect(); + } + + // check binds + if(!is_array($binds)) { + $binds = array($binds); + } + + // profile in debug mode + if(static::$debug) { + $start = microtime(true); + } + + // prepare + $sth = static::$dbh->prepare($sql); + + // bind params + $reflector = new ReflectionMethod('PDOStatement', 'bindValue'); + + foreach($binds as $index => $value) { + $key = is_int($index) ? $index + 1 : $index; + $type = is_bool($value) ? PDO::PARAM_BOOL : (is_int($value) ? PDO::PARAM_INT : PDO::PARAM_STR); + $reflector->invokeArgs($sth, array($key, $value, $type)); + } + + // get results + $result = $sth->execute(); + + // profile in debug mode + if(static::$debug) { + static::profiling($sth, $binds, $start); + } + + // update affected rows + static::$affected_rows = $sth->rowCount(); + + // return result + return $result; + } + + /* + * Shortcuts + */ + public static function update($table, $columns = array(), $condition = array()) { + $updates = array(); + $args = array(); + + foreach($columns as $key => $value) { + $updates[] = '`' . $key . '` = ?'; + $args[] = $value; + } + + $sql = "update `" . $table . "` set " . implode(', ', $updates); + + if(count($condition)) { + $where = array(); + + foreach($condition as $key => $value) { + $where[] = '`' . $key . '` = ?'; + $args[] = $value; + } + + $sql .= " where " . implode(' and ', $where); + } + + return Db::exec($sql, $args); + } + + public static function insert($table, $row = array()) { + $keys = array(); + $values = array(); + $args = array(); + + foreach($row as $key => $value) { + $keys[] = '`' . $key . '`'; + $values[] = '?'; + $args[] = $value; + } + + $sql = "insert into `" . $table . "` (" . implode(', ', $keys) . ") values (" . implode(', ', $values) . ")"; + + return Db::exec($sql, $args); + } + + public static function delete($table, $condition = array()) { + $sql = "delete from `" . $table . "`"; + + if(count($condition)) { + $where = array(); + + foreach($condition as $key => $value) { + $where[] = '`' . $key . '` = ?'; + $args[] = $value; + } + + $sql .= " where " . implode(' and ', $where); + } + + return Db::exec($sql, $args); + } + + public static function row($sql, $binds = array(), $fetch_style = \PDO::FETCH_OBJ) { + // get statement + $stm = static::query($sql, $binds); + + // return data + return $stm->fetch($fetch_style); + } + + public static function results($sql, $binds = array(), $fetch_style = \PDO::FETCH_OBJ) { + // get statement + $stm = static::query($sql, $binds); + + // return data array + return $stm->fetchAll($fetch_style); + } + + public static function insert_id() { + return static::$dbh->lastInsertId(); + } + + public static function affected_rows() { + return static::$affected_rows; + } + +} diff --git a/testcms-final-anon/system/classes/email.php b/testcms-final-anon/system/classes/email.php new file mode 100644 index 0000000..e302e4b --- /dev/null +++ b/testcms-final-anon/system/classes/email.php @@ -0,0 +1,19 @@ + $value) { + $str .= $key . ': ' . $value . PHP_EOL; + } + + return $str; + } + + public static function send($to, $subject, $message, $headers = array()) { + return mail($to, $subject, $message, static::headers($headers)); + } + +} diff --git a/testcms-final-anon/system/classes/error.php b/testcms-final-anon/system/classes/error.php new file mode 100644 index 0000000..c28cfa6 --- /dev/null +++ b/testcms-final-anon/system/classes/error.php @@ -0,0 +1,88 @@ + 0) { + ob_clean(); + } + + // log exception + static::log($e); + + // Display error + if(Config::get('error.detail', true)) { + // Get the error file. + $file = $e->getFile(); + + // Trim the period off of the error message. + $message = rtrim($e->getMessage(), '.'); + + $line = $e->getLine(); + $trace = $e->getTraceAsString(); + $contexts = static::context($file, $e->getLine()); + + require PATH . 'system/admin/theme/error_php.php'; + } else { + require PATH . 'system/admin/theme/error_500.php'; + } + + exit(1); + } + + private static function context($path, $line, $padding = 5) { + if(file_exists($path)) { + $file = file($path, FILE_IGNORE_NEW_LINES); + + array_unshift($file, ''); + + // Calculate the starting position. + $start = $line - $padding; + + if($start < 0) { + $start = 0; + } + + // Calculate the context length. + $length = ($line - $start) + $padding + 1; + + if(($start + $length) > count($file) - 1) { + $length = null; + } + + return array_slice($file, $start, $length, true); + } + + return array(); + } + + public static function log($e) { + if(Config::get('error.log')) { + Log::exception($e); + } + } + +} diff --git a/testcms-final-anon/system/classes/events.php b/testcms-final-anon/system/classes/events.php new file mode 100644 index 0000000..a1b7c25 --- /dev/null +++ b/testcms-final-anon/system/classes/events.php @@ -0,0 +1,41 @@ + $resolver, 'singleton' => $singleton); + } + + public static function instance($name, $instance) { + static::$instances[$name] = $instance; + } + + public static function resolve($name) { + if(isset(static::$instances[$name])) { + return static::$instances[$name]; + } + + if(isset(static::$registry[$name])) { + $object = call_user_func(static::$registry[$name]['resolver']); + + if(isset(static::$registry[$name]['singleton']) and static::$registry[$name]['singleton']) { + static::$instances[$name] = $object; + } + + return $object; + } + + return false; + } +} diff --git a/testcms-final-anon/system/classes/items.php b/testcms-final-anon/system/classes/items.php new file mode 100644 index 0000000..b6714ac --- /dev/null +++ b/testcms-final-anon/system/classes/items.php @@ -0,0 +1,46 @@ +position = 0; + $this->items = $array; + } + + public function rewind() { + $this->position = 0; + } + + public function current() { + return $this->items[$this->position]; + } + + public function key() { + return $this->position; + } + + public function next() { + ++$this->position; + } + + public function valid() { + return isset($this->items[$this->position]); + } + + public function length() { + return count($this->items); + } + + public function first() { + return isset($this->items[0]) ? $this->items[0] : false; + } + + public function last() { + $index = count($this->items) - 1; + return isset($this->items[$index]) ? $this->items[$index] : false; + } + +} diff --git a/testcms-final-anon/system/classes/log.php b/testcms-final-anon/system/classes/log.php new file mode 100644 index 0000000..e7aa921 --- /dev/null +++ b/testcms-final-anon/system/classes/log.php @@ -0,0 +1,30 @@ + ' . $message . PHP_EOL; + + if($fp = @fopen(PATH . 'system/logs/' . date("Y-m-d") . '.log', 'a+')) { + fwrite($fp, $line); + fclose($fp); + } + } + + public static function __callStatic($severity, $parameters) { + static::write($severity, $parameters[0]); + } + + public static function exception($e) { + static::write('error', static::format($e)); + } + + private static function format($e) { + return $e->getMessage().' in '.$e->getFile().' on line '.$e->getLine(); + } + +} \ No newline at end of file diff --git a/testcms-final-anon/system/classes/metadata.php b/testcms-final-anon/system/classes/metadata.php new file mode 100644 index 0000000..462e649 --- /dev/null +++ b/testcms-final-anon/system/classes/metadata.php @@ -0,0 +1,41 @@ + 0 ? $posts_per_page : 10; + + if(count($errors)) { + Notifications::set('error', $errors); + return false; + } + + foreach($post as $key => $value) { + Db::update('meta', array('value' => $value), array('key' => $key)); + } + + Notifications::set('success', 'Your metadata has been updated'); + + return true; + } + +} \ No newline at end of file diff --git a/testcms-final-anon/system/classes/notifications.php b/testcms-final-anon/system/classes/notifications.php new file mode 100644 index 0000000..da058ba --- /dev/null +++ b/testcms-final-anon/system/classes/notifications.php @@ -0,0 +1,37 @@ + $messages) { + $html .= '

' . implode('
', $messages) . '

'; + } + + Session::forget('notifications'); + + return $html; + } + +} diff --git a/testcms-final-anon/system/classes/pages.php b/testcms-final-anon/system/classes/pages.php new file mode 100644 index 0000000..5446449 --- /dev/null +++ b/testcms-final-anon/system/classes/pages.php @@ -0,0 +1,166 @@ +url = Url::make($page->slug); + + $page->active = false; + + if($current = IoC::resolve('page')) { + if($current->id == $page->id) { + $page->active = true; + } + } + + return $page; + } + + return false; + } + + public static function list_all($params = array()) { + $sql = "select * from pages where 1 = 1"; + $args = array(); + + if(isset($params['status'])) { + $sql .= " and status = ?"; + $args[] = $params['status']; + } + + if(isset($params['sortby'])) { + $sql .= " order by " . $params['sortby']; + + if(isset($params['sortmode'])) { + $sql .= " " . $params['sortmode']; + } + } + + // extend data set + $pages = static::extend(Db::results($sql, $args)); + + // create iterable object + return new Items($pages); + } + + public static function count($params = array()) { + $sql = "select count(*) from pages where 1 = 1"; + $args = array(); + + if(isset($params['status'])) { + $sql .= " and pages.status = ?"; + $args[] = $params['status']; + } + + // get total + return Db::query($sql, $args)->fetchColumn(); + } + + public static function find($where = array()) { + $sql = "select * from pages"; + $args = array(); + + if(count($where)) { + $clause = array(); + foreach($where as $key => $value) { + $clause[] = '`' . $key . '` = ?'; + $args[] = $value; + } + $sql .= " where " . implode(' and ', $clause); + } + + // extend page object + return static::extend(Db::row($sql, $args)); + } + + public static function delete($id) { + Db::delete('pages', array('id' => $id)); + + Notifications::set('success', 'Your page has been deleted'); + + return true; + } + + public static function update($id) { + $post = Input::post(array('slug', 'name', 'title', 'content', 'status', 'delete')); + $errors = array(); + + // delete + if($post['delete'] !== false) { + // prevent the deletion of the posts page and home page + if(in_array($id, array(Config::get('metadata.home_page'), Config::get('metadata.posts_page'))) === false) { + return static::delete($id); + } else { + Notifications::set('error', 'Sorry, you can not delete you home page or posts page.'); + return false; + } + } else { + // remove it frm array + unset($post['delete']); + } + + if(empty($post['name'])) { + $errors[] = 'Please enter a name'; + } + + if(empty($post['title'])) { + $errors[] = 'Please enter a title'; + } + + if(count($errors)) { + Notifications::set('error', $errors); + return false; + } + + if(empty($post['slug'])) { + $post['slug'] = preg_replace('/\W+/', '-', trim(strtolower($post['name']))); + } + + Db::update('pages', $post, array('id' => $id)); + + Notifications::set('success', 'Your page has been updated'); + + return true; + } + + public static function add() { + $post = Input::post(array('slug', 'name', 'title', 'content', 'status')); + $errors = array(); + + if(empty($post['name'])) { + $errors[] = 'Please enter a name'; + } + + if(empty($post['title'])) { + $errors[] = 'Please enter a title'; + } + + if(count($errors)) { + Notifications::set('error', $errors); + return false; + } + + if(empty($post['slug'])) { + $post['slug'] = preg_replace('/\W+/', '-', trim(strtolower($post['name']))); + } + + Db::insert('pages', $post); + + Notifications::set('success', 'Your new page has been added'); + + return true; + } + +} diff --git a/testcms-final-anon/system/classes/posts.php b/testcms-final-anon/system/classes/posts.php new file mode 100644 index 0000000..fa07c9b --- /dev/null +++ b/testcms-final-anon/system/classes/posts.php @@ -0,0 +1,326 @@ + +url = Url::make($page->slug . '/' . $post->slug); + return $post; + } + + return false; + } + + public static function list_all($params = array()) { + $sql = " + select + + posts.id, + posts.title, + posts.slug, + posts.description, + posts.html, + posts.css, + posts.js, + posts.created, + posts.custom_fields, + coalesce(users.real_name, posts.author) as author, + coalesce(comments.total, 0) as total_comments, + posts.status + + from posts + left join users on (users.id = posts.author) + left join ( + select + count(comments.id) as total, comments.post + from comments + where status = 'published' + group by comments.post + ) as comments on (posts.id = comments.post) + where 1 = 1 + "; + $args = array(); + + if(isset($params['status'])) { + $sql .= " and posts.status = ?"; + $args[] = $params['status']; + } + + if(isset($params['sortby'])) { + $sql .= " order by posts." . $params['sortby']; + + if(isset($params['sortmode'])) { + $sql .= " " . $params['sortmode']; + } + } + + if(isset($params['limit'])) { + $sql .= " limit " . $params['limit']; + + if(isset($params['offset'])) { + $sql .= " offset " . $params['offset']; + } + } + + $results = Db::results($sql, $args); + + // extend result set with post url + $results = static::extend($results); + + // return items obj + return new Items($results); + } + + public static function count($params = array()) { + $sql = "select count(*) from posts where 1 = 1"; + $args = array(); + + if(isset($params['status'])) { + $sql .= " and posts.status = ?"; + $args[] = $params['status']; + } + + // return total + return Db::query($sql, $args)->fetchColumn(); + } + + public static function find($where = array()) { + $sql = " + select + + posts.id, + posts.title, + posts.slug, + posts.description, + posts.html, + posts.css, + posts.js, + posts.created, + posts.custom_fields, + coalesce(users.real_name, posts.author) as author, + coalesce(users.bio, '') as bio, + posts.status, + posts.comments + + from posts + left join users on (users.id = posts.author) + "; + $args = array(); + + if(count($where)) { + $clause = array(); + foreach($where as $key => $value) { + $clause[] = 'posts.' . $key . ' = ?'; + $args[] = $value; + } + $sql .= " where " . implode(' and ', $clause); + } + + return static::extend(Db::row($sql, $args)); + } + + public static function search($term, $params = array()) { + $sql = " + select + + posts.id, + posts.title, + posts.slug, + posts.description, + posts.html, + posts.css, + posts.js, + posts.created, + posts.custom_fields, + coalesce(users.real_name, posts.author) as author, + posts.status + + from posts + left join users on (users.id = posts.author) + + where (posts.title like :term or posts.description like :term or posts.html like :term) + "; + $args = array('term' => '%' . $term . '%'); + + if(isset($params['status'])) { + $sql .= " and posts.status = :status"; + $args['status'] = $params['status']; + } + + if(isset($params['limit'])) { + $sql .= " limit " . $params['limit']; + + if(isset($params['offset'])) { + $sql .= " offset " . $params['offset']; + } + } + + $results = Db::results($sql, $args); + + // extend result set with post url + $results = static::extend($results); + + // return items obj + return new Items($results); + } + + public static function search_count($term, $params = array()) { + $sql = " + select count(*) from posts + where (posts.title like :term or posts.description like :term or posts.html like :term) + "; + $args = array('term' => '%' . $term . '%'); + + if(isset($params['status'])) { + $sql .= " and posts.status = :status"; + $args['status'] = $params['status']; + } + + // return total + return Db::query($sql, $args)->fetchColumn(); + } + + public static function delete($id) { + Db::delete('posts', array('id' => $id)); + Db::delete('comments', array('post' => $id)); + + Notifications::set('success', 'Your post has been deleted'); + + return true; + } + + public static function update($id) { + $post = Input::post(array('title', 'slug', 'description', 'html', + 'css', 'js', 'status', 'delete', 'field', 'comments')); + $errors = array(); + + // delete + if($post['delete'] !== false) { + return static::delete($id); + } else { + // remove it frm array + unset($post['delete']); + } + + if(empty($post['title'])) { + $errors[] = 'Please enter a title'; + } + + if(empty($post['description'])) { + $errors[] = 'Please enter a description'; + } + + if(empty($post['html'])) { + $errors[] = 'Please enter your html'; + } + + if(empty($post['slug'])) { + $post['slug'] = preg_replace('/\W+/', '-', trim(strtolower($post['title']))); + } + + // check for duplicate slug + $sql = "select id from posts where slug = ? and id <> ?"; + if(Db::row($sql, array($post['slug'], $id))) { + $errors[] = 'A post with the same slug already exists, please change your post slug.'; + } + + if(count($errors)) { + Notifications::set('error', $errors); + return false; + } + + $custom = array(); + + if(is_array($post['field'])) { + foreach($post['field'] as $keylabel => $value) { + list($key, $label) = explode(':', $keylabel); + $custom[$key] = array('label' => $label, 'value' => $value); + } + } + + // remove from update + unset($post['field']); + + $post['custom_fields'] = json_encode($custom); + + // update row + Db::update('posts', $post, array('id' => $id)); + + Notifications::set('success', 'Your post has been updated.'); + + return true; + } + + public static function add() { + $post = Input::post(array('title', 'slug', 'description', 'html', + 'css', 'js', 'status', 'field', 'comments')); + $errors = array(); + + if(empty($post['title'])) { + $errors[] = 'Please enter a title'; + } + + if(empty($post['description'])) { + $errors[] = 'Please enter a description'; + } + + if(empty($post['html'])) { + $errors[] = 'Please enter your html'; + } + + if(empty($post['slug'])) { + $post['slug'] = preg_replace('/\W+/', '-', trim(strtolower($post['title']))); + } + + // check for duplicate slug + $sql = "select id from posts where slug = ?"; + if(Db::row($sql, array($post['slug']))) { + $errors[] = 'A post with the same slug already exists, please change your post slug.'; + } + + if(count($errors)) { + Notifications::set('error', $errors); + return false; + } + + $custom = array(); + + if(is_array($post['field'])) { + foreach($post['field'] as $keylabel => $value) { + list($key, $label) = explode(':', $keylabel); + $custom[$key] = array('label' => $label, 'value' => $value); + } + } + + // remove from update + unset($post['field']); + + $post['custom_fields'] = json_encode($custom); + + // set creation date + $post['created'] = time(); + + // set author + $user = Users::authed(); + $post['author'] = $user->id; + + Db::insert('posts', $post); + + Notifications::set('success', 'Your new post has been added'); + + return true; + } + +} diff --git a/testcms-final-anon/system/classes/request.php b/testcms-final-anon/system/classes/request.php new file mode 100644 index 0000000..48ca6e1 --- /dev/null +++ b/testcms-final-anon/system/classes/request.php @@ -0,0 +1,46 @@ + 'Continue', + 101 => 'Switching Protocols', + 200 => 'OK', + 201 => 'Created', + 202 => 'Accepted', + 203 => 'Non-Authoritative Information', + 204 => 'No Content', + 205 => 'Reset Content', + 206 => 'Partial Content', + 207 => 'Multi-Status', + 300 => 'Multiple Choices', + 301 => 'Moved Permanently', + 302 => 'Found', + 303 => 'See Other', + 304 => 'Not Modified', + 305 => 'Use Proxy', + 307 => 'Temporary Redirect', + 400 => 'Bad Request', + 401 => 'Unauthorized', + 402 => 'Payment Required', + 403 => 'Forbidden', + 404 => 'Not Found', + 405 => 'Method Not Allowed', + 406 => 'Not Acceptable', + 407 => 'Proxy Authentication Required', + 408 => 'Request Timeout', + 409 => 'Conflict', + 410 => 'Gone', + 411 => 'Length Required', + 412 => 'Precondition Failed', + 413 => 'Request Entity Too Large', + 414 => 'Request-URI Too Long', + 415 => 'Unsupported Media Type', + 416 => 'Requested Range Not Satisfiable', + 417 => 'Expectation Failed', + 422 => 'Unprocessable Entity', + 423 => 'Locked', + 424 => 'Failed Dependency', + 500 => 'Internal Server Error', + 501 => 'Not Implemented', + 502 => 'Bad Gateway', + 503 => 'Service Unavailable', + 504 => 'Gateway Timeout', + 505 => 'HTTP Version Not Supported', + 507 => 'Insufficient Storage', + 509 => 'Bandwidth Limit Exceeded' + ); + + public static function header($name, $value) { + static::$headers[$name] = $value; + } + + public static function content($str) { + static::$content = $str; + } + + public static function append($str) { + static::$content .= $str; + } + + public static function error($code = 500) { + if(isset(static::$statuses[$code])) { + static::$status = $code; + } + + switch($code) { + case 404: + Template::render(404); + } + } + + public static function send() { + // set content type + if(array_key_exists('Content-Type', static::$headers) === false) { + static::$headers['Content-Type'] = 'text/html; charset=UTF-8'; + } + + // send headers + if(headers_sent() === false) { + + $protocol = Input::server('server_protocol', 'HTTP/1.1'); + + header($protocol . ' ' . static::$status . ' ' . static::$statuses[static::$status]); + + foreach(static::$headers as $name => $value) { + header($name . ': ' . $value, true); + } + } + + // Send it to the browser! + echo static::$content; + } + + public static function redirect($url) { + static::header('Location', Url::make($url)); + static::$status = 302; + static::$content = ''; + } + +} diff --git a/testcms-final-anon/system/classes/routes.php b/testcms-final-anon/system/classes/routes.php new file mode 100644 index 0000000..860d7a9 --- /dev/null +++ b/testcms-final-anon/system/classes/routes.php @@ -0,0 +1,102 @@ + $slug); + + // allow admin to view unpublished posts + if(Users::authed() === false) { + $params['status'] = 'published'; + } + + if(($article = Posts::find($params)) === false) { + Log::warning('Article connot be found: ' . $slug); + return Response::error(404); + } + + // add comment + if(Input::method() == 'POST') { + if(Comments::add($article->id)) { + $page = IoC::resolve('posts_page'); + return Response::redirect($page->slug . '/' . $article->slug); + } + } + + // register single item for templating functions + IoC::instance('article', $article, true); + + Template::render('article'); + } + + public function page($slug = '') { + // allow admin to view unpublished posts + if(Users::authed() === false) { + $params['status'] = 'published'; + } + + // if no slug is set we will use our default page + if(empty($slug)) { + $params['id'] = Config::get('metadata.home_page'); + } else { + $params['slug'] = $slug; + } + + // if we cant find either it looks like we're barney rubble (in trouble) + if(($page = Pages::find($params)) === false) { + Log::warning('Page connot be found: ' . $slug); + return Response::error(404); + } + + // store our page for template functions + IoC::instance('page', $page, true); + + // does the current page host our posts? + if($page->id == Config::get('metadata.posts_page')) { + // render our posts template + return Template::render('posts'); + } + + // render our page template + Template::render('page'); + } + + public function rss() { + // set headers + Rss::headers(); + + // set content + Rss::generate(); + } + + public function search($term = '') { + if(Input::method() == 'POST') { + if(Input::post('term') !== false) { + return Response::redirect('search/' . rawurlencode(Input::post('term'))); + } + } + + $search = Posts::search($term, array( + 'status' => 'published', + 'limit' => Config::get('metadata.posts_per_page', 10), + 'offset' => Input::get('offset', 0) + )); + IoC::instance('search', $search, true); + + $total = Posts::search_count($term, array( + 'status' => 'published' + )); + IoC::instance('total_search', $total, true); + + $page = new StdClass; + $page->id = -1; + $page->title = 'Search'; + IoC::instance('page', $page, true); + Template::render('search'); + } + +} diff --git a/testcms-final-anon/system/classes/rss.php b/testcms-final-anon/system/classes/rss.php new file mode 100644 index 0000000..0a19c8c --- /dev/null +++ b/testcms-final-anon/system/classes/rss.php @@ -0,0 +1,80 @@ +createElement($name); + + if(is_null($value) === false) { + $text = static::$document->createTextNode($value); + $element->appendChild($text); + } + + foreach($attributes as $key => $val) { + $element->setAttribute($key, $val); + } + + return $element; + } + + public static function generate() { + // create a dom xml object + static::$document = new DOMDocument('1.0', 'UTF-8'); + + // create our rss feed + $rss = static::element('rss', null, array('version' => '2.0')); + static::$document->appendChild($rss); + + // create channel + $channel = static::element('channel'); + $rss->appendChild($channel); + + // title + $title = static::element('title', Config::get('metadata.sitename')); + $channel->appendChild($title); + + // link + $link = static::element('link', 'http://' . $_SERVER['HTTP_HOST']); + $channel->appendChild($link); + + // description + $description = static::element('description', Config::get('metadata.description')); + $channel->appendChild($description); + + + // articles + $params = array('status' => 'published', 'sortby' => 'id', 'sortmode' => 'desc'); + + foreach(Posts::list_all($params) as $post) { + $item = static::element('item'); + $channel->appendChild($item); + + // title + $title = static::element('title', $post->title); + $item->appendChild($title); + + // link + $url = 'http://' . $_SERVER['HTTP_HOST'] . Url::make(IoC::resolve('posts_page')->slug . '/' . $post->slug); + $link = static::element('link', $url); + $item->appendChild($link); + + // description + $description = static::element('description', $post->description); + $item->appendChild($description); + + // date + $date = static::element('pubDate', date(DATE_RSS, $post->created)); + $item->appendChild($date); + } + + // dump xml tree + Response::content(static::$document->saveXML()); + } +} diff --git a/testcms-final-anon/system/classes/session.php b/testcms-final-anon/system/classes/session.php new file mode 100644 index 0000000..0124d3c --- /dev/null +++ b/testcms-final-anon/system/classes/session.php @@ -0,0 +1,34 @@ +themes/' . $theme . '/' . $file . '.php not found.'); + } + + static::parse($filepath, $data); + } + } + +} diff --git a/testcms-final-anon/system/classes/testcms.php b/testcms-final-anon/system/classes/testcms.php new file mode 100644 index 0000000..46c111d --- /dev/null +++ b/testcms-final-anon/system/classes/testcms.php @@ -0,0 +1,152 @@ +key] = $row->value; + } + + Config::set('metadata', $meta); + + // look up which page has our posts + $page = Pages::find(array('id' => Config::get('metadata.posts_page'))); + IoC::instance('posts_page', $page, true); + } + + public static function run() { + // run setup and prepare env + static::setup(); + + // handle the requested uri + $uri = static::parse(); + $segments = array(); + + if(strlen($uri)) { + $segments = explode('/', $uri); + } + + // lets log our translated uri + Log::info('Translated URI: ' . $uri); + + // set our action or our default if none is set + $action = count($segments) ? array_shift($segments) : 'page'; + + // default to our front end router + $controller = 'Routes'; + + // set the template path + $theme = Config::get('metadata.theme'); + Template::path(PATH . 'themes/' . $theme . '/'); + + // remove admin as an argument and set the default action if there isnt one + if($action == 'admin') { + // set default controller for the admin + $controller = (count($segments) ? array_shift($segments) : 'posts') . '_controller'; + + // set default action + $action = count($segments) ? array_shift($segments) : 'index'; + + // public admin actions + $public = array('users/login', 'users/amnesia', 'users/reset'); + + // redirect to login + if(Users::authed() === false and in_array(trim($controller, '_controller') . '/' . $action, $public) === false) { + return Response::redirect(Config::get('application.admin_folder') . '/users/login'); + } + + // set template path for admin + Template::path(PATH . 'system/admin/theme/'); + } + + // log the controller we are going to use and the action + Log::info('Controller action: ' . $controller . '/' . $action); + + // check we can find a action + $reflector = new ReflectionClass($controller); + + if($reflector->isInstantiable() === false or $reflector->hasMethod($action) === false) { + // default back to front end template for 404 page + Template::path(PATH . 'themes/' . $theme . '/'); + + // report error + Log::warning(($reflector->isInstantiable() === false ? 'Controller was not Instantiable' : 'Action does not exist')); + + // method not found in controller + return Response::error(404); + } + + $reflector->getMethod($action)->invokeArgs(new $controller, $segments); + } + + private static function parse() { + // get uri + $uri = Request::uri(); + + // lets log our initial uri + Log::info('Requested URI: ' . $uri); + + // if htaccess is not enabled and the file exists ignore the request + if(file_exists($uri)) { + return ''; + } + + // route definitions + $routes = array(); + + // posts host page + if($page = IoC::resolve('posts_page')) { + $routes[$page->slug . '/(:any)'] = 'article/$1'; + } + + // fallback to 'admin' + $admin_folder = Config::get('application.admin_folder', 'admin'); + + // static routes + $routes = array_merge($routes, array( + $admin_folder . '/(:any)/(:any)/(:any)' => 'admin/$1/$2/$3', + $admin_folder . '/(:any)/(:any)' => 'admin/$1/$2', + $admin_folder . '/(:any)' => 'admin/$1', + $admin_folder => 'admin', + + 'search/(:any)' => 'search/$1', + 'search' => 'search', + + 'rss' => 'rss', + + '(:any)' => 'page/$1' + )); + + // define wild-cards + $search = array(':any', ':num'); + $replace = array('[0-9a-zA-Z~%\.:_\\-]+', '[0-9]+'); + + // parse routes + foreach($routes as $route => $translated) { + // replace wildcards + $route = str_replace($search, $replace, $route); + + // look for matches + if(preg_match('#^' . $route . '#', $uri, $matches)) { + // replace matched values + foreach($matches as $k => $match) { + $translated = str_replace('$' . $k, $match, $translated); + } + + // return on first match + return $translated; + } + } + + return $uri; + } + +} \ No newline at end of file diff --git a/testcms-final-anon/system/classes/themes.php b/testcms-final-anon/system/classes/themes.php new file mode 100644 index 0000000..a0f2506 --- /dev/null +++ b/testcms-final-anon/system/classes/themes.php @@ -0,0 +1,60 @@ + $key) { + // temp value + $about[$key] = ''; + + // find line if exists + if(!isset($contents[$index])) { + continue; + } + + $line = $contents[$index]; + + // skip if not separated by a colon character + if(strpos($line, ":") === false) { + continue; + } + + $parts = explode(":", $line); + + // remove the key part + array_shift($parts); + + // in case there was a colon in our value part glue it back together + $value = implode('', $parts); + + $about[$key] = trim($value); + } + + return $about; + } + +} \ No newline at end of file diff --git a/testcms-final-anon/system/classes/url.php b/testcms-final-anon/system/classes/url.php new file mode 100644 index 0000000..d83028d --- /dev/null +++ b/testcms-final-anon/system/classes/url.php @@ -0,0 +1,104 @@ + '', + '&\S+?;' => '', + '\s+' => $replace, + '[^a-z0-9\-\._]' => '', + $replace.'+' => $replace, + $replace.'$' => '', + '^'.$replace => '', + '\.+$' => '' + ); + + $str = strip_tags($str); + + foreach($trans as $key => $val) { + $str = preg_replace("#" . $key . "#i", $val, $str); + } + + $str = strtolower($str); + + return trim(stripslashes($str)); + } + +} diff --git a/testcms-final-anon/system/classes/users.php b/testcms-final-anon/system/classes/users.php new file mode 100644 index 0000000..9b0e2e9 --- /dev/null +++ b/testcms-final-anon/system/classes/users.php @@ -0,0 +1,260 @@ + $value) { + $clause[] = '`' . $key . '` = "' . $value . '"'; + } + $sql .= " where " . implode(' and ', $clause); + + } + + return Db::row($sql, $args); + } + + + public static function login() { + // get posted data + $post = Input::post(array('user', 'pass', 'remember')); + $errors = array(); + + // remove white space + $post = array_map('trim', $post); + + if(empty($post['user'])) { + $errors[] = 'Please enter your username'; + } + + if(empty($post['pass'])) { + $errors[] = 'Please enter your password'; + } + + if(empty($errors)) { + // find user + if($user = Users::find(array('username' => $post['user']))) { + // check password + if(crypt($post['pass'], $user->password) != $user->password) { + $errors[] = 'Incorrect details'; + } + } else { + $errors[] = 'Incorrect details'; + } + } + + if(count($errors)) { + Notifications::set('error', $errors); + return false; + } + + // if we made it this far that means we have a winner + Session::set('user', $user); + + return true; + } + + public static function logout() { + Session::forget('user'); + } + + public static function recover_password() { + $post = Input::post(array('email')); + $errors = array(); + + if(filter_var($post['email'], FILTER_VALIDATE_EMAIL) === false) { + $errors[] = 'Please enter a valid email address'; + } else { + if(($user = static::find(array('email' => $post['email']))) === false) { + $errors[] = 'Account not found'; + } + } + + if(count($errors)) { + Notifications::set('error', $errors); + return false; + } + + $hash = hash('md5', $user->id . $user->email . $user->password); + $link = Url::build(array( + 'path' => Url::make('admin/users/reset/' . $hash) + )); + + $subject = '[' . Config::get('metadata.sitename') . '] Password Reset'; + $plain = 'You have requested to reset your password. To continue follow the link below. ' . $link; + $headers = array('From' => 'no-reply@' . Input::server('http_host')); + + Email::send($user->email, $subject, $plain, $headers); + + Notifications::set('notice', 'We have sent you an email to confirm your password change.'); + + return true; + } + + public static function reset_password($id) { + $post = Input::post(array('password')); + $errors = array(); + + if(empty($post['password'])) { + $errors[] = 'Please enter a password'; + } + + if(count($errors)) { + Notifications::set('error', $errors); + return false; + } + + $password = crypt($post['password']); + + $sql = "update users set `password` = ? where id = ?"; + Db::query($sql, array($password, $id)); + + Notifications::set('success', 'Your new password has been set'); + + return true; + } + + public static function delete($id) { + Db::delete('users', array('id' => $id)); + + Notifications::set('success', 'User has been deleted'); + + return true; + } + + public static function update($id) { + $post = Input::post(array('username', 'password', 'email', 'real_name', 'bio', 'status', 'role', 'delete')); + $errors = array(); + + // delete + if($post['delete'] !== false) { + return static::delete($id); + } else { + // remove it frm array + unset($post['delete']); + } + + if(empty($post['username'])) { + $errors[] = 'Please enter a username'; + } else { + if(($user = static::find(array('username' => $post['username']))) and $user->id != $id) { + $errors[] = 'Username is already being used'; + } + } + + if(filter_var($post['email'], FILTER_VALIDATE_EMAIL) === false) { + $errors[] = 'Please enter a valid email address'; + } + + if(empty($post['real_name'])) { + $errors[] = 'Please enter a display name'; + } + + if(strlen($post['password'])) { + // encrypt new password + $post['password'] = crypt($post['password']); + } else { + // remove it and leave it unchanged + unset($post['password']); + } + + if(count($errors)) { + Notifications::set('error', $errors); + return false; + } + + // format email + $post['email'] = strtolower(trim($post['email'])); + + // update record + Db::update('users', $post, array('id' => $id)); + + // update user session? + if(Users::authed()->id == $id) { + Session::set('user', static::find(array('id' => $id))); + } + + Notifications::set('success', 'User has been updated'); + + return true; + } + + public static function add() { + $post = Input::post(array('username', 'password', 'email', 'real_name', 'bio', 'status', 'role')); + $errors = array(); + + if(empty($post['username'])) { + $errors[] = 'Please enter a username'; + } else { + if(static::find(array('username' => $post['username']))) { + $errors[] = 'Username is already being used'; + } + } + + if(empty($post['password'])) { + $errors[] = 'Please enter a password'; + } + + if(filter_var($post['email'], FILTER_VALIDATE_EMAIL) === false) { + $errors[] = 'Please enter a valid email address'; + } + + if(empty($post['real_name'])) { + $errors[] = 'Please enter a display name'; + } + + if(count($errors)) { + Notifications::set('error', $errors); + return false; + } + + // encrypt password + $post['password'] = crypt($post['password']); + + // format email + $post['email'] = strtolower(trim($post['email'])); + + // add record + Db::insert('users', $post); + + Notifications::set('success', 'A new user has been added'); + + return true; + } + +} diff --git a/testcms-final-anon/system/functions/articles.php b/testcms-final-anon/system/functions/articles.php new file mode 100644 index 0000000..3c398a1 --- /dev/null +++ b/testcms-final-anon/system/functions/articles.php @@ -0,0 +1,142 @@ +id; + } + + return ''; +} + +function article_title() { + if($itm = IoC::resolve('article')) { + return $itm->title; + } + + return ''; +} + +function article_slug() { + if($itm = IoC::resolve('article')) { + return $itm->slug; + } + + return ''; +} + +function article_url() { + if($itm = IoC::resolve('article')) { + $page = IoC::resolve('posts_page'); + return Url::make($page->slug . '/' . $itm->slug); + } + + return ''; +} + +function article_description() { + if($itm = IoC::resolve('article')) { + return $itm->description; + } + + return ''; +} + +function article_html() { + if($itm = IoC::resolve('article')) { + return $itm->html; + } + + return ''; +} + +function article_css() { + if($itm = IoC::resolve('article')) { + return $itm->css; + } + + return ''; +} + +function article_js() { + if($itm = IoC::resolve('article')) { + return $itm->js; + } + + return ''; +} + +function article_time() { + if($itm = IoC::resolve('article')) { + return $itm->created; + } + + return ''; +} + +function article_date() { + if(article_time() !== '') { + return date(Config::get('metadata.date_format'), article_time()); + } + + return ''; +} + +function article_status() { + if($itm = IoC::resolve('article')) { + return $itm->status; + } + + return ''; +} + +function article_total_comments() { + if($itm = IoC::resolve('article')) { + return $itm->total_comments; + } + + return 0; +} + +function article_author() { + if($itm = IoC::resolve('article')) { + return $itm->author; + } + + return ''; +} + +function article_author_bio() { + if($itm = IoC::resolve('article')) { + return $itm->bio; + } + + return ''; +} + +function article_custom_fields() { + if($itm = IoC::resolve('article')) { + if(isset($itm->custom_fields)) { + // get associative array + $data = json_decode($itm->custom_fields, true); + return is_array($data) ? $data : array(); + } + } + + return array(); +} + +function article_custom_field($key, $default = '') { + $fields = article_custom_fields(); + return isset($fields[$key]) ? $fields[$key]['value'] : $default; +} + +function customised() { + if($itm = IoC::resolve('article')) { + return strlen($itm->css) > 0 or strlen($itm->js) > 0; + } + + return false; +} diff --git a/testcms-final-anon/system/functions/comments.php b/testcms-final-anon/system/functions/comments.php new file mode 100644 index 0000000..9045511 --- /dev/null +++ b/testcms-final-anon/system/functions/comments.php @@ -0,0 +1,116 @@ + 'published', 'post' => $itm->id)); + IoC::instance('comments', $items, true); + } + + return $items->length() > 0; +} + +function total_comments() { + if(has_comments() === false) { + return 0; + } + + $items = IoC::resolve('comments'); + return $items->length(); +} + +// loop comments +function comments() { + if(has_comments() === false) { + return false; + } + + $items = IoC::resolve('comments'); + + if($result = $items->valid()) { + // register single comment + IoC::instance('comment', $items->current(), true); + + // move to next + $items->next(); + } + + return $result; +} + +// single comments +function comment_id() { + if($itm = IoC::resolve('comment')) { + return $itm->id; + } + + return ''; +} + +function comment_time() { + if($itm = IoC::resolve('comment')) { + return $itm->date; + } + + return ''; +} + +function comment_date() { + if($itm = IoC::resolve('comment')) { + return date(Config::get('metadata.date_format'), $itm->date); + } + + return ''; +} + +function comment_name() { + if($itm = IoC::resolve('comment')) { + return $itm->name; + } + + return ''; +} + +function comment_text() { + if($itm = IoC::resolve('comment')) { + return $itm->text; + } + + return ''; +} + +function comments_open() { + if($itm = IoC::resolve('article')) { + return $itm->comments ? true : false; + } + + return false; +} + +// form elements +function comment_form_notifications() { + return Notifications::read(); +} + +function comment_form_input_name($extra = '') { + return ''; +} + +function comment_form_input_email($extra = '') { + return ''; +} + +function comment_form_input_text($extra = '') { + return ''; +} + +function comment_form_button($text = 'Post Comment', $extra = '') { + return ''; +} \ No newline at end of file diff --git a/testcms-final-anon/system/functions/helpers.php b/testcms-final-anon/system/functions/helpers.php new file mode 100644 index 0000000..fe6a2ba --- /dev/null +++ b/testcms-final-anon/system/functions/helpers.php @@ -0,0 +1,107 @@ +id == Config::get('metadata.home_page'); + } + + return false; +} + +function is_postspage() { + if($itm = IoC::resolve('page')) { + return $itm->id == Config::get('metadata.posts_page'); + } + + return false; +} + +function is_debug() { + return Config::get('debug', false); +} + +// benchmarking +function execution_time() { + $miliseconds = microtime(true) - START; + return round($miliseconds, 4); +} + +// return in mb +function memory_usage() { + return memory_get_peak_usage(true) / 1024; +} + +// database profile information +function db_profile() { + // total query time + $total = 0; + + $html = ''; + + $html .= ''; + $html .= ''; + + $html .= ''; + + foreach(Db::profile() as $row) { + $html .= ''; + $total += $row['time']; + } + + $html .= ''; + + $html .= ''; + $html .= ''; + $html .= ''; + $html .= ''; + $html .= ''; + + $html .= '
SQLBindingsRowsTime
' . $row['sql'] . '' . implode(', ', $row['binds']) . '' . $row['rows'] . '' . $row['time'] . '
Query Time' . round($total, 4) . '
Execution Time' . execution_time() . '
Memory Usage' . memory_usage() . 'Kb
'; + + return $html; +} diff --git a/testcms-final-anon/system/functions/menus.php b/testcms-final-anon/system/functions/menus.php new file mode 100644 index 0000000..0c48c81 --- /dev/null +++ b/testcms-final-anon/system/functions/menus.php @@ -0,0 +1,74 @@ + 'published')); + IoC::instance('total_menu_items', $total, true); + } + return $total; +} + +function menu_items($params = array()) { + if(!has_menu_items()) { + return false; + } + + if(($pages = IoC::resolve('menu')) === false) { + $params['status'] = 'published'; + $pages = Pages::list_all($params); + IoC::instance('menu', $pages, true); + } + + if($result = $pages->valid()) { + // register single post + IoC::instance('menu_item', $pages->current(), true); + + // move to next + $pages->next(); + } + + return $result; +} + +function menu_id() { + if($itm = IoC::resolve('menu_item')) { + return $itm->id; + } + + return ''; +} + +function menu_url() { + if($itm = IoC::resolve('menu_item')) { + return $itm->url; + } + + return ''; +} + +function menu_name() { + if($itm = IoC::resolve('menu_item')) { + return $itm->name; + } + + return ''; +} + +function menu_title() { + if($itm = IoC::resolve('menu_item')) { + return $itm->title; + } + + return $default; +} + +function menu_active() { + if($itm = IoC::resolve('menu_item')) { + return $itm->active; + } + + return ''; +} diff --git a/testcms-final-anon/system/functions/metadata.php b/testcms-final-anon/system/functions/metadata.php new file mode 100644 index 0000000..5b3c125 --- /dev/null +++ b/testcms-final-anon/system/functions/metadata.php @@ -0,0 +1,24 @@ +id; + } + + return ''; +} + +function page_url() { + if($itm = IoC::resolve('page')) { + return $itm->url; + } + + return ''; +} + +function page_name() { + if($itm = IoC::resolve('page')) { + return $itm->name; + } + + return ''; +} + +function page_title($default = '') { + if($itm = IoC::resolve('page')) { + return $itm->title; + } + if($itm = IoC::resolve('article')) { + return $itm->title; + } + + return $default; +} + +function page_content() { + if($itm = IoC::resolve('page')) { + return $itm->content; + } + + return ''; +} + + +function page_active() { + if($itm = IoC::resolve('page')) { + return $itm->active; + } + + return ''; +} + +function page_status() { + if($itm = IoC::resolve('page')) { + return $itm->status; + } + + return ''; +} \ No newline at end of file diff --git a/testcms-final-anon/system/functions/posts.php b/testcms-final-anon/system/functions/posts.php new file mode 100644 index 0000000..e4e5fb7 --- /dev/null +++ b/testcms-final-anon/system/functions/posts.php @@ -0,0 +1,71 @@ + 'published', + 'sortby' => 'id', + 'sortmode' => 'desc', + 'limit' => Config::get('metadata.posts_per_page', 10), + 'offset' => Input::get('offset', 0) + ); + $posts = Posts::list_all($params); + IoC::instance('posts', $posts, true); + + $total_posts = Posts::count(array('status' => 'published')); + IoC::instance('total_posts', $total_posts, true); + } + + return $posts->length() > 0; +} + +function posts() { + if(has_posts() === false) { + return false; + } + + $posts = IoC::resolve('posts'); + + if($result = $posts->valid()) { + // register single post + IoC::instance('article', $posts->current(), true); + + // move to next + $posts->next(); + } + + return $result; +} + +function posts_next($text = 'Next', $default = '') { + $per_page = Config::get('metadata.posts_per_page'); + $offset = Input::get('offset', 0); + $total = IoC::resolve('total_posts'); + + $pages = floor($total / $per_page); + $page = $offset / $per_page; + + if($page < $pages) { + return '' . $text . ''; + } + + return $default; +} + +function posts_prev($text = 'Previous', $default = '') { + $per_page = Config::get('metadata.posts_per_page'); + $offset = Input::get('offset', 0); + $total = IoC::resolve('total_posts'); + + $pages = ceil($total / $per_page); + $page = $offset / $per_page; + + if($offset > 0) { + return '' . $text . ''; + } + + return $default; +} \ No newline at end of file diff --git a/testcms-final-anon/system/functions/search.php b/testcms-final-anon/system/functions/search.php new file mode 100644 index 0000000..58258ee --- /dev/null +++ b/testcms-final-anon/system/functions/search.php @@ -0,0 +1,68 @@ +length() > 0; + } + + return false; +} + +function total_search_results() { + if($total = IoC::resolve('total_search')) { + return $total; + } + + return 0; +} + +function search_results() { + $posts = IoC::resolve('search'); + + if($result = $posts->valid()) { + // register single post + IoC::instance('article', $posts->current(), true); + + // move to next + $posts->next(); + } + + return $result; +} + +function search_term() { + return (Request::uri_segment(1) == 'search' ? Request::uri_segment(2) : ''); +} + +function search_next($text = 'Next', $default = '') { + $per_page = Config::get('metadata.posts_per_page'); + $offset = Input::get('offset', 0); + $total = IoC::resolve('total_search'); + + $pages = floor($total / $per_page); + $page = $offset / $per_page; + + if($page < $pages) { + return '' . $text . ''; + } + + return $default; +} + +function search_prev($text = 'Previous', $default = '') { + $per_page = Config::get('metadata.posts_per_page'); + $offset = Input::get('offset', 0); + $total = IoC::resolve('total_search'); + + $pages = ceil($total / $per_page); + $page = $offset / $per_page; + + if($offset > 0) { + return '' . $text . ''; + } + + return $default; +} \ No newline at end of file diff --git a/testcms-final-anon/system/functions/users.php b/testcms-final-anon/system/functions/users.php new file mode 100644 index 0000000..6c54bda --- /dev/null +++ b/testcms-final-anon/system/functions/users.php @@ -0,0 +1,48 @@ +id; + } + + return ''; +} + +function user_authed_name() { + if($user = Users::authed()) { + return $user->username; + } + + return ''; +} + +function user_authed_email() { + if($user = Users::authed()) { + return $user->email; + } + + return ''; +} + +function user_authed_role() { + if($user = Users::authed()) { + return $user->role; + } + + return ''; +} + +function user_authed_real_name() { + if($user = Users::authed()) { + return $user->real_name; + } + + return ''; +} \ No newline at end of file diff --git a/testcms-final-anon/themes/default/404.php b/testcms-final-anon/themes/default/404.php new file mode 100644 index 0000000..3573af5 --- /dev/null +++ b/testcms-final-anon/themes/default/404.php @@ -0,0 +1,9 @@ + +
+

Oh no, this page can’t be found.

+ +

Unfortunately, the page at + can't be found, but don't give up hope yet! You can always try going back to + the homepage, or searching.

+
+ diff --git a/testcms-final-anon/themes/default/about.txt b/testcms-final-anon/themes/default/about.txt new file mode 100644 index 0000000..56b0b66 --- /dev/null +++ b/testcms-final-anon/themes/default/about.txt @@ -0,0 +1,5 @@ +Theme name: Default +Description: Default Theme +Author name: Test CMS +Author site: http://google.com +License: WTFPL (http://sam.zoy.org/wtfpl/COPYING) diff --git a/testcms-final-anon/themes/default/article.php b/testcms-final-anon/themes/default/article.php new file mode 100644 index 0000000..ffbf5c5 --- /dev/null +++ b/testcms-final-anon/themes/default/article.php @@ -0,0 +1,15 @@ +
+

+ +
+ +
+
+ + + +
+

This article is my oldest. It is words long. +

+
+ diff --git a/testcms-final-anon/themes/default/css/reset.css b/testcms-final-anon/themes/default/css/reset.css new file mode 100644 index 0000000..9341f6f --- /dev/null +++ b/testcms-final-anon/themes/default/css/reset.css @@ -0,0 +1,58 @@ +* { margin: 0; padding: 0; -webkit-font-smoothing: antialiased; } + +html { min-height: 100.01%; } +body { text-align: center; } + +img { border: none; -ms-interpolation-mode: bicubic; image-rendering: optimizeQuality; display: block; } + +table { border-collapse: separate; border-spacing: 0; vertical-align: top; } +caption, th, td { text-align: left; font-weight: normal; vertical-align: top; } + +fieldset { border: none; } +textarea { resize: vertical; } +label[for] { font-weight: bold; cursor: pointer; } +button { cursor: pointer; } + +input { -webkit-border-radius: 0; } + input[type=search], input[type=number]::-webkit-inner-spin-button, input[type=number]::-webkit-outer-spin-button, ::-webkit-search-cancel-button, input[type=search]::-webkit-search-decoration, input[type=search]::-webkit-search-results-button, input[type=search]::-webkit-search-results-decoration { -webkit-appearance: none !important; margin: 0; } + +article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section { display: block; } + nav ul { list-style: none; } + +.transition { -webkit-transition-duration: .5s; -webkit-transition-timing-function: ease-in-out; -moz-transition-duration: .5s; -moz-transition-timing-function: ease-in-out; transition-duration: .5s; transition-timing-function: ease-in-out; -o-transition-duration: .5s; -o-transition-timing-function: ease-in-out; } + .transition.opacity { -webkit-transition-property: opacity; -moz-transition-property: opacity; transition-property: opacity; -o-transition-property: opacity; } + .transition.color { -webkit-transition-property: color; -moz-transition-property: color; transition-property: color; -o-transition-property: color; } + .transition.background { -webkit-transition-property: background; -moz-transition-property: background; transition-property: background; -o-transition-property: background; } + .transition.border { -webkit-transition-property: border; -moz-transition-property: border; transition-property: border; -o-transition-property: border; } + .transition.all { -webkit-transition-property: all; -moz-transition-property: all; transition-property: all; -o-transition-property: all; } +.notransition { -webkit-transition: none; -moz-transition: none; transition: none; -o-transition: none; } + +.hidden { text-indent: -999em; } + .block.hidden, nav#skip-links { position: absolute; left: -999em; top: -999em; } + +.wrap { text-align: left; margin: 0 auto; } + +.radius { -moz-border-radius: 5px; -webkit-border-radius: 5px; border-radius: 5px; -khtml-border-radius: 5px; -moz-background-clip: padding; -webkit-background-clip: padding-box; background-clip: padding-box; } + +.clear { zoom: 1; overflow: auto; clear: both; } + .clear:before, .clear:after { content: ''; display: table; } + .group:after { clear: both; } + +.ghost, .disabled { opacity: .5; filter: alpha(opacity=50); } + .ghost.super { opacity: .2; filter: alpha(opacity=20); } + .ghost.sub { opacity: .8; filter: alpha(opacity=80); } + +.align { margin: 0 auto; } + .align.text { text-align: center; } + .align.vertical { vertical-align: center; position: absolute; left: 50%; top: 50%; } + +dl { position: relative; } + dt { font-weight: bold; } + dd { opacity: .7; } + +.float { float: inherit; } + .float.left { float: left; } + .float.right { float: right; } + +.hidden { display: none; } +.hide { position: absolute; left: -999em; top: -999em; } \ No newline at end of file diff --git a/testcms-final-anon/themes/default/css/style.css b/testcms-final-anon/themes/default/css/style.css new file mode 100644 index 0000000..fb02058 --- /dev/null +++ b/testcms-final-anon/themes/default/css/style.css @@ -0,0 +1,551 @@ +/** + * TestCMS' default theme + */ + +::-webkit-selection { + background: #ffc; + color: #222; +} +::-moz-selection { + background: #ffc; + color: #222; +} +::selection { + background: #ffc; + color: #222; +} + +html { + min-height: 100%; +} + +body, input, textarea, button { + color: #777; + font: 16px/26px "Helvetica Neue", sans-serif; +} + +h1 { + font-size: 40px; + line-height: 48px; + font-weight: bold; + + color: #333; + + margin-bottom: 30px; +} + +a, a * { + -webkit-transition: color .25s; + -moz-transition: color .25s; + -ms-transition: color .25s; + -o-transition: color .25s; + transition: color .25s; +} + a:active { + -webkit-transform: translateY(1px); + } + +.content a, .comments a { + color: #2082ab; +} + .content a:hover, .comments a:hover { + color: #222; + } + +.wrap, .content { + width: 900px; + margin: 0 auto; + + text-align: left; +} + .content { + width: 730px; + margin: 60px auto 80px; + + padding-left: 170px; + } + .content img, .content .items { + margin-left: -170px; + + width: 900px; + height: auto; + } + .content p { + padding-bottom: 15px; + } + +form#search { + position: relative; + background: #ddd; + + padding: 10px 0; +} + form#search input { + padding: 8px 12px; + color: #333; + + border: none; + width: 900px; + } + +button { + background: #2082ab; + + color: #fff; + font-weight: bold; + + border: none; + + padding: 8px 15px; + + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + border-radius: 3px; +} + +header#top { + background: #f3f3f3; + padding: 50px 0 20px; +} + header#top div { + position: relative; + } + header#top a#logo { + color: #444; + font-size: 18px; + line-height: 21px; + + text-decoration: none; + + display: block; + width: 130px; + + padding-bottom: 4px; + } + header#top a#logo:hover, header#top nav li.active a, header#top nav li.active a:hover { + color: #2082ab; + } + header#top nav { + position: absolute; + left: 170px; + bottom: 0; + } + header#top nav li { + float: left; + position: relative; + + margin-right: 50px; + } + header#top nav li.active:after { + content: ''; + display: block; + + position: absolute; + left: 50%; + bottom: -20px; + + width: 0; + height: 0; + + border-left: 8px solid transparent; + border-right: 8px solid transparent; + border-bottom: 8px solid #fff; + + margin-left: -8px; + } + header#top nav li a { + color: #888; + + font-weight: bold; + font-size: 14px; + + text-decoration: none; + + display: block; + } + header#top nav li a:hover { + color: #444; + } + header#top img#search { + cursor: pointer; + + position: absolute; + right: 0; + bottom: 0; + } + +ul.items { + list-style: none; + + padding: 60px 0 80px; +} + ul.items li { + clear: both; + overflow: hidden; + + padding-bottom: 20px; + } + ul.items li a { + display: block; + text-decoration: none; + } + ul.items li a time { + display: block; + float: left; + + color: #aaa; + font-size: 13px; + line-height: 34px; + + width: 130px; + padding-right: 40px; + text-align: right; + } + ul.items li a:hover time { + color: #7ac1df; + } + ul.items li a h2 { + font-size: 28px; + line-height: 30px; + + color: #555; + + display: block; + float: left; + + width: 730px; + } + ul.items li a:hover h2 { + color: #2082ab; + } + +section.comments { + width: 900px; + margin: 0 auto 50px; + padding-top: 30px; + + text-align: left; + + border-top: 1px solid #eee; +} + section.comments h1, section.comments form.commentform legend { + font-weight: bold; + font-size: 22px; + + color: #555; + } + section.comments h1 a { + float: right; + font-size: 15px; + } + section.comments ul { + list-style: none; + overflow: hidden; + + padding-left: 170px; + padding-bottom: 30px; + } + section.comments ul li { + float: left; + width: 670px; + + margin-bottom: 30px; + padding: 30px; + + background: #fafafa; + } + section.comments h2 { + color: #555; + font-size: 18px; + line-height: 30px; + + float: left; + width: 250px; + } + section.comments time { + float: right; + + font: italic 13px/30px Georgia, serif; + } + section.comments div.content { + clear: both; + width: auto; + + margin: 0; + padding: 20px 0 0; + + font-size: 15px; + line-height: 25px; + } + + section.comments form.commentform { + clear: both; + padding-left: 170px; + padding-top: 40px; + + border-top: 1px solid #eee; + } + section.comments form.commentform p.notification { + clear: both; + float: none; + padding-bottom: 25px; + + font-weight: bold; + } + section.comments form.commentform p.notification.error { + color: #c22a0a; + } + section.comments form.commentform legend { + margin-left: -170px; + margin-bottom: 20px; + } + section.comments form.commentform p { + float: left; + width: 365px; + + position: relative; + } + section.comments form.commentform p.email { + position: relative; + right: -15px; + } + section.comments form.commentform p.textarea { + width: 630px; + } + section.comments form.commentform p em { + font: italic 13px Georgia, serif; + + position: absolute; + top: 5px; + right: 15px; + + color: #aaa; + } + section.comments form.commentform label { + display: block; + font-size: 15px; + + padding-bottom: 8px; + } + section.comments form.commentform input, section.comments form.commentform textarea { + width: 320px; + padding: 8px 14px; + margin-bottom: 20px; + + border: 1px solid #bbb; + } + section.comments form.commentform textarea { + width: 700px; + min-height: 150px; + max-height: 400px; + resize: vertical; + } + section.comments form.commentform button { + margin-bottom: 50px; + } + +section.footnote { + clear: both; + width: 730px; + + font: italic 12px/19px Georgia, serif; + text-align: left; + color: #aaa; + + margin: 0 auto 60px; + padding-left: 170px; +} + +footer#bottom { + width: 130px; + height: 80px; + + border-top: 1px solid #f5f5f5; + padding-top: 20px; + + text-align: left; + position: relative; +} + footer#bottom small { + width: 730px; + display: block; + float: left; + + font-size: 13px; + color: #999; + } + footer#bottom small a { + color: #666; + } + footer#bottom small a:hover { + color: #333; + } + footer#bottom ul { + clear: both; + list-style: none; + + position: relative; + top: -8px; + + width: 730px; + } + footer#bottom ul li { + display: inline-block; + float: left; + } + footer#bottom ul a { + color: #aaa; + font-size: 11px; + line-height: 11px; + + padding-right: 15px; + } + footer#bottom ul a:hover { + color: #777; + } + footer#bottom a#attribution { + display: block; + + position: absolute; + left: 876px; + top: 18px; + + width: 24px; + height: 22px; + + background: url('../img/attribution.gif'); + text-indent: -999em; + + opacity: .5; + + -webkit-transition: opacity .25s; + -moz-transition: opacity .25s; + -ms-transition: opacity .25s; + -o-transition: opacity .25s; + transition: opacity .25s; + } + footer#bottom a#attribution:hover { + opacity: 1; + } + +@media only screen and (max-width: 900px), only screen and (max-device-width: 480px) { + + .wrap, .content { + width: 90%; + margin: 0 5%; + padding-left: 0; + } + .content h1 { + padding-top: 50px; + } + + form#search { + padding: 10px 5%; + } + form#search input { + width: 100%; + } + + header#top { + overflow: hidden; + padding-top: 40px; + } + header#top a#logo { + width: 100%; + padding-bottom: 15px; + } + header#top nav { + position: static; + } + header#top nav li { + margin-right: 30px; + } + header#top img#search { + bottom: -20px; + } + + ul.items { + padding-bottom: 20px; + } + ul.items li a { + overflow: hidden; + padding-bottom: 20px; + } + ul.items li a time, ul.items li a h2 { + float: none; + clear: both; + + width: 100%; + } + ul.items li a time { + line-height: 22px; + text-align: left; + } + + section.comments { + margin-top: 40px; + width: auto; + } + section.comments h1 { + padding: 0 20px; + line-height: 20px; + } + section.comments ul { + padding: 0; + } + section.comments ul li { + width: 90%; + padding: 20px 5%; + margin-bottom: 0; + border-bottom: 1px solid #ddd; + + position: relative; + } + section.comments ul li:last-child { + border-bottom: none; + } + section.comments ul li time { + position: absolute; + right: 20px; + top: 20px; + } + section.comments div.content { + width: auto; + padding-top: 0; + } + section.comments form.commentform { + padding: 20px 20px; + position: relative; + } + section.comments form.commentform legend { + margin-left: 0; + } + section.comments form.commentform p, section.comments form.commentform p.textarea { + float: none; + width: 100%; + } + section.comments form.commentform p.email { + right: 0; + } + + section.comments form.commentform input, section.comments form.commentform textarea { + width: 93%; + } + + section.footnote { + width: 90%; + + margin: 30px 5%; + padding: 0; + } + + footer#bottom, footer#bottom small, footer#bottom ul { + width: 100%; + } + footer#bottom a#attribution { + left: auto; + right: 0; + + top: 30px; + } +} \ No newline at end of file diff --git a/testcms-final-anon/themes/default/functions.php b/testcms-final-anon/themes/default/functions.php new file mode 100644 index 0000000..a7da7d8 --- /dev/null +++ b/testcms-final-anon/themes/default/functions.php @@ -0,0 +1,59 @@ + 4) ? 'th' : (($test < 4) ? ($test < 3) ? ($test < 2) ? ($test < 1) ? 'th' : 'st' : 'nd' : 'rd' : 'th')); + return $number . $ext; +} + +function count_words($str) { + return count(preg_split('/\s+/', strip_tags($str), null, PREG_SPLIT_NO_EMPTY)); +} + +function pluralise($amount, $str, $alt = '') { + return intval($amount) === 1 ? $str : $str . ($alt !== '' ? $alt : 's'); +} + +function relative_time($date) { + $elapsed = time() - $date; + + if($elapsed <= 1) { + return 'Just now'; + } + + $times = array( + 31104000 => 'year', + 2592000 => 'month', + 604800 => 'week', + 86400 => 'day', + 3600 => 'hour', + 60 => 'minute', + 1 => 'second' + ); + + foreach($times as $seconds => $title) { + $rounded = $elapsed / $seconds; + + if($rounded > 1) { + $rounded = round($rounded); + return $rounded . ' ' . pluralise($rounded, $title) . ' ago'; + } + } +} + + +/** + Binding custom functions + This is just an example of what can be done + + bind('about', function() { + return 'about page'; + }); +*/ \ No newline at end of file diff --git a/testcms-final-anon/themes/default/img/attribution.gif b/testcms-final-anon/themes/default/img/attribution.gif new file mode 100644 index 0000000000000000000000000000000000000000..1f876bf3080d08cbdd548754d431d8b484d87ac5 GIT binary patch literal 2116 zcmah~VN4rk7=GLPS|s4b5QPp5-Zpf&0BM;)2yRMSC}r3+rA&sJd0embN6$T-J z?9YsUocd3HIO`Jqu{jep;+$dg$5@QZW)?IkSu|NPmZ>3yzlqjccE}!XBS@!9>@bUH8su8&o3-2EG;eRx(>x_=ij6fzy&+?s&F6>3;9Dn zudf~b6(952tnB0fCexaN4sPVgC|9uxPS^oeP!CnSpk{lb(LtJua*HYL`@J8*L7#54 zmiODtGN>vcsse!H0rX`OsxXQ87)q6etfB$9Z=t<&TFWA?cogx&3JOH*rFh)LL5jyr zJYsO-u>f+YR#r&y3B+@VTgFQ4`0(Pl)IOj43X!(k5p<1S&| z4^GNCEZVplajaG+h7RJrnHHZ?`eOxrO5l5k5I3RyN>=kz`xA(N&rJ;XAl?h$tVt?; z!zSPP%xo(D0^(Y55ff6%JZTI$BeNV<3{v4jRpbAbIcj;6gU}DN4#Vo{=3N_*-tu27jWcR z@*Fupf@tj`-IjuAiB1m2;SMS_^SlN*oSEu44E~e#xn?VdJFXm+gllhZpqfIJI+mHS z37E(#8AWGGTL3DypjcjOX``0sE_f^tw?Y3D62ZxLf->1Q@TdsB23XZF;H9Ow* zi)#&ktI&hmWJA#;s*;SQP%U1oT?Dc&;a>wD$KQ~bL9Iol+m@iyv-c(Q@fB6z3~#wg@uoXB*hvY><77eViS%SR7l&`q+MU4|*D`g_CXnwpt`O zg3S{3LSM^IMqdI6hEa+H(=bY_&*!BlWymt40o?P=q_q7|(j%q(1P&ajb z6A!J5w*j`^()EAxy1w-x=3fK2DAVJZp0^$}42+y#`()R5;oCL4?_T|E@#V!zh`y5V ze>e5>*^e5&J$vSdjuW@1cWgEuZT*s|oeAY1@+5o};TPi_x#6MD-F literal 0 HcmV?d00001 diff --git a/testcms-final-anon/themes/default/img/close.gif b/testcms-final-anon/themes/default/img/close.gif new file mode 100644 index 0000000000000000000000000000000000000000..8b3cc05a630bcb4882c02ea14c688ee00897d896 GIT binary patch literal 140 zcmZ?wbhEHbAepUXrfEm7gov hULYXu&B-pjEX^``($+r1HZn=0=pp}Ec8UPR5GL8TM literal 0 HcmV?d00001 diff --git a/testcms-final-anon/themes/default/img/search.gif b/testcms-final-anon/themes/default/img/search.gif new file mode 100644 index 0000000000000000000000000000000000000000..b4b79664daa8b933c6325921d468b4e3b708029c GIT binary patch literal 210 zcmZ?wbhEHb(*JbW}P^3 zV)5d|r%#{WxN+m_*RNl`e0k~8rBkO)-Me>h{rdH*R;^mNaN)IU*XGZk|M~N025dm_ zCkrD3g9L*PND^cx1FOG68}Ert3e78$m>%pqWTn#j$;NA<$127ntFF0}GO&a(9%#&P zVba@sUyCVYMH*|{;e#3sI;*d}cD0NXoa)T%#2|1+J9NR{KIPkN)|VPM7#XYq|1Dfr literal 0 HcmV?d00001 diff --git a/testcms-final-anon/themes/default/includes/comment_form.php b/testcms-final-anon/themes/default/includes/comment_form.php new file mode 100644 index 0000000..ac2ce18 --- /dev/null +++ b/testcms-final-anon/themes/default/includes/comment_form.php @@ -0,0 +1,48 @@ + +
+ +

Add your own

+ + +
    + +
  • +

    + + +
    + +
    +
  • + +
+ + +
+ Add your comments + + + +

+ + +

+ + + +

+ + +

+ +

+ +

+
+ +
+ \ No newline at end of file diff --git a/testcms-final-anon/themes/default/includes/footer.php b/testcms-final-anon/themes/default/includes/footer.php new file mode 100644 index 0000000..f7d30f2 --- /dev/null +++ b/testcms-final-anon/themes/default/includes/footer.php @@ -0,0 +1,51 @@ +
+ + + + + + +
+ + diff --git a/testcms-final-anon/themes/default/includes/header.php b/testcms-final-anon/themes/default/includes/header.php new file mode 100644 index 0000000..f58087f --- /dev/null +++ b/testcms-final-anon/themes/default/includes/header.php @@ -0,0 +1,57 @@ + + + + + <?php echo page_title('Page can’t be found'); ?> - <?php echo site_name(); ?> + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
diff --git a/testcms-final-anon/themes/default/js/main.js b/testcms-final-anon/themes/default/js/main.js new file mode 100644 index 0000000..190ee8e --- /dev/null +++ b/testcms-final-anon/themes/default/js/main.js @@ -0,0 +1,52 @@ +$(function() { + + var viewport = $(window), + body = $('body'), + + header = $('#top div.wrap'), + search = $('#search'); + + // Give a CSS hook + body.addClass('js'); + + // A neat little + if(window.location.pathname === '/') { + body.css({position: 'relative', top: -50, opacity: 0}) + .animate({ top: 0, opacity: 1 }); + } + + /** + Search box + */ + + // Hide the search + search.css('margin-top', -(search.outerHeight() - 4)); + + // Append some way of making it come back + var clicked = 1, + marginTop = search.css('margin-top'); + + header.append('').children('#search').click(function() { + + // Move the + search.animate({marginTop: clicked % 2 === 0 ? marginTop : 0}); + + if(clicked % 2 === 0) { + $(this).animate({opacity: 0}, 200, function() { + $(this).attr('src', base + 'img/search.gif').animate({opacity: 1}, 200); + }); + + search.animate({marginTop: marginTop}); + } else { + + $(this).animate({opacity: 0}, 200, function() { + $(this).attr('src', base + 'img/close.gif').animate({opacity: 1}, 200); + }); + + search.animate({marginTop: 0}); + } + + // Increment counter + clicked++; + }); +}); \ No newline at end of file diff --git a/testcms-final-anon/themes/default/page.php b/testcms-final-anon/themes/default/page.php new file mode 100644 index 0000000..256ffae --- /dev/null +++ b/testcms-final-anon/themes/default/page.php @@ -0,0 +1,12 @@ + +
+

+ + + + +
+ diff --git a/testcms-final-anon/themes/default/posts.php b/testcms-final-anon/themes/default/posts.php new file mode 100644 index 0000000..d2bb6b2 --- /dev/null +++ b/testcms-final-anon/themes/default/posts.php @@ -0,0 +1,21 @@ +
+ + + + +

+ + +

Looks like you have some writing to do!

+ + +
\ No newline at end of file diff --git a/testcms-final-anon/themes/default/search.php b/testcms-final-anon/themes/default/search.php new file mode 100644 index 0000000..313d333 --- /dev/null +++ b/testcms-final-anon/themes/default/search.php @@ -0,0 +1,25 @@ +
+ +

You searched for “”.

+ + +

We found for “

+ + +

+ + +

Unfortunately, there's no results for “”. Did you spell everything correctly?

+ + +
+ diff --git a/testcms-final-anon/upgrade/assets/css/app.css b/testcms-final-anon/upgrade/assets/css/app.css new file mode 100644 index 0000000..da354e8 --- /dev/null +++ b/testcms-final-anon/upgrade/assets/css/app.css @@ -0,0 +1,171 @@ +body { + background: #f4f8fa; + + font: 13px/22px "Helvetica Neue", sans-serif; + color: #6c7f85; + text-shadow: 0 1px 0 #fff; + + width: 720px; + margin: 50px auto 40px; +} + +h1 { + text-align: center; + margin-bottom: 60px; +} + +h2 { + font-size: 32px; + font-weight: 300; + color: #57829e; +} + +a { + color: #57829e; +} + +.content { + padding: 20px 40px; + + background: #fff; + box-shadow: 0 1px 1px #c8d3da, inset 0 -2px 1px #f6f9fb; + border-radius: 4px; +} + +small { + font-size: 11px; + line-height: 18px; + + display: block; + padding: 8px 12px; + + background: #ffe; + color: #775; + border: 1px solid #eed; + border-radius: 3px; +} + +p.error, p.success { + color: #fff; + text-shadow: 0 1px 1px rgba(0,0,0,.3); + text-align: center; + padding: 10px; + + border-radius: 3px; +} + +p.error { + background: #900; +} + +p.success { + background: #757e0e; +} + + +form { + overflow: hidden; + width: 720px; +} + +fieldset { + border: 1px solid #d5e4eb; + border-radius: 3px; + + margin: 30px 36px 30px 0; + padding: 5px 25px; + + float: left; + overflow: hidden; + position: relative; + + width: 250px; +} + legend { + font-weight: bold; + } + + label { + display: block; + font-size: 12px; + font-weight: bold; + cursor: pointer; + } + + input, textarea { + font: 13px "Helvetica Neue", sans-serif; + padding: 5px 8px; + width: 230px; + } + textarea { + min-height: 70px; + max-height: 250px; + resize: vertical; + } + select { + width: 245px; + padding: 4px 8px; + } + +button, .button { + font: bold 13px "Helvetica Neue", sans-serif; + color: #fff; + text-shadow: 0 1px 1px rgba(0,0,0,.3); + text-decoration: none; + + display: block; + width: auto; + float: right; + cursor: pointer; + + margin-bottom: 20px; + padding: 6px 9px; + + border: 1px solid #2f4a57; + border-radius: 3px; + + background-color: #587786; + background-image: -webkit-gradient(linear, left top, left bottom, from(#6c8894), to(#486472)); + background-image: -webkit-linear-gradient(top, #6c8894, #486472); + background-image: -moz-linear-gradient(top, #6c8894, #486472); + background-image: -o-linear-gradient(top, #6c8894, #486472); + background-image: -ms-linear-gradient(top, #6c8894, #486472); + background-image: linear-gradient(top, #6c8894, #486472); + filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0,StartColorStr='#6c8894', EndColorStr='#486472'); + + box-shadow: inset 0 1px 0 rgba(255,255,255,.15), 0 1px 1px rgba(0,0,0,.05); +} + + form > button, form > p { + margin-right: 75px; + } + + button:hover, .button:hover { + opacity: .9; + } + button:active, .button:active { + opacity: 1; + + background-color: #3a5968; + background-image: -webkit-gradient(linear, left top, left bottom, from(#365361), to(#587684)); + background-image: -webkit-linear-gradient(top, #365361, #587684); + background-image: -moz-linear-gradient(top, #365361, #587684); + background-image: -o-linear-gradient(top, #365361, #587684); + background-image: -ms-linear-gradient(top, #365361, #587684); + background-image: linear-gradient(top, #365361, #587684); + filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0,StartColorStr='#365361', EndColorStr='#587684'); + + box-shadow: inset 0 1px 1px rgba(0,0,0,.15), 0 -1px 1px rgba(0,0,0,.1); + + border-color: #192e39; + } + +p.footer { + font-size: 12px; + text-align: center; + + padding-top: 40px; +} + p.footer a { + color: #587684; + } diff --git a/testcms-final-anon/upgrade/assets/img/logo.gif b/testcms-final-anon/upgrade/assets/img/logo.gif new file mode 100644 index 0000000000000000000000000000000000000000..1f876bf3080d08cbdd548754d431d8b484d87ac5 GIT binary patch literal 2116 zcmah~VN4rk7=GLPS|s4b5QPp5-Zpf&0BM;)2yRMSC}r3+rA&sJd0embN6$T-J z?9YsUocd3HIO`Jqu{jep;+$dg$5@QZW)?IkSu|NPmZ>3yzlqjccE}!XBS@!9>@bUH8su8&o3-2EG;eRx(>x_=ij6fzy&+?s&F6>3;9Dn zudf~b6(952tnB0fCexaN4sPVgC|9uxPS^oeP!CnSpk{lb(LtJua*HYL`@J8*L7#54 zmiODtGN>vcsse!H0rX`OsxXQ87)q6etfB$9Z=t<&TFWA?cogx&3JOH*rFh)LL5jyr zJYsO-u>f+YR#r&y3B+@VTgFQ4`0(Pl)IOj43X!(k5p<1S&| z4^GNCEZVplajaG+h7RJrnHHZ?`eOxrO5l5k5I3RyN>=kz`xA(N&rJ;XAl?h$tVt?; z!zSPP%xo(D0^(Y55ff6%JZTI$BeNV<3{v4jRpbAbIcj;6gU}DN4#Vo{=3N_*-tu27jWcR z@*Fupf@tj`-IjuAiB1m2;SMS_^SlN*oSEu44E~e#xn?VdJFXm+gllhZpqfIJI+mHS z37E(#8AWGGTL3DypjcjOX``0sE_f^tw?Y3D62ZxLf->1Q@TdsB23XZF;H9Ow* zi)#&ktI&hmWJA#;s*;SQP%U1oT?Dc&;a>wD$KQ~bL9Iol+m@iyv-c(Q@fB6z3~#wg@uoXB*hvY><77eViS%SR7l&`q+MU4|*D`g_CXnwpt`O zg3S{3LSM^IMqdI6hEa+H(=bY_&*!BlWymt40o?P=q_q7|(j%q(1P&ajb z6A!J5w*j`^()EAxy1w-x=3fK2DAVJZp0^$}42+y#`()R5;oCL4?_T|E@#V!zh`y5V ze>e5>*^e5&J$vSdjuW@1cWgEuZT*s|oeAY1@+5o};TPi_x#6MD-F literal 0 HcmV?d00001 diff --git a/testcms-final-anon/upgrade/classes/migrations.php b/testcms-final-anon/upgrade/classes/migrations.php new file mode 100644 index 0000000..fc5d9f7 --- /dev/null +++ b/testcms-final-anon/upgrade/classes/migrations.php @@ -0,0 +1,23 @@ +queries[] = $sql; + } + + /* + Execute + */ + public function apply() { + foreach($this->queries as $sql) { + Db::query($sql); + } + } + +} \ No newline at end of file diff --git a/testcms-final-anon/upgrade/classes/schema.php b/testcms-final-anon/upgrade/classes/schema.php new file mode 100644 index 0000000..41edc39 --- /dev/null +++ b/testcms-final-anon/upgrade/classes/schema.php @@ -0,0 +1,16 @@ +rowCount() > 0; + } + +} \ No newline at end of file diff --git a/testcms-final-anon/upgrade/complete.php b/testcms-final-anon/upgrade/complete.php new file mode 100644 index 0000000..0510748 --- /dev/null +++ b/testcms-final-anon/upgrade/complete.php @@ -0,0 +1,22 @@ + + + + + Upgrade Test CMS + + + + + +

Test CMS install logo

+ +
+

Upgrade Complete.

+ +

Enjoy.

+ +

Continue to your site

+
+ + + diff --git a/testcms-final-anon/upgrade/index.php b/testcms-final-anon/upgrade/index.php new file mode 100644 index 0000000..7289c11 --- /dev/null +++ b/testcms-final-anon/upgrade/index.php @@ -0,0 +1,62 @@ + + + + + Upgrade Test CMS + + + + + +

Test CMS install logo

+ + + + + +
+

Woops.

+ +

Looks like we've hit a problem.

+ +
    + +
  • + +
+ +

Ok ive fixed these, start migration

+
+ + + +
+

Upgrading Test CMS.

+ +

Thank you for downloading the latest version of Test CMS. + To get you up and running we need to make a few changes to bring you up to date.

+ +
+ +
+
+ + + + + diff --git a/testcms-final-anon/upgrade/migrations.php b/testcms-final-anon/upgrade/migrations.php new file mode 100644 index 0000000..69d92e7 --- /dev/null +++ b/testcms-final-anon/upgrade/migrations.php @@ -0,0 +1,97 @@ + 0.5 +*/ +$migration = new Migrations; + +if(Schema::has('users', 'email') === false) { + $sql = "alter table `users` add `email` varchar( 140 ) not null after `password`"; + $migration->query($sql); +} + +if(Schema::has('posts', 'comments') === false) { + $sql = "alter table `posts` add `comments` tinyint( 1 ) not null"; + $migration->query($sql); +} + +if(Schema::has('posts', 'custom_fields') === false) { + $sql = "alter table `posts` add `custom_fields` text not null after `js`"; + $migration->query($sql); +} + +$sql = "create table if not exists `comments` ( + `id` int(6) not null auto_increment, + `post` int(6) not null, + `status` enum('pending','published','spam') not null, + `date` int(11) not null, + `name` varchar(140) not null, + `email` varchar(140) not null, + `text` text not null, + primary key (`id`), + key `post` (`post`), + key `status` (`status`) +) engine=myisam charset=utf8 collate=utf8_general_ci"; +$migration->query($sql); + +// rename show_posts +$sql = "update `meta` set `value` = 'posts_page' where `value` = 'show_posts'"; +$migration->query($sql); + +// make posts_page the home page +if(Schema::has('meta', 'key', 'home_page') === false) { + $posts_page = Db::query("select `value` from meta where `key` = 'show_posts'")->fetchColumn(); + + $sql = "insert into `meta` (`key`, `value`) values ('home_page', '" . $posts_page . "')"; + $migration->query($sql); +} + +// [BUGFIX] make sure the password field is big enough +$sql = "alter table `users` change `password` `password` text character set utf8 COLLATE utf8_general_ci not null"; +$migration->query($sql); + +// apply changes +$migration->apply(); + +// update config +Config::set('application.admin_folder', 'admin'); +Config::set('application.key', random(32)); + +/* + 0.5 --> 0.6 +*/ +$migration = new Migrations; + +$sql = "create table if not exists `sessions` ( + `id` char( 32 ) not null , + `date` datetime not null , + `ip` varchar( 15 ) not null , + `ua` varchar( 140 ) not null , + `data` text not null +) engine=innodb charset=utf8 collate=utf8_general_ci;"; +$migration->query($sql); + +// comments auto published option +if(Schema::has('meta', 'key', 'auto_published_comments') === false) { + $sql = "insert into `meta` (`key`, `value`) values ('auto_published_comments', '0')"; + $migration->query($sql); +} + +// pagination +if(Schema::has('meta', 'key', 'posts_per_page') === false) { + $sql = "insert into `meta` (`key`, `value`) values ('posts_per_page', '10')"; + $migration->query($sql); +} + +// apply changes +$migration->apply(); + +// update config +Config::set('session.name', 'testcms'); +Config::set('session.expire', 3600); +Config::set('session.path', '/'); +Config::set('session.domain', ''); + +Config::set('error.ignore', array(E_NOTICE, E_USER_NOTICE, E_DEPRECATED, E_USER_DEPRECATED)); +Config::set('error.detail', true); +Config::set('error.log', false); diff --git a/testcms-final-anon/upgrade/run.php b/testcms-final-anon/upgrade/run.php new file mode 100644 index 0000000..d4b2e54 --- /dev/null +++ b/testcms-final-anon/upgrade/run.php @@ -0,0 +1,81 @@ + PATH . 'upgrade/classes/schema.php', + 'Migrations' => PATH . 'upgrade/classes/migrations.php' +)); + +// tell the autoloader where to find classes +Autoloader::directory(array( + PATH . 'system/classes/' +)); + +// register the auto loader +Autoloader::register(); + +/** + Report all errors let our error class decide which to display +*/ +error_reporting(-1); + +/** + Error display will be handled by our error class +*/ +ini_safe_set('display_errors', false); + +// Register the default timezone for the application. +date_default_timezone_set(Config::get('application.timezone')); + +// Register the PHP exception handler. +set_exception_handler(array('Error', 'exception')); + +// Register the PHP error handler. +set_error_handler(array('Error', 'native')); + +// Register the shutdown handler. +register_shutdown_function(array('Error', 'shutdown')); + +// load current config file +Config::load(PATH . 'config.php'); + +// add and apply migrations +require PATH . 'upgrade/migrations.php'; + +// write any config changes +Config::write(PATH . 'config.php', Config::get()); + +// redirect +header('Location: complete.php'); \ No newline at end of file diff --git a/todo.txt b/todo.txt new file mode 100644 index 0000000..b1a840f --- /dev/null +++ b/todo.txt @@ -0,0 +1,10 @@ +V2. Authentication +V3. Session Management +V4. Access Control +V5. Input Validation +V6. Output Encoding/Escaping +V7. Cryptography at rest +V8. Error Handling & logging +V9. Data Protection +V11. HTTP Security +V16. Files and Recourses -- 2.20.1