Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Initial project commit.

Based on https://github.com/mvriel/joind.in-experimental, with additional Joind.in API class and autoloader (and added documentation)
  • Loading branch information...
commit 632b83aac79208dd4885afd804b8d689349aa9dc 1 parent 99fb7d0
Clair authored
Showing with 24,373 additions and 3 deletions.
  1. +10 −0 .gitignore
  2. +25 −0 CONTRIBUTING.md
  3. +32 −0 Controller/Application.php
  4. +16 −0 Controller/Base.php
  5. +34 −0 Controller/Event.php
  6. +18 −0 Model/API/JoindIn.php
  7. +23 −0 Model/Collection/Event.php
  8. +42 −0 Model/Event.php
  9. +138 −3 README.md
  10. +45 −0 Vendor/Slim/Exception/Pass.php
  11. +46 −0 Vendor/Slim/Exception/RequestSlash.php
  12. +43 −0 Vendor/Slim/Exception/Stop.php
  13. +222 −0 Vendor/Slim/Http/Cookie.php
  14. +401 −0 Vendor/Slim/Http/CookieJar.php
  15. +405 −0 Vendor/Slim/Http/Request.php
  16. +326 −0 Vendor/Slim/Http/Response.php
  17. +131 −0 Vendor/Slim/Http/Uri.php
  18. +155 −0 Vendor/Slim/Log.php
  19. +200 −0 Vendor/Slim/Logger.php
  20. +398 −0 Vendor/Slim/Route.php
  21. +203 −0 Vendor/Slim/Router.php
  22. +192 −0 Vendor/Slim/Session/Flash.php
  23. +125 −0 Vendor/Slim/Session/Handler.php
  24. +71 −0 Vendor/Slim/Session/Handler/Cookies.php
  25. +1,169 −0 Vendor/Slim/Slim.php
  26. +164 −0 Vendor/Slim/View.php
  27. +9 −0 Vendor/Twig/AUTHORS
  28. +455 −0 Vendor/Twig/CHANGELOG
  29. +31 −0 Vendor/Twig/LICENSE
  30. +15 −0 Vendor/Twig/README.markdown
  31. +42 −0 Vendor/Twig/bin/create_pear_package.php
  32. +27 −0 Vendor/Twig/composer.json
  33. +489 −0 Vendor/Twig/doc/advanced.rst
  34. +479 −0 Vendor/Twig/doc/api.rst
  35. +101 −0 Vendor/Twig/doc/coding_standards.rst
  36. +328 −0 Vendor/Twig/doc/extensions.rst
  37. +11 −0 Vendor/Twig/doc/filters/capitalize.rst
  38. +21 −0 Vendor/Twig/doc/filters/convert_encoding.rst
  39. +58 −0 Vendor/Twig/doc/filters/date.rst
  40. +28 −0 Vendor/Twig/doc/filters/default.rst
  41. +30 −0 Vendor/Twig/doc/filters/escape.rst
  42. +16 −0 Vendor/Twig/doc/filters/format.rst
  43. +29 −0 Vendor/Twig/doc/filters/index.rst
  44. +18 −0 Vendor/Twig/doc/filters/join.rst
  45. +14 −0 Vendor/Twig/doc/filters/json_encode.rst
  46. +11 −0 Vendor/Twig/doc/filters/keys.rst
  47. +12 −0 Vendor/Twig/doc/filters/length.rst
  48. +10 −0 Vendor/Twig/doc/filters/lower.rst
  49. +41 −0 Vendor/Twig/doc/filters/merge.rst
  50. +22 −0 Vendor/Twig/doc/filters/nl2br.rst
  51. +38 −0 Vendor/Twig/doc/filters/number_format.rst
  52. +12 −0 Vendor/Twig/doc/filters/raw.rst
  53. +14 −0 Vendor/Twig/doc/filters/replace.rst
  54. +23 −0 Vendor/Twig/doc/filters/reverse.rst
  55. +57 −0 Vendor/Twig/doc/filters/slice.rst
  56. +17 −0 Vendor/Twig/doc/filters/sort.rst
  57. +15 −0 Vendor/Twig/doc/filters/striptags.rst
  58. +11 −0 Vendor/Twig/doc/filters/title.rst
  59. +10 −0 Vendor/Twig/doc/filters/upper.rst
  60. +14 −0 Vendor/Twig/doc/filters/url_encode.rst
  61. +18 −0 Vendor/Twig/doc/functions/attribute.rst
  62. +15 −0 Vendor/Twig/doc/functions/block.rst
  63. +9 −0 Vendor/Twig/doc/functions/constant.rst
  64. +20 −0 Vendor/Twig/doc/functions/cycle.rst
  65. +46 −0 Vendor/Twig/doc/functions/date.rst
  66. +58 −0 Vendor/Twig/doc/functions/dump.rst
  67. +15 −0 Vendor/Twig/doc/functions/index.rst
  68. +20 −0 Vendor/Twig/doc/functions/parent.rst
  69. +24 −0 Vendor/Twig/doc/functions/random.rst
  70. +38 −0 Vendor/Twig/doc/functions/range.rst
  71. +184 −0 Vendor/Twig/doc/hacking.rst
  72. +18 −0 Vendor/Twig/doc/index.rst
  73. +128 −0 Vendor/Twig/doc/intro.rst
  74. +301 −0 Vendor/Twig/doc/recipes.rst
  75. +43 −0 Vendor/Twig/doc/tags/autoescape.rst
  76. +11 −0 Vendor/Twig/doc/tags/block.rst
  77. +12 −0 Vendor/Twig/doc/tags/do.rst
  78. +187 −0 Vendor/Twig/doc/tags/extends.rst
  79. +21 −0 Vendor/Twig/doc/tags/filter.rst
  80. +17 −0 Vendor/Twig/doc/tags/flush.rst
  81. +149 −0 Vendor/Twig/doc/tags/for.rst
  82. +8 −0 Vendor/Twig/doc/tags/from.rst
  83. +43 −0 Vendor/Twig/doc/tags/if.rst
  84. +79 −0 Vendor/Twig/doc/tags/import.rst
  85. +86 −0 Vendor/Twig/doc/tags/include.rst
  86. +22 −0 Vendor/Twig/doc/tags/index.rst
  87. +91 −0 Vendor/Twig/doc/tags/macro.rst
  88. +16 −0 Vendor/Twig/doc/tags/raw.rst
  89. +32 −0 Vendor/Twig/doc/tags/set.rst
  90. +37 −0 Vendor/Twig/doc/tags/spaceless.rst
  91. +123 −0 Vendor/Twig/doc/tags/use.rst
  92. +719 −0 Vendor/Twig/doc/templates.rst
  93. +11 −0 Vendor/Twig/doc/tests/constant.rst
  94. +30 −0 Vendor/Twig/doc/tests/defined.rst
  95. +10 −0 Vendor/Twig/doc/tests/divisibleby.rst
  96. +11 −0 Vendor/Twig/doc/tests/empty.rst
  97. +10 −0 Vendor/Twig/doc/tests/even.rst
  98. +14 −0 Vendor/Twig/doc/tests/index.rst
  99. +12 −0 Vendor/Twig/doc/tests/null.rst
  100. +10 −0 Vendor/Twig/doc/tests/odd.rst
  101. +11 −0 Vendor/Twig/doc/tests/sameas.rst
  102. +30 −0 Vendor/Twig/ext/twig/.gitignore
  103. +22 −0 Vendor/Twig/ext/twig/LICENSE
  104. +8 −0 Vendor/Twig/ext/twig/config.m4
  105. +8 −0 Vendor/Twig/ext/twig/config.w32
  106. +49 −0 Vendor/Twig/ext/twig/php_twig.h
  107. +1,021 −0 Vendor/Twig/ext/twig/twig.c
  108. +46 −0 Vendor/Twig/lib/Twig/Autoloader.php
  109. +219 −0 Vendor/Twig/lib/Twig/Compiler.php
  110. +35 −0 Vendor/Twig/lib/Twig/CompilerInterface.php
  111. +1,060 −0 Vendor/Twig/lib/Twig/Environment.php
  112. +195 −0 Vendor/Twig/lib/Twig/Error.php
  113. +20 −0 Vendor/Twig/lib/Twig/Error/Loader.php
  114. +21 −0 Vendor/Twig/lib/Twig/Error/Runtime.php
  115. +21 −0 Vendor/Twig/lib/Twig/Error/Syntax.php
  116. +488 −0 Vendor/Twig/lib/Twig/ExpressionParser.php
  117. +93 −0 Vendor/Twig/lib/Twig/Extension.php
  118. +1,004 −0 Vendor/Twig/lib/Twig/Extension/Core.php
  119. +64 −0 Vendor/Twig/lib/Twig/Extension/Debug.php
  120. +77 −0 Vendor/Twig/lib/Twig/Extension/Escaper.php
  121. +35 −0 Vendor/Twig/lib/Twig/Extension/Optimizer.php
  122. +112 −0 Vendor/Twig/lib/Twig/Extension/Sandbox.php
  123. +84 −0 Vendor/Twig/lib/Twig/ExtensionInterface.php
  124. +69 −0 Vendor/Twig/lib/Twig/Filter.php
  125. +33 −0 Vendor/Twig/lib/Twig/Filter/Function.php
  126. +34 −0 Vendor/Twig/lib/Twig/Filter/Method.php
  127. +37 −0 Vendor/Twig/lib/Twig/Filter/Node.php
  128. +38 −0 Vendor/Twig/lib/Twig/FilterInterface.php
  129. +63 −0 Vendor/Twig/lib/Twig/Function.php
  130. +34 −0 Vendor/Twig/lib/Twig/Function/Function.php
  131. +35 −0 Vendor/Twig/lib/Twig/Function/Method.php
  132. +37 −0 Vendor/Twig/lib/Twig/Function/Node.php
  133. +37 −0 Vendor/Twig/lib/Twig/FunctionInterface.php
  134. +406 −0 Vendor/Twig/lib/Twig/Lexer.php
  135. +29 −0 Vendor/Twig/lib/Twig/LexerInterface.php
  136. +102 −0 Vendor/Twig/lib/Twig/Loader/Array.php
  137. +100 −0 Vendor/Twig/lib/Twig/Loader/Chain.php
  138. +152 −0 Vendor/Twig/lib/Twig/Loader/Filesystem.php
  139. +59 −0 Vendor/Twig/lib/Twig/Loader/String.php
  140. +45 −0 Vendor/Twig/lib/Twig/LoaderInterface.php
  141. +38 −0 Vendor/Twig/lib/Twig/Markup.php
  142. +227 −0 Vendor/Twig/lib/Twig/Node.php
  143. +40 −0 Vendor/Twig/lib/Twig/Node/AutoEscape.php
  144. +45 −0 Vendor/Twig/lib/Twig/Node/Block.php
  145. +38 −0 Vendor/Twig/lib/Twig/Node/BlockReference.php
  146. +20 −0 Vendor/Twig/lib/Twig/Node/Body.php
  147. +39 −0 Vendor/Twig/lib/Twig/Node/Do.php
  148. +21 −0 Vendor/Twig/lib/Twig/Node/Expression.php
  149. +86 −0 Vendor/Twig/lib/Twig/Node/Expression/Array.php
  150. +28 −0 Vendor/Twig/lib/Twig/Node/Expression/AssignName.php
  151. +40 −0 Vendor/Twig/lib/Twig/Node/Expression/Binary.php
  152. +18 −0 Vendor/Twig/lib/Twig/Node/Expression/Binary/Add.php
  153. +18 −0 Vendor/Twig/lib/Twig/Node/Expression/Binary/And.php
  154. +18 −0 Vendor/Twig/lib/Twig/Node/Expression/Binary/BitwiseAnd.php
  155. +18 −0 Vendor/Twig/lib/Twig/Node/Expression/Binary/BitwiseOr.php
  156. +18 −0 Vendor/Twig/lib/Twig/Node/Expression/Binary/BitwiseXor.php
  157. +18 −0 Vendor/Twig/lib/Twig/Node/Expression/Binary/Concat.php
  158. +18 −0 Vendor/Twig/lib/Twig/Node/Expression/Binary/Div.php
  159. +17 −0 Vendor/Twig/lib/Twig/Node/Expression/Binary/Equal.php
  160. +29 −0 Vendor/Twig/lib/Twig/Node/Expression/Binary/FloorDiv.php
  161. +17 −0 Vendor/Twig/lib/Twig/Node/Expression/Binary/Greater.php
  162. +17 −0 Vendor/Twig/lib/Twig/Node/Expression/Binary/GreaterEqual.php
  163. +33 −0 Vendor/Twig/lib/Twig/Node/Expression/Binary/In.php
  164. +17 −0 Vendor/Twig/lib/Twig/Node/Expression/Binary/Less.php
  165. +17 −0 Vendor/Twig/lib/Twig/Node/Expression/Binary/LessEqual.php
  166. +18 −0 Vendor/Twig/lib/Twig/Node/Expression/Binary/Mod.php
  167. +18 −0 Vendor/Twig/lib/Twig/Node/Expression/Binary/Mul.php
  168. +17 −0 Vendor/Twig/lib/Twig/Node/Expression/Binary/NotEqual.php
  169. +33 −0 Vendor/Twig/lib/Twig/Node/Expression/Binary/NotIn.php
  170. +18 −0 Vendor/Twig/lib/Twig/Node/Expression/Binary/Or.php
  171. +33 −0 Vendor/Twig/lib/Twig/Node/Expression/Binary/Power.php
  172. +33 −0 Vendor/Twig/lib/Twig/Node/Expression/Binary/Range.php
  173. +18 −0 Vendor/Twig/lib/Twig/Node/Expression/Binary/Sub.php
  174. +52 −0 Vendor/Twig/lib/Twig/Node/Expression/BlockReference.php
  175. +31 −0 Vendor/Twig/lib/Twig/Node/Expression/Conditional.php
  176. +23 −0 Vendor/Twig/lib/Twig/Node/Expression/Constant.php
  177. +34 −0 Vendor/Twig/lib/Twig/Node/Expression/ExtensionReference.php
  178. +61 −0 Vendor/Twig/lib/Twig/Node/Expression/Filter.php
  179. +44 −0 Vendor/Twig/lib/Twig/Node/Expression/Filter/Default.php
  180. +66 −0 Vendor/Twig/lib/Twig/Node/Expression/Function.php
  181. +53 −0 Vendor/Twig/lib/Twig/Node/Expression/GetAttr.php
  182. +37 −0 Vendor/Twig/lib/Twig/Node/Expression/MethodCall.php
  183. +76 −0 Vendor/Twig/lib/Twig/Node/Expression/Name.php
  184. +48 −0 Vendor/Twig/lib/Twig/Node/Expression/Parent.php
  185. +22 −0 Vendor/Twig/lib/Twig/Node/Expression/TempName.php
  186. +54 −0 Vendor/Twig/lib/Twig/Node/Expression/Test.php
  187. +36 −0 Vendor/Twig/lib/Twig/Node/Expression/Test/Constant.php
  188. +55 −0 Vendor/Twig/lib/Twig/Node/Expression/Test/Defined.php
  189. +34 −0 Vendor/Twig/lib/Twig/Node/Expression/Test/Divisibleby.php
  190. +33 −0 Vendor/Twig/lib/Twig/Node/Expression/Test/Even.php
  191. +32 −0 Vendor/Twig/lib/Twig/Node/Expression/Test/Null.php
  192. +33 −0 Vendor/Twig/lib/Twig/Node/Expression/Test/Odd.php
  193. +30 −0 Vendor/Twig/lib/Twig/Node/Expression/Test/Sameas.php
  194. +30 −0 Vendor/Twig/lib/Twig/Node/Expression/Unary.php
  195. +18 −0 Vendor/Twig/lib/Twig/Node/Expression/Unary/Neg.php
  196. +18 −0 Vendor/Twig/lib/Twig/Node/Expression/Unary/Not.php
  197. +18 −0 Vendor/Twig/lib/Twig/Node/Expression/Unary/Pos.php
  198. +37 −0 Vendor/Twig/lib/Twig/Node/Flush.php
  199. +113 −0 Vendor/Twig/lib/Twig/Node/For.php
  200. +56 −0 Vendor/Twig/lib/Twig/Node/ForLoop.php
  201. +67 −0 Vendor/Twig/lib/Twig/Node/If.php
  202. +51 −0 Vendor/Twig/lib/Twig/Node/Import.php
  203. +88 −0 Vendor/Twig/lib/Twig/Node/Include.php
  204. +84 −0 Vendor/Twig/lib/Twig/Node/Macro.php
  205. +323 −0 Vendor/Twig/lib/Twig/Node/Module.php
  206. +40 −0 Vendor/Twig/lib/Twig/Node/Print.php
  207. +48 −0 Vendor/Twig/lib/Twig/Node/Sandbox.php
  208. +71 −0 Vendor/Twig/lib/Twig/Node/SandboxedModule.php
  209. +60 −0 Vendor/Twig/lib/Twig/Node/SandboxedPrint.php
  210. +102 −0 Vendor/Twig/lib/Twig/Node/Set.php
  211. +35 −0 Vendor/Twig/lib/Twig/Node/SetTemp.php
  212. +41 −0 Vendor/Twig/lib/Twig/Node/Spaceless.php
  213. +40 −0 Vendor/Twig/lib/Twig/Node/Text.php
  214. +30 −0 Vendor/Twig/lib/Twig/NodeInterface.php
  215. +20 −0 Vendor/Twig/lib/Twig/NodeOutputInterface.php
  216. +89 −0 Vendor/Twig/lib/Twig/NodeTraverser.php
  217. +162 −0 Vendor/Twig/lib/Twig/NodeVisitor/Escaper.php
  218. +247 −0 Vendor/Twig/lib/Twig/NodeVisitor/Optimizer.php
  219. +115 −0 Vendor/Twig/lib/Twig/NodeVisitor/SafeAnalysis.php
  220. +93 −0 Vendor/Twig/lib/Twig/NodeVisitor/Sandbox.php
  221. +48 −0 Vendor/Twig/lib/Twig/NodeVisitorInterface.php
  222. +370 −0 Vendor/Twig/lib/Twig/Parser.php
  223. +28 −0 Vendor/Twig/lib/Twig/ParserInterface.php
  224. +20 −0 Vendor/Twig/lib/Twig/Sandbox/SecurityError.php
  225. +120 −0 Vendor/Twig/lib/Twig/Sandbox/SecurityPolicy.php
  226. +25 −0 Vendor/Twig/lib/Twig/Sandbox/SecurityPolicyInterface.php
  227. +457 −0 Vendor/Twig/lib/Twig/Template.php
  228. +47 −0 Vendor/Twig/lib/Twig/TemplateInterface.php
  229. +31 −0 Vendor/Twig/lib/Twig/Test/Function.php
  230. +32 −0 Vendor/Twig/lib/Twig/Test/Method.php
  231. +35 −0 Vendor/Twig/lib/Twig/Test/Node.php
  232. +26 −0 Vendor/Twig/lib/Twig/TestInterface.php
  233. +219 −0 Vendor/Twig/lib/Twig/Token.php
  234. +34 −0 Vendor/Twig/lib/Twig/TokenParser.php
  235. +77 −0 Vendor/Twig/lib/Twig/TokenParser/AutoEscape.php
  236. +83 −0 Vendor/Twig/lib/Twig/TokenParser/Block.php
  237. +42 −0 Vendor/Twig/lib/Twig/TokenParser/Do.php
  238. +54 −0 Vendor/Twig/lib/Twig/TokenParser/Extends.php
  239. +61 −0 Vendor/Twig/lib/Twig/TokenParser/Filter.php
  240. +42 −0 Vendor/Twig/lib/Twig/TokenParser/Flush.php
  241. +89 −0 Vendor/Twig/lib/Twig/TokenParser/For.php
  242. +74 −0 Vendor/Twig/lib/Twig/TokenParser/From.php
  243. +93 −0 Vendor/Twig/lib/Twig/TokenParser/If.php
  244. +47 −0 Vendor/Twig/lib/Twig/TokenParser/Import.php
  245. +71 −0 Vendor/Twig/lib/Twig/TokenParser/Include.php
  246. +69 −0 Vendor/Twig/lib/Twig/TokenParser/Macro.php
  247. +55 −0 Vendor/Twig/lib/Twig/TokenParser/Sandbox.php
  248. +84 −0 Vendor/Twig/lib/Twig/TokenParser/Set.php
  249. +59 −0 Vendor/Twig/lib/Twig/TokenParser/Spaceless.php
  250. +85 −0 Vendor/Twig/lib/Twig/TokenParser/Use.php
  251. +113 −0 Vendor/Twig/lib/Twig/TokenParserBroker.php
  252. +45 −0 Vendor/Twig/lib/Twig/TokenParserBrokerInterface.php
  253. +42 −0 Vendor/Twig/lib/Twig/TokenParserInterface.php
  254. +140 −0 Vendor/Twig/lib/Twig/TokenStream.php
  255. +64 −0 Vendor/Twig/package.xml.tpl
  256. +25 −0 Vendor/Twig/phpunit.xml.dist
  257. +21 −0 Vendor/Twig/test/Twig/Tests/AutoloaderTest.php
  258. +59 −0 Vendor/Twig/test/Twig/Tests/ErrorTest.php
  259. +217 −0 Vendor/Twig/test/Twig/Tests/ExpressionParserTest.php
  260. +114 −0 Vendor/Twig/test/Twig/Tests/Extension/CoreTest.php
  261. +197 −0 Vendor/Twig/test/Twig/Tests/Extension/SandboxTest.php
  262. +46 −0 Vendor/Twig/test/Twig/Tests/FileCachingTest.php
  263. +20 −0 Vendor/Twig/test/Twig/Tests/Fixtures/exceptions/unclosed_tag.test
  264. +61 −0 Vendor/Twig/test/Twig/Tests/Fixtures/expressions/array.test
  265. +14 −0 Vendor/Twig/test/Twig/Tests/Fixtures/expressions/array_call.test
  266. +46 −0 Vendor/Twig/test/Twig/Tests/Fixtures/expressions/binary.test
  267. +14 −0 Vendor/Twig/test/Twig/Tests/Fixtures/expressions/comparison.test
  268. +20 −0 Vendor/Twig/test/Twig/Tests/Fixtures/expressions/dotdot.test
  269. +8 −0 Vendor/Twig/test/Twig/Tests/Fixtures/expressions/grouping.test
  270. +22 −0 Vendor/Twig/test/Twig/Tests/Fixtures/expressions/literals.test
  271. +27 −0 Vendor/Twig/test/Twig/Tests/Fixtures/expressions/magic_call.test
  272. +28 −0 Vendor/Twig/test/Twig/Tests/Fixtures/expressions/method_call.test
  273. +21 −0 Vendor/Twig/test/Twig/Tests/Fixtures/expressions/postfix.test
  274. +10 −0 Vendor/Twig/test/Twig/Tests/Fixtures/expressions/strings.test
  275. +18 −0 Vendor/Twig/test/Twig/Tests/Fixtures/expressions/ternary_operator.test
  276. +12 −0 Vendor/Twig/test/Twig/Tests/Fixtures/expressions/unary.test
  277. +14 −0 Vendor/Twig/test/Twig/Tests/Fixtures/expressions/unary_precedence.test
  278. +10 −0 Vendor/Twig/test/Twig/Tests/Fixtures/filters/convert_encoding.test
  279. +33 −0 Vendor/Twig/test/Twig/Tests/Fixtures/filters/date.test
  280. +14 −0 Vendor/Twig/test/Twig/Tests/Fixtures/filters/date_default_format.test
  281. +16 −0 Vendor/Twig/test/Twig/Tests/Fixtures/filters/date_default_format_interval.test
  282. +16 −0 Vendor/Twig/test/Twig/Tests/Fixtures/filters/date_interval.test
  283. +150 −0 Vendor/Twig/test/Twig/Tests/Fixtures/filters/default.test
  284. +10 −0 Vendor/Twig/test/Twig/Tests/Fixtures/filters/dynamic_filter.test
  285. +8 −0 Vendor/Twig/test/Twig/Tests/Fixtures/filters/escape.test
  286. +8 −0 Vendor/Twig/test/Twig/Tests/Fixtures/filters/escape_non_supported_charset.test
  287. +18 −0 Vendor/Twig/test/Twig/Tests/Fixtures/filters/force_escape.test
  288. +8 −0 Vendor/Twig/test/Twig/Tests/Fixtures/filters/format.test
  289. +12 −0 Vendor/Twig/test/Twig/Tests/Fixtures/filters/join.test
  290. +12 −0 Vendor/Twig/test/Twig/Tests/Fixtures/filters/json_encode.test
  291. +14 −0 Vendor/Twig/test/Twig/Tests/Fixtures/filters/length.test
  292. +12 −0 Vendor/Twig/test/Twig/Tests/Fixtures/filters/length_utf8.test
  293. +14 −0 Vendor/Twig/test/Twig/Tests/Fixtures/filters/merge.test
  294. +14 −0 Vendor/Twig/test/Twig/Tests/Fixtures/filters/nl2br.test
  295. +18 −0 Vendor/Twig/test/Twig/Tests/Fixtures/filters/number_format.test
  296. +21 −0 Vendor/Twig/test/Twig/Tests/Fixtures/filters/number_format_default.test
  297. +8 −0 Vendor/Twig/test/Twig/Tests/Fixtures/filters/replace.test
  298. +12 −0 Vendor/Twig/test/Twig/Tests/Fixtures/filters/reverse.test
  299. +34 −0 Vendor/Twig/test/Twig/Tests/Fixtures/filters/slice.test
  300. +10 −0 Vendor/Twig/test/Twig/Tests/Fixtures/filters/sort.test
Sorry, we could not display the entire diff because too many files (840) changed.
View
10 .gitignore
@@ -0,0 +1,10 @@
+.idea/.name
+.idea/codeStyleSettings.xml
+.idea/encodings.xml
+.idea/joind.in-responsive.iml
+.idea/misc.xml
+.idea/modules.xml
+.idea/vcs.xml
+.idea/workspace.xml
+.idea/libraries/sass_stdlib.xml
+.idea/scopes/scope_settings.xml
View
25 CONTRIBUTING.md
@@ -0,0 +1,25 @@
+# CONTRIBUTING
+
+## RESOURCES
+
+If you wish to contribute to joind.in, please be sure to
+read/subscribe to the following resources:
+
+ - Contributor's Guide:
+ https://github.com/joindin/joind.in/wiki/How-to-Contribute-Code
+ - Contributor's mailing list:
+ http://groups.google.com/group/joindin-developers
+ - Contributor's IRC channel:
+ #joind.in on Freenode.net
+
+## What to work on
+
+You should work on what you want to. Our bug tracker is
+here: https://joindin.jira.com
+
+Any issues that have the "hackathon" or "easypick" label are ones that we think
+are a good starting point. This [JIRA filter](https://joindin.jira.com/issues/?jql=project%20%3D%20JOINDIN%20AND%20labels%20in%20(hackathon%2C%20%22OR%22%2C%20easypick)) will give you the list of all
+current issues with the "hackathon" or "easypick" issues.
+
+If you have any problems, ask on the IRC channel or send an email to
+the mailing list.
View
32 Controller/Application.php
@@ -0,0 +1,32 @@
+<?php
+namespace Joindin\Controller;
+
+class Application extends Base
+{
+ protected function defineRoutes(\Slim $app)
+ {
+ $app->get('/', array($this, 'index'));
+ $app->get('/oauth/callback', array($this, 'oauth_callback'));
+ }
+
+ public function index()
+ {
+ $event_collection = new \Joindin\Model\Collection\Event();
+ $hot_events = $event_collection->retrieve(5, 1, 'hot');
+ $upcoming_events = $event_collection->retrieve(5, 1, 'upcoming');
+
+ echo $this->application->render(
+ 'Application/index.html.twig',
+ array(
+ 'hot_events' => $hot_events,
+ 'upcoming_events' => $upcoming_events
+ )
+ );
+ }
+
+ public function oauth_callback()
+ {
+ $_SESSION['access_token'] = $this->application->request()->params('access_token');
+ $this->application->redirect('/');
+ }
+}
View
16 Controller/Base.php
@@ -0,0 +1,16 @@
+<?php
+namespace Joindin\Controller;
+
+abstract class Base
+{
+ /** @var \Slim */
+ protected $application = null;
+
+ function __construct(\Slim $app)
+ {
+ $this->application = $app;
+ $this->defineRoutes($app);
+ }
+
+ abstract protected function defineRoutes(\Slim $app);
+}
View
34 Controller/Event.php
@@ -0,0 +1,34 @@
+<?php
+namespace Joindin\Controller;
+
+class Event extends Base
+{
+ protected function defineRoutes(\Slim $app)
+ {
+ $app->get('/event', array($this, 'index'));
+ $app->get('/event/view/:id', array($this, 'show'));
+
+ }
+
+ public function index()
+ {
+ $event = new \Joindin\Model\Collection\Event();
+ $result = $event->retrieve(10, 1, 'hot');
+
+ echo $this->application->render(
+ 'Event/index.html.twig',
+ array('events' => $result)
+ );
+ }
+
+ public function show($id)
+ {
+ $event = new \Joindin\Model\Event();
+ $event->load($id);
+
+ echo $this->application->render(
+ 'Event/show.html.twig',
+ array('event' => $event)
+ );
+ }
+}
View
18 Model/API/JoindIn.php
@@ -0,0 +1,18 @@
+<?php
+namespace Joindin\Model\API;
+
+class JoindIn
+{
+ protected $baseApiUrl = 'http://api.joind.in';
+
+ protected function apiGet($url)
+ {
+ $result = file_get_contents($url);
+
+ if (false === $result) {
+ throw new \Exception('Unable to connect to API');
+ }
+
+ return $result;
+ }
+}
View
23 Model/Collection/Event.php
@@ -0,0 +1,23 @@
+<?php
+namespace Joindin\Model\Collection;
+
+class Event extends \Joindin\Model\API\JoindIn
+{
+ public function retrieve($limit = 10, $page = 1, $filter = null)
+ {
+ $url = $this->baseApiUrl.'/v2.1/events'
+ .'?resultsperpage='.$limit
+ .'&page='.$page;
+ if ($filter) {
+ $url .= '&filter='.$filter;
+ }
+
+ $events = (array)json_decode(
+ $this->apiGet($url)
+ );
+ $meta = array_pop($events);
+
+ return $events['events'];
+ }
+
+}
View
42 Model/Event.php
@@ -0,0 +1,42 @@
+<?php
+namespace Joindin\Model;
+
+/**
+ * @property string $name
+ * @property string $start_date
+ * @property string $end_date
+ * @property string $description
+ * @property string $href
+ * @property string $attendee_count
+ * @property string $icon
+ * @property string $latitude
+ * @property string $longitude
+ * @property string $tz_continent
+ * @property string $tz_place
+ * @property string $location
+ * @property string $comments_enabled
+ * @property string $event_comment_count
+ * @property string $cfp_start_date
+ * @property string $cfp_end_date
+ */
+class Event extends \Joindin\Model\API\JoindIn
+{
+ public function load($id)
+ {
+ $event = current(current((array)json_decode(
+ $this->apiGet(
+ $this->baseApiUrl
+ .'/v2.1/events/'.$id.'?format=json&verbose=yes'
+ )
+ )));
+
+ $event->comments = current((array)json_decode(
+ $this->apiGet($event->comments_uri))
+ );
+
+ // import properties
+ foreach($event as $key => $value) {
+ $this->$key = $value;
+ }
+ }
+}
View
141 README.md
@@ -1,4 +1,139 @@
-responsive
-==========
+# Joind.in
+
+This is the source code for the next generation of the Joind.in website - a resource set up to allow
+events to get real-time feedback from those attending. It also gives speakers a
+way to claim and track their presentations over time.
+
+This version is the next generation version, providing a responsive cross-device site for screens of all devices
+
+You can either install joind.in on an existing PHP platform, or use our vagrant setup.
+
+## Quick Start - Using Vagrant
+
+You can set up a development virtual machine running joind.in by following these simple instructions.
+
+1. Install requirements. (Note: these are not required by joind.in itself, but are required for this quick start guide.)
+ - VirtualBox (https://www.virtualbox.org/) (versions 4.0 and 4.1 are currently supported)
+ - Ruby (http://www.ruby-lang.org/)
+ - Vagrant (http://vagrantup.com/)
+
+2. Clone repository to any location and fetch required submodules (containing Puppet manifests).
+
+ git clone https://github.com/joindin/responsive --recursive
+ cd joind.in
+
+or
+
+ git clone https://github.com/joindin/responsive && cd joind.in
+ git submodule init
+ git submodule update
+
+3. Start the process by running Vagrant.
+
+ vagrant up
+
+4. Add hostname to /etc/hosts.
+
+ echo "127.0.0.1 responsive.dev.joind.in" | sudo tee -a /etc/hosts
+
+5. Browse to the newly provisioned development copy of joind.in.
+
+ open http://responsive.dev.joind.in:8080
+
+*Notes:*
+
+- HTTP and SSH ports on the VM are forwarded to localhost (22 -> 2222, 80 -> 8080)
+- The joind.in directory you cloned will be mounted inside the VM at `/vagrant`
+- You can develop by editing the files you cloned in the IDE of you choice.
+- The database is running inside the VM. You can get to it by doing the following:
+
+ you@you> vagrant ssh
+ vagrant@vm> sudo su
+ root@vm> mysql joindin
+
+- To stop the VM do one of the following:
+ `vagrant suspend` if you plan on running it later
+ `vagrant destroy` if you wish to delete the VM completely
+
+- Also, when any of of the Puppet manifests change, it is a good idea to rerun them:
+
+ vagrant provision
+
+## Quick Start - Existing Platforms
+
+1. Create a vhost entry for the site. The docroot should be `/web`.
+
+ <VirtualHost *:80>
+ ServerName joindin.local
+
+ DocumentRoot "/home/exampleuser/www/joind.in/web"
+
+ <Directory "/home/exampleuser/www/joind.in">
+ Options FollowSymLinks
+ AllowOverride All
+ </Directory>
+ </VirtualHost>
+
+2. Create a MySQL database with username and password.
+ Use a database name of 'joindin'
+
+3. Initialise, patch, and populate the database.
+
+ src/scripts/patchdb.sh -t /path/to/joind.in -d joindin -u username -p password -i
+
+ (use the correct username and password)
+
+4. Create directories for user-added content.
+
+ mkdir src/system/cache/ctokens && chown apache:apache src/system/cache/ctokens
+
+ (or whatever user and group your web server runs as)
+
+5. Create configuration files for database and config (based on the .dist templates):
+
+ cp src/system/application/config/database.php.dist src/system/application/config/database.php
+ cp src/system/application/config/config.php.dist src/system/application/config/config.php
+
+ Edit these files as appropriate!
+
+6. Create some sample data to get you started - see `/doc/dbgen/README` for information about this excellent tool
+
+7. To enable useful error messages, add the following to your `.htaccess`
+
+ SetEnv JOINDIN_DEBUG On
+
+8. Enjoy the site!
+
+## Other Resources
+
+* The main website http://joind.in
+* Issues list: http://joindin.jira.com/ (good bug reports ALWAYS welcome!)
+* CI Environment: lots of output and information about tests, deploys etc: http://jenkins.joind.in
+* Community: We hang out on IRC, pop in with questions or comments! #joind.in on Freenode
+
+See LICENSE file for license information for this software
+(located in /doc/LICENSE)
+
+## Extensions
+
+### API Tests
+
+To run the frisby tests (frisby.js), you will first need to install node.js and
+npm. Then run:
+
+ npm install -g frisby jasmine-node
+
+I also found that I needed:
+
+ export NODE_PATH=/usr/local/lib/node_modules
+
+Then run the tests by going to `/src/tests/api_tests` and running:
+
+ jasmine-node newapi_spec.js
+
+### Unit Tests
+
+There are some tests set up, which use PHPUnit; these can be found in the
+src/tests directory. There is a phing task configured to run them - from the
+root directory simply run "phing phpunit" to run the tests.
-Next generation website for joind.in
View
45 Vendor/Slim/Exception/Pass.php
@@ -0,0 +1,45 @@
+<?php
+/**
+ * Slim - a micro PHP 5 framework
+ *
+ * @author Josh Lockhart <info@joshlockhart.com>
+ * @copyright 2011 Josh Lockhart
+ * @link http://www.slimframework.com
+ * @license http://www.slimframework.com/license
+ * @version 1.5.0
+ *
+ * MIT LICENSE
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/**
+ * Pass Exception
+ *
+ * This Exception will cause the Router::dispatch method
+ * to skip the current matching route and continue to the next
+ * matching route. If no subsequent routes are found, a
+ * HTTP 404 Not Found response will be sent to the client.
+ *
+ * @package Slim
+ * @author Josh Lockhart <info@joshlockhart.com>
+ * @since Version 1.0
+ */
+class Slim_Exception_Pass extends Exception {}
View
46 Vendor/Slim/Exception/RequestSlash.php
@@ -0,0 +1,46 @@
+<?php
+/**
+ * Slim - a micro PHP 5 framework
+ *
+ * @author Josh Lockhart <info@joshlockhart.com>
+ * @copyright 2011 Josh Lockhart
+ * @link http://www.slimframework.com
+ * @license http://www.slimframework.com/license
+ * @version 1.5.0
+ *
+ * MIT LICENSE
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/**
+ * Request Slash Exception
+ *
+ * This Exception is thrown when Slim detects a matching route
+ * (defined with a trailing slash) and the HTTP request
+ * matches the route but does not have a trailing slash. This
+ * exception will be caught in `Slim::run` and trigger a 301 redirect
+ * to the same resource URI with a trailing slash.
+ *
+ * @package Slim
+ * @author Josh Lockhart <info@joshlockhart.com>
+ * @since Version 1.0
+ */
+class Slim_Exception_RequestSlash extends Exception {}
View
43 Vendor/Slim/Exception/Stop.php
@@ -0,0 +1,43 @@
+<?php
+/**
+ * Slim - a micro PHP 5 framework
+ *
+ * @author Josh Lockhart <info@joshlockhart.com>
+ * @copyright 2011 Josh Lockhart
+ * @link http://www.slimframework.com
+ * @license http://www.slimframework.com/license
+ * @version 1.5.0
+ *
+ * MIT LICENSE
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/**
+ * Stop Exception
+ *
+ * This Exception is thrown when the Slim application needs to abort
+ * processing and return control flow to the outer PHP script.
+ *
+ * @package Slim
+ * @author Josh Lockhart <info@joshlockhart.com>
+ * @since Version 1.0
+ */
+class Slim_Exception_Stop extends Exception {}
View
222 Vendor/Slim/Http/Cookie.php
@@ -0,0 +1,222 @@
+<?php
+/**
+ * Slim - a micro PHP 5 framework
+ *
+ * @author Josh Lockhart <info@joshlockhart.com>
+ * @copyright 2011 Josh Lockhart
+ * @link http://www.slimframework.com
+ * @license http://www.slimframework.com/license
+ * @version 1.5.0
+ *
+ * MIT LICENSE
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/**
+ * Cookie
+ *
+ * Object-oriented representation of a Cookie to be sent in an HTTP response
+ *
+ * @package Slim
+ * @author Josh Lockhart <info@joshlockhart.com>
+ * @since Version 1.0
+ */
+class Slim_Http_Cookie {
+
+ /**
+ * @var string
+ */
+ protected $name;
+
+ /**
+ * @var string
+ */
+ protected $value;
+
+ /**
+ * @var int UNIX timestamp
+ */
+ protected $expires;
+
+ /**
+ * @var string
+ */
+ protected $path;
+
+ /**
+ * @var string
+ */
+ protected $domain;
+
+ /**
+ * @var bool
+ */
+ protected $secure;
+
+ /**
+ * @var bool
+ */
+ protected $httponly;
+
+ /**
+ * Constructor
+ * @param string $name The cookie name
+ * @param string $value The cookie value
+ * @param mixed $time The duration of the cookie;
+ * If integer, should be a UNIX timestamp;
+ * If string, converted to UNIX timestamp with `strtotime`;
+ * @param string $path The path on the server in which the cookie will be available on
+ * @param string $domain The domain that the cookie is available to
+ * @param bool $secure Indicates that the cookie should only be transmitted over a secure
+ * HTTPS connection from the client
+ * @param bool $httponly When TRUE the cookie will be made accessible only through the HTTP protocol
+ * @return void
+ */
+ public function __construct( $name, $value = null, $expires = 0, $path = null, $domain = null, $secure = false, $httponly = false ) {
+ $this->setName($name);
+ $this->setValue($value);
+ $this->setExpires($expires);
+ $this->setPath($path);
+ $this->setDomain($domain);
+ $this->setSecure($secure);
+ $this->setHttpOnly($httponly);
+ }
+
+ /**
+ * Get cookie name
+ * @return string
+ */
+ public function getName() {
+ return $this->name;
+ }
+
+ /**
+ * Set cookie name
+ * @param string $name
+ * @return void
+ */
+ public function setName( $name ) {
+ $this->name = (string)$name;
+ }
+
+ /**
+ * Get cookie value
+ * @return string
+ */
+ public function getValue() {
+ return $this->value;
+ }
+
+ /**
+ * Set cookie value
+ * @param string $value
+ * @return void
+ */
+ public function setValue( $value ) {
+ $this->value = (string)$value;
+ }
+
+ /**
+ * Get cookie expiration time
+ * @return int UNIX timestamp
+ */
+ public function getExpires() {
+ return $this->expires;
+ }
+
+ /**
+ * Set cookie expiration time
+ * @param string|int Cookie expiration time
+ * @return void
+ */
+ public function setExpires( $time ) {
+ $this->expires = is_string($time) ? strtotime($time) : (int)$time;
+ }
+
+ /**
+ * Get cookie path
+ * @return string
+ */
+ public function getPath() {
+ return $this->path;
+ }
+
+ /**
+ * Set cookie path
+ * @param string $path
+ * @return void
+ */
+ public function setPath( $path ) {
+ $this->path = (string)$path;
+ }
+
+ /**
+ * Get cookie domain
+ * @return string
+ */
+ public function getDomain() {
+ return $this->domain;
+ }
+
+ /**
+ * Set cookie domain
+ * @param string $domain
+ * @return void
+ */
+ public function setDomain( $domain ) {
+ $this->domain = (string)$domain;
+ }
+
+ /**
+ * Is cookie sent only if SSL/HTTPS is used?
+ * @return bool
+ */
+ public function getSecure() {
+ return $this->secure;
+ }
+
+ /**
+ * Set whether cookie is sent only if SSL/HTTPS is used
+ * @param bool $secure
+ * @return void
+ */
+ public function setSecure( $secure ) {
+ $this->secure = (bool)$secure;
+ }
+
+ /**
+ * Is cookie sent with HTTP protocol only?
+ * @return bool
+ */
+ public function getHttpOnly() {
+ return $this->httponly;
+ }
+
+ /**
+ * Set whether cookie is sent with HTTP protocol only
+ * @param bool $httponly
+ * @return void
+ */
+ public function setHttpOnly( $httponly ) {
+ $this->httponly = (bool)$httponly;
+ }
+
+}
View
401 Vendor/Slim/Http/CookieJar.php
@@ -0,0 +1,401 @@
+<?php
+/**
+ * Slim - a micro PHP 5 framework
+ *
+ * @author Josh Lockhart <info@joshlockhart.com>
+ * @copyright 2011 Josh Lockhart
+ * @link http://www.slimframework.com
+ * @license http://www.slimframework.com/license
+ * @version 1.5.0
+ *
+ * MIT LICENSE
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/**
+ * Cooke Jar
+ *
+ * Used to manage signed, encrypted Cookies. Provides:
+ *
+ * - Cookie integrity and authenticity with HMAC
+ * - Confidentiality with symmetric encryption
+ * - Protection from replay attack if using SSL or TLS
+ * - Protection from interception if using SSL or TLS
+ *
+ * This code was originally called "BigOrNot_CookieManager" and written by
+ * Matthieu Huguet released under "CopyLeft" license. I have cleaned up the
+ * code formatting to conform with Slim Framework contributor guidelines and
+ * added additional code where necessary to play nice with Slim Cookie objects.
+ *
+ * Requirements:
+ *
+ * - libmcrypt > 2.4.x
+ *
+ * @author Matthies Huguet <http://bigornot.blogspot.com/2008/06/security-cookies-and-rest.html>
+ */
+class Slim_Http_CookieJar {
+
+ /**
+ * @var string Server secret key
+ */
+ protected $_secret = '';
+
+ /**
+ * @var int Cryptographic algorithm used to encrypt cookies data
+ */
+ protected $_algorithm = MCRYPT_RIJNDAEL_256;
+
+ /**
+ * @var int Cryptographic mode (CBC, CFB ...)
+ */
+ protected $_mode = MCRYPT_MODE_CBC;
+
+ /**
+ * @var resource mcrypt module resource
+ */
+ protected $_cryptModule = null;
+
+ /**
+ * @var bool Enable high confidentiality for cookie value (symmetric encryption)
+ */
+ protected $_highConfidentiality = true;
+
+ /**
+ * @var bool Enable SSL support
+ */
+ protected $_ssl = false;
+
+ /**
+ * @var array[Cookie] Cookie objects
+ */
+ protected $_cookies = array();
+
+ /**
+ * Constructor
+ *
+ * Initialize cookie manager and mcrypt module.
+ *
+ * @param string $secret Server's secret key
+ * @param array $config
+ * @throws Exception If secret key is empty
+ * @throws Exception If unable to open mcypt module
+ */
+ public function __construct( $secret, $config = null ) {
+ if ( empty($secret) ) {
+ throw new Exception('You must provide a secret key');
+ }
+ $this->_secret = $secret;
+ if ( $config !== null && !is_array($config) ) {
+ throw new Exception('Config must be an array');
+ }
+ if ( is_array($config) ) {
+ if ( isset($config['high_confidentiality']) ) {
+ $this->_highConfidentiality = $config['high_confidentiality'];
+ }
+ if ( isset($config['mcrypt_algorithm']) ) {
+ $this->_algorithm = $config['mcrypt_algorithm'];
+ }
+ if ( isset($config['mcrypt_mode']) ) {
+ $this->_mode = $config['mcrypt_mode'];
+ }
+ if ( isset($config['enable_ssl']) ) {
+ $this->_ssl = $config['enable_ssl'];
+ }
+ }
+ if ( extension_loaded('mcrypt') ) {
+ $this->_cryptModule = mcrypt_module_open($this->_algorithm, '', $this->_mode, '');
+ if ( $this->_cryptModule === false ) {
+ throw new Exception('Error while loading mcrypt module');
+ }
+ }
+ }
+
+ /**
+ * Get the high confidentiality mode
+ *
+ * @return bool TRUE if cookie data encryption is enabled, or FALSE if it isn't
+ */
+ public function getHighConfidentiality() {
+ return $this->_highConfidentiality;
+ }
+
+ /**
+ * Enable or disable cookie data encryption
+ *
+ * @param bool $enable TRUE to enable, FALSE to disable
+ * @return CookieJar
+ */
+ public function setHighConfidentiality( $enable ) {
+ $this->_highConfidentiality = (bool)$enable;
+ return $this;
+ }
+
+ /**
+ * Get the SSL status (enabled or disabled?)
+ *
+ * @return bool TRUE if SSL support is enabled, or FALSE if it isn't
+ */
+ public function getSSL() {
+ return $this->_ssl;
+ }
+
+ /**
+ * Enable SSL support (not enabled by default)
+ *
+ * Pro: Protect against replay attack
+ * Con: Cookie's lifetime is limited to SSL session's lifetime
+ *
+ * @param bool $enable TRUE to enable, FALSE to disable
+ * @return CookieJar
+ */
+ public function setSSL( $enable ) {
+ $this->_ssl = (bool)$enable;
+ return $this;
+ }
+
+ /**
+ * Get Cookies for Response
+ *
+ * @author Josh Lockhart <info@joshlockhart.com>
+ * @return array[Cookie]
+ */
+ public function getResponseCookies() {
+ return $this->_cookies;
+ }
+
+ /**
+ * Get Cookie with name for Response
+ *
+ * @author Josh Lockhart <info@joshlockhart.com>
+ * @param string $cookiename The name of the Cookie
+ * @return Cookie|null Cookie, or NULL if Cookie with name not found
+ */
+ public function getResponseCookie( $cookiename ) {
+ return isset($this->_cookies[$cookiename]) ? $this->_cookies[$cookiename] : null;
+ }
+
+ /**
+ * Set a secure cookie
+ *
+ * @param string $name Cookie name
+ * @param string $value Cookie value
+ * @param string $username User identifier
+ * @param integer $expire Expiration time
+ * @param string $path Cookie path
+ * @param string $domain Cookie domain
+ * @param bool $secure When TRUE, send the cookie only on a secure connection
+ * @param bool $httponly When TRUE the cookie will be made accessible only through the HTTP protocol
+ */
+ public function setCookie( $cookiename, $value, $username, $expire = 0, $path = '/', $domain = '', $secure = false, $httponly = null ) {
+ $secureValue = extension_loaded('mcrypt') ? $this->_secureCookieValue($value, $username, $expire) : $value;
+ $this->setClassicCookie($cookiename, $secureValue, $expire, $path, $domain, $secure, $httponly);
+ }
+
+ /**
+ * Delete a cookie
+ *
+ * @param string $name Cookie name
+ * @param string $path Cookie path
+ * @param string $domain Cookie domain
+ * @param bool $secure When TRUE, send the cookie only on a secure connection
+ * @param bool $httponly When TRUE the cookie will be made accessible only through the HTTP protocol
+ */
+ public function deleteCookie( $name, $path = '/', $domain = '', $secure = false, $httponly = null ) {
+ $expire = 315554400; /* 1980-01-01 */
+ $this->_cookies[$name] = new Slim_Http_Cookie($name, '', $expire, $path, $domain, $secure, $httponly);
+ //setcookie($name, '', $expire, $path, $domain, $secure, $httponly);
+ }
+
+ /**
+ * Get a secure cookie value
+ *
+ * Verify the integrity of cookie data and decrypt it. If the cookie
+ * is invalid, it can be automatically destroyed (default behaviour)
+ *
+ * @param string $cookiename Cookie name
+ * @param bool $delete Destroy the cookie if invalid?
+ * @return string|false The Cookie value, or FALSE if Cookie invalid
+ */
+ public function getCookieValue( $cookiename, $deleteIfInvalid = true ) {
+ if ( $this->cookieExists($cookiename) ) {
+ if ( extension_loaded('mcrypt') ) {
+ $cookieValues = explode('|', $_COOKIE[$cookiename]);
+ if ( (count($cookieValues) === 4) && ($cookieValues[1] == 0 || $cookieValues[1] >= time()) ) {
+ $key = hash_hmac('sha1', $cookieValues[0] . $cookieValues[1], $this->_secret);
+ $cookieData = base64_decode($cookieValues[2]);
+ if ( $cookieData !== '' && $this->getHighConfidentiality() ) {
+ $data = $this->_decrypt($cookieData, $key, md5($cookieValues[1]));
+ } else {
+ $data = $cookieData;
+ }
+ if ( $this->_ssl && isset($_SERVER['SSL_SESSION_ID']) ) {
+ $verifKey = hash_hmac('sha1', $cookieValues[0] . $cookieValues[1] . $data . $_SERVER['SSL_SESSION_ID'], $key);
+ } else {
+ $verifKey = hash_hmac('sha1', $cookieValues[0] . $cookieValues[1] . $data, $key);
+ }
+ if ( $verifKey == $cookieValues[3] ) {
+ return $data;
+ }
+ }
+ } else {
+ return $_COOKIE[$cookiename];
+ }
+ }
+ if ( $deleteIfInvalid ) {
+ $this->deleteCookie($cookiename);
+ }
+ return false;
+ }
+
+ /**
+ * Send a classic (unsecure) cookie
+ *
+ * @param string $name Cookie name
+ * @param string $value Cookie value
+ * @param integer $expire Expiration time
+ * @param string $path Cookie path
+ * @param string $domain Cookie domain
+ * @param bool $secure When TRUE, send the cookie only on a secure connection
+ * @param bool $httponly When TRUE the cookie will be made accessible only through the HTTP protocol
+ */
+ public function setClassicCookie( $cookiename, $value, $expire = 0, $path = '/', $domain = '', $secure = false, $httponly = null ) {
+ /* httponly option is only available for PHP version >= 5.2 */
+ if ( $httponly === null ) {
+ $this->_cookies[$cookiename] = new Slim_Http_Cookie($cookiename, $value, $expire, $path, $domain, $secure);
+ //setcookie($cookiename, $value, $expire, $path, $domain, $secure);
+ } else {
+ $this->_cookies[$cookiename] = new Slim_Http_Cookie($cookiename, $value, $expire, $path, $domain, $secure, $httponly);
+ //setcookie($cookiename, $value, $expire, $path, $domain, $secure, $httponly);
+ }
+ }
+
+ /**
+ * Verify if a cookie exists
+ *
+ * @param string $cookiename
+ * @return bool TRUE if cookie exist, or FALSE if not
+ */
+ public function cookieExists($cookiename) {
+ return isset($_COOKIE[$cookiename]);
+ }
+
+ /**
+ * Secure a cookie value
+ *
+ * The initial value is transformed with this protocol:
+ *
+ * secureValue = username|expire|base64((value)k,expire)|HMAC(user|expire|value,k)
+ * where k = HMAC(user|expire, sk)
+ * and sk is server's secret key
+ * (value)k,md5(expire) is the result an cryptographic function (ex: AES256) on "value" with key k and initialisation vector = md5(expire)
+ *
+ * @param string $value Unsecure value
+ * @param string $username User identifier
+ * @param integer $expire Expiration time
+ * @return string Secured value
+ */
+ protected function _secureCookieValue( $value, $username, $expire ) {
+ if ( is_string($expire) ) {
+ $expire = strtotime($expire);
+ }
+ $key = hash_hmac('sha1', $username . $expire, $this->_secret);
+ if ( $value !== '' && $this->getHighConfidentiality() ) {
+ $encryptedValue = base64_encode($this->_encrypt($value, $key, md5($expire)));
+ } else {
+ $encryptedValue = base64_encode($value);
+ }
+ if ( $this->_ssl && isset($_SERVER['SSL_SESSION_ID']) ) {
+ $verifKey = hash_hmac('sha1', $username . $expire . $value . $_SERVER['SSL_SESSION_ID'], $key);
+ } else {
+ $verifKey = hash_hmac('sha1', $username . $expire . $value, $key);
+ }
+ $result = array($username, $expire, $encryptedValue, $verifKey);
+ return implode('|', $result);
+ }
+
+ /**
+ * Encrypt a given data with a given key and a given initialisation vector
+ *
+ * @param string $data Data to crypt
+ * @param string $key Secret key
+ * @param string $iv Initialisation vector
+ * @return string Encrypted data
+ */
+ protected function _encrypt( $data, $key, $iv ) {
+ $iv = $this->_validateIv($iv);
+ $key = $this->_validateKey($key);
+ mcrypt_generic_init($this->_cryptModule, $key, $iv);
+ $res = @mcrypt_generic($this->_cryptModule, $data);
+ mcrypt_generic_deinit($this->_cryptModule);
+ return $res;
+ }
+
+ /**
+ * Decrypt a given data with a given key and a given initialisation vector
+ *
+ * @param string $data Data to crypt
+ * @param string $key Secret key
+ * @param string $iv Initialisation vector
+ * @return string Encrypted data
+ */
+ protected function _decrypt( $data, $key, $iv ) {
+ $iv = $this->_validateIv($iv);
+ $key = $this->_validateKey($key);
+ mcrypt_generic_init($this->_cryptModule, $key, $iv);
+ $decryptedData = mdecrypt_generic($this->_cryptModule, $data);
+ $res = str_replace("\x0", '', $decryptedData);
+ mcrypt_generic_deinit($this->_cryptModule);
+ return $res;
+ }
+
+ /**
+ * Validate Initialization vector
+ *
+ * If given IV is too long for the selected mcrypt algorithm, it will be truncated
+ *
+ * @param string $iv Initialization vector
+ * @return string
+ */
+ protected function _validateIv($iv) {
+ $ivSize = mcrypt_enc_get_iv_size($this->_cryptModule);
+ if ( strlen($iv) > $ivSize ) {
+ $iv = substr($iv, 0, $ivSize);
+ }
+ return $iv;
+ }
+
+ /**
+ * Validate key
+ *
+ * If given key is too long for the selected mcrypt algorithm, it will be truncated
+ *
+ * @param string $key key
+ * @param string
+ */
+ protected function _validateKey($key) {
+ $keySize = mcrypt_enc_get_key_size($this->_cryptModule);
+ if ( strlen($key) > $keySize ) {
+ $key = substr($key, 0, $keySize);
+ }
+ return $key;
+ }
+
+}
View
405 Vendor/Slim/Http/Request.php
@@ -0,0 +1,405 @@
+<?php
+/**
+ * Slim - a micro PHP 5 framework
+ *
+ * @author Josh Lockhart <info@joshlockhart.com>
+ * @copyright 2011 Josh Lockhart
+ * @link http://www.slimframework.com
+ * @license http://www.slimframework.com/license
+ * @version 1.5.0
+ *
+ * MIT LICENSE
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/**
+ * Request
+ *
+ * Object-oriented representation of an HTTP request. This class
+ * is responsible for parsing the raw HTTP request into a format
+ * usable by the Slim application.
+ *
+ * This class will automatically remove slashes from GET, POST, PUT,
+ * and Cookie data if magic quotes are enabled.
+ *
+ * @package Slim
+ * @author Josh Lockhart <info@joshlockhart.com>
+ * @author Kris Jordan <http://www.github.com/KrisJordan>
+ * @since Version 1.0
+ */
+class Slim_Http_Request {
+
+ const METHOD_HEAD = 'HEAD';
+ const METHOD_GET = 'GET';
+ const METHOD_POST = 'POST';
+ const METHOD_PUT = 'PUT';
+ const METHOD_DELETE = 'DELETE';
+ const METHOD_OPTIONS = 'OPTIONS';
+ const METHOD_OVERRIDE = '_METHOD';
+
+ /**
+ * @var string Request method (ie. "GET", "POST", "PUT", "DELETE", "HEAD")
+ */
+ protected $method;
+
+ /**
+ * @var array Key-value array of HTTP request headers
+ */
+ protected $headers;
+
+ /**
+ * @var array Names of additional headers to parse from the current
+ * HTTP request that are not prefixed with "HTTP_"
+ */
+ protected $additionalHeaders = array('content-type', 'content-length', 'php-auth-user', 'php-auth-pw', 'auth-type', 'x-requested-with');
+
+ /**
+ * @var array Key-value array of cookies sent with the
+ * current HTTP request
+ */
+ protected $cookies;
+
+ /**
+ * @var array Key-value array of HTTP GET parameters
+ */
+ protected $get;
+
+ /**
+ * @var array Key-value array of HTTP POST parameters
+ */
+ protected $post;
+
+ /**
+ * @var array Key-value array of HTTP PUT parameters
+ */
+ protected $put;
+
+ /**
+ * @var string Raw body of HTTP request
+ */
+ protected $body;
+
+ /**
+ * @var string Content type of HTTP request
+ */
+ protected $contentType;
+
+ /**
+ * @var string Resource URI (ie. "/person/1")
+ */
+ protected $resource;
+
+ /**
+ * @var string The root URI of the Slim application without trailing slash.
+ * This will be "" if the app is installed at the web
+ * document root. If the app is installed in a
+ * sub-directory "/foo", this will be "/foo".
+ */
+ protected $root;
+
+ /**
+ * Constructor
+ */
+ public function __construct() {
+ $this->method = isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : false;
+ $this->headers = $this->loadHttpHeaders();
+ $this->body = @file_get_contents('php://input');
+ $this->get = self::stripSlashesIfMagicQuotes($_GET);
+ $this->post = self::stripSlashesIfMagicQuotes($_POST);
+ $this->put = self::stripSlashesIfMagicQuotes($this->loadPutParameters());
+ $this->cookies = self::stripSlashesIfMagicQuotes($_COOKIE);
+ $this->root = Slim_Http_Uri::getBaseUri(true);
+ $this->resource = Slim_Http_Uri::getUri(true);
+ $this->checkForHttpMethodOverride();
+ }
+
+ /**
+ * Is this a GET request?
+ * @return bool
+ */
+ public function isGet() {
+ return $this->method === self::METHOD_GET;
+ }
+
+ /**
+ * Is this a POST request?
+ * @return bool
+ */
+ public function isPost() {
+ return $this->method === self::METHOD_POST;
+ }
+
+ /**
+ * Is this a PUT request?
+ * @return bool
+ */
+ public function isPut() {
+ return $this->method === self::METHOD_PUT;
+ }
+
+ /**
+ * Is this a DELETE request?
+ * @return bool
+ */
+ public function isDelete() {
+ return $this->method === self::METHOD_DELETE;
+ }
+
+ /**
+ * Is this a HEAD request?
+ * @return bool
+ */
+ public function isHead() {
+ return $this->method === self::METHOD_HEAD;
+ }
+
+ /**
+ * Is this a OPTIONS request?
+ * @return bool
+ */
+ public function isOptions() {
+ return $this->method === self::METHOD_OPTIONS;
+ }
+
+ /**
+ * Is this a XHR request?
+ * @return bool
+ */
+ public function isAjax() {
+ return ( $this->params('isajax') || $this->headers('X_REQUESTED_WITH') === 'XMLHttpRequest' );
+ }
+
+ /**
+ * Fetch a PUT|POST|GET parameter value
+ *
+ * The preferred method to fetch the value of a
+ * PUT, POST, or GET parameter (searched in that order).
+ *
+ * @param string $key The paramter name
+ * @return string|null The value of parameter, or NULL if parameter not found
+ */
+ public function params( $key ) {
+ foreach ( array('put', 'post', 'get') as $dataSource ) {
+ $source = $this->$dataSource;
+ if ( isset($source[(string)$key]) ) {
+ return $source[(string)$key];
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Fetch GET parameter(s)
+ * @param string $key Name of parameter
+ * @return array|string|null All parameters, parameter value if $key
+ * and parameter exists, or NULL if $key
+ * and parameter does not exist.
+ */
+ public function get( $key = null ) {
+ return $this->arrayOrArrayValue($this->get, $key);
+ }
+
+ /**
+ * Fetch POST parameter(s)
+ * @param string $key Name of parameter
+ * @return array|string|null All parameters, parameter value if $key
+ * and parameter exists, or NULL if $key
+ * and parameter does not exist.
+ */
+ public function post( $key = null ) {
+ return $this->arrayOrArrayValue($this->post, $key);
+ }
+
+ /**
+ * Fetch PUT parameter(s)
+ * @param string $key Name of parameter
+ * @return array|string|null All parameters, parameter value if $key
+ * and parameter exists, or NULL if $key
+ * and parameter does not exist.
+ */
+ public function put( $key = null ) {
+ return $this->arrayOrArrayValue($this->put, $key);
+ }
+
+ /**
+ * Fetch COOKIE value(s)
+ * @param string $key The cookie name
+ * @return array|string|null All parameters, parameter value if $key
+ * and parameter exists, or NULL if $key
+ * and parameter does not exist.
+ */
+ public function cookies( $key = null ) {
+ return $this->arrayOrArrayValue($this->cookies, $key);
+ }
+
+ /**
+ * Get HTTP request header
+ * @param string $key The header name
+ * @return array|string|null All parameters, parameter value if $key
+ * and parameter exists, or NULL if $key
+ * and parameter does not exist.
+ */
+ public function headers( $key = null ) {
+ return is_null($key) ? $this->headers : $this->arrayOrArrayValue($this->headers, $this->convertHttpHeaderName($key));
+ }
+
+ /**
+ * Get HTTP request body
+ * @return string|false String, or FALSE if body could not be read
+ */
+ public function getBody() {
+ return $this->body;
+ }
+
+ /**
+ * Get HTTP method
+ * @return string
+ */
+ public function getMethod() {
+ return $this->method;
+ }
+
+ /**
+ * Get HTTP request content type
+ * @return string
+ */
+ public function getContentType() {
+ if ( !isset($this->contentType) ) {
+ $contentType = 'application/x-www-form-urlencoded';
+ $header = $this->headers('CONTENT_TYPE');
+ if ( !is_null($header) ) {
+ $headerParts = preg_split('/\s*;\s*/', $header);
+ $contentType = $headerParts[0];
+ }
+ $this->contentType = $contentType;
+ }
+ return $this->contentType;
+ }
+
+ /**
+ * Get HTTP request resource URI
+ * @return string
+ */
+ public function getResourceUri() {
+ return $this->resource;
+ }
+
+ /**
+ * Get HTTP request root URI
+ * @return string
+ */
+ public function getRootUri() {
+ return $this->root;
+ }
+
+ /**
+ * Fetch array or array value
+ * @param array $array
+ * @param string $key
+ * @return array|mixed Array if key is null, else array value
+ */
+ protected function arrayOrArrayValue( array &$array, $key = null ) {
+ return is_null($key) ? $array : $this->arrayValueForKey($array, $key);
+ }
+
+ /**
+ * Fetch value from array
+ * @return mixed|null
+ */
+ protected function arrayValueForKey( array &$array, $key ) {
+ return isset($array[(string)$key]) ? $array[(string)$key] : null;
+ }
+
+ /**
+ * Strip slashes from string or array of strings
+ * @param array|string $rawData
+ * @return array|string
+ */
+ public static function stripSlashesIfMagicQuotes( $rawData ) {
+ if ( get_magic_quotes_gpc() ) {
+ return is_array($rawData) ? array_map(array('self', 'stripSlashesIfMagicQuotes'), $rawData) : stripslashes($rawData);
+ } else {
+ return $rawData;
+ }
+ }
+
+ /**
+ * Get PUT parameters
+ * @return array Key-value array of HTTP request PUT parameters
+ */
+ protected function loadPutParameters() {
+ if ( $this->getContentType() === 'application/x-www-form-urlencoded' ) {
+ $input = is_string($this->body) ? $this->body : '';
+ if ( function_exists('mb_parse_str') ) {
+ mb_parse_str($input, $output);
+ } else {
+ parse_str($input, $output);
+ }
+ return $output;
+ } else {
+ return array();
+ }
+ }
+
+ /**
+ * Get HTTP request headers
+ * @return array Key-value array of HTTP request headers
+ */
+ protected function loadHttpHeaders() {
+ $headers = array();
+ foreach ( $_SERVER as $key => $value ) {
+ $key = $this->convertHttpHeaderName($key);
+ if ( strpos($key, 'http-') === 0 || in_array($key, $this->additionalHeaders) ) {
+ $name = str_replace('http-', '', $key);
+ $headers[$name] = $value;
+ }
+ }
+ return $headers;
+ }
+
+ /**
+ * Convert HTTP header name
+ * @return string
+ */
+ protected function convertHttpHeaderName( $name ) {
+ return str_replace('_', '-', strtolower($name));
+ }
+
+ /**
+ * Check for HTTP request method override
+ *
+ * Because traditional web browsers do not support PUT and DELETE
+ * HTTP methods, we use a hidden form input field to
+ * mimic PUT and DELETE requests. We check for this override here.
+ *
+ * @return void
+ */
+ protected function checkForHttpMethodOverride() {
+ if ( isset($this->post[self::METHOD_OVERRIDE]) ) {
+ $this->method = $this->post[self::METHOD_OVERRIDE];
+ unset($this->post[self::METHOD_OVERRIDE]);
+ if ( $this->isPut() ) {
+ $this->put = $this->post;
+ }
+ }
+ }
+
+}
View
326 Vendor/Slim/Http/Response.php
@@ -0,0 +1,326 @@
+<?php
+/**
+ * Slim - a micro PHP 5 framework
+ *
+ * @author Josh Lockhart <info@joshlockhart.com>
+ * @copyright 2011 Josh Lockhart
+ * @link http://www.slimframework.com
+ * @license http://www.slimframework.com/license
+ * @version 1.5.0
+ *
+ * MIT LICENSE
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/**
+ * Response
+ *
+ * Object-oriented representation of an HTTP response that is
+ * returned to the client. This class is responsible for:
+ *
+ * - HTTP response status
+ * - HTTP response body
+ * - HTTP response headers
+ * - HTTP response cookies
+ *
+ * @package Slim
+ * @author Josh Lockhart <info@joshlockhart.com>
+ * @author Kris Jordan <http://github.com/KrisJordan>
+ * @since Version 1.0
+ */
+class Slim_Http_Response {
+
+ /**
+ * @var Slim_Http_Request
+ */
+ protected $request;
+
+ /**
+ * @var string
+ */
+ protected $httpVersion = '1.1';
+
+ /**
+ * @var int HTTP status code
+ */
+ protected $status = 200;
+
+ /**
+ * @var array Key-value array of HTTP response headers
+ */
+ protected $headers = array();
+
+ /**
+ * @var string HTTP response body
+ */
+ protected $body = '';
+
+ /**
+ * @var int Length of HTTP response body
+ */
+ protected $length = 0;
+
+ /**
+ * @var array HTTP response codes and messages
+ */
+ protected static $messages = array(
+ //Informational 1xx
+ 100 => '100 Continue',
+ 101 => '101 Switching Protocols',
+ //Successful 2xx
+ 200 => '200 OK',
+ 201 => '201 Created',
+ 202 => '202 Accepted',
+ 203 => '203 Non-Authoritative Information',
+ 204 => '204 No Content',
+ 205 => '205 Reset Content',
+ 206 => '206 Partial Content',
+ //Redirection 3xx
+ 300 => '300 Multiple Choices',
+ 301 => '301 Moved Permanently',
+ 302 => '302 Found',
+ 303 => '303 See Other',
+ 304 => '304 Not Modified',
+ 305 => '305 Use Proxy',
+ 306 => '306 (Unused)',
+ 307 => '307 Temporary Redirect',
+ //Client Error 4xx
+ 400 => '400 Bad Request',
+ 401 => '401 Unauthorized',
+ 402 => '402 Payment Required',
+ 403 => '403 Forbidden',
+ 404 => '404 Not Found',
+ 405 => '405 Method Not Allowed',
+ 406 => '406 Not Acceptable',
+ 407 => '407 Proxy Authentication Required',
+ 408 => '408 Request Timeout',
+ 409 => '409 Conflict',
+ 410 => '410 Gone',
+ 411 => '411 Length Required',
+ 412 => '412 Precondition Failed',
+ 413 => '413 Request Entity Too Large',
+ 414 => '414 Request-URI Too Long',
+ 415 => '415 Unsupported Media Type',
+ 416 => '416 Requested Range Not Satisfiable',
+ 417 => '417 Expectation Failed',
+ 422 => '422 Unprocessable Entity',
+ 423 => '423 Locked',
+ //Server Error 5xx
+ 500 => '500 Internal Server Error',
+ 501 => '501 Not Implemented',
+ 502 => '502 Bad Gateway',
+ 503 => '503 Service Unavailable',
+ 504 => '504 Gateway Timeout',
+ 505 => '505 HTTP Version Not Supported'
+ );
+
+ /**
+ * @var CookieJar Manages Cookies to be sent with this Response
+ */
+ protected $cookieJar;
+
+ /**
+ * Constructor
+ */
+ public function __construct( Slim_Http_Request $req ) {
+ $this->request = $req;
+ $this->header('Content-Type', 'text/html');
+ }
+
+ /**
+ * Set and/or get the HTTP response version
+ * @param string $version
+ * @return void
+ * @throws InvalidArgumentException If argument is not a valid HTTP version
+ */
+ public function httpVersion( $version = null ) {
+ if ( $version ) {
+ $version = (string)$version;
+ if ( $version === '1.0' || $version === '1.1' ) {
+ $this->httpVersion = $version;
+ } else {
+ throw new InvalidArgumentException('Invalid HTTP version in Response object');
+ }
+ }
+ return $this->httpVersion;
+ }
+
+ /**
+ * Set and/or get the HTTP response status code
+ * @param int $status
+ * @return int
+ * @throws InvalidArgumentException If argument is not a valid HTTP status code
+ */
+ public function status( $status = null ) {
+ if ( !is_null($status) ) {
+ if ( !in_array(intval($status), array_keys(self::$messages)) ) {
+ throw new InvalidArgumentException('Cannot set Response status. Provided status code "' . $status . '" is not a valid HTTP response code.');
+ }
+ $this->status = intval($status);
+ }
+ return $this->status;
+ }
+
+ /**
+ * Get HTTP response headers
+ * @return array
+ */
+ public function headers() {
+ return $this->headers;
+ }
+
+ /**
+ * Get and/or set an HTTP response header
+ * @param string $key The header name
+ * @param string $value The header value
+ * @return string|null The header value, or NULL if header not set
+ */
+ public function header( $key, $value = null ) {
+ if ( !is_null($value) ) {
+ $this->headers[$key] = $value;
+ }
+ return isset($this->headers[$key]) ? $this->headers[$key] : null;
+ }
+
+ /**
+