Thank you for your interest in renewing your account! To complete the process, please now click the button below so that you may pay for your renewal via PayPal. The cost is $10 (US) per year. Note: After renewing your membership at PayPal, you must logout and log back in at this site in order process the renewal.
Thank you for your interest in this content. You must be logged in as a registered user to view any of the PDFs listed below.
13 | @elseif (User::is_expired())
14 |
Thank you for your interest in this content. Unfortunately your account has expired. Please {{ HTML::link('renew', 'renew your account') }} in order to access this file.
15 | @endif
16 |
17 | {{ $pdf->description }}
18 |
19 | @endsection
20 |
--------------------------------------------------------------------------------
/laravel/vendor/Symfony/Component/HttpFoundation/File/Exception/UnexpectedTypeException.php:
--------------------------------------------------------------------------------
1 |
7 | *
8 | * For the full copyright and license information, please view the LICENSE
9 | * file that was distributed with this source code.
10 | */
11 |
12 | namespace Symfony\Component\HttpFoundation\File\Exception;
13 |
14 | class UnexpectedTypeException extends FileException
15 | {
16 | public function __construct($value, $expectedType)
17 | {
18 | parent::__construct(sprintf('Expected argument of type %s, %s given', $expectedType, is_object($value) ? get_class($value) : gettype($value)));
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/laravel/vendor/Symfony/Component/HttpFoundation/Session/Storage/Handler/NativeSessionHandler.php:
--------------------------------------------------------------------------------
1 |
7 | *
8 | * For the full copyright and license information, please view the LICENSE
9 | * file that was distributed with this source code.
10 | */
11 |
12 | namespace Symfony\Component\HttpFoundation\Session\Storage\Handler;
13 |
14 | /**
15 | * Adds SessionHandler functionality if available.
16 | *
17 | * @see http://php.net/sessionhandler
18 | */
19 |
20 | if (version_compare(phpversion(), '5.4.0', '>=')) {
21 | class NativeSessionHandler extends \SessionHandler {}
22 | } else {
23 | class NativeSessionHandler {}
24 | }
25 |
--------------------------------------------------------------------------------
/laravel/cli/tasks/help.php:
--------------------------------------------------------------------------------
1 | $commands)
23 | {
24 | if($i++ != 0) echo PHP_EOL;
25 |
26 | echo PHP_EOL . "# $category" . PHP_EOL;
27 |
28 | foreach($commands as $command => $details)
29 | {
30 | echo PHP_EOL . str_pad($command, 20) . str_pad($details->description, 30);
31 | }
32 | }
33 | }
34 | }
--------------------------------------------------------------------------------
/application/views/account/login_form.blade.php:
--------------------------------------------------------------------------------
1 |
2 |
Login
3 |
4 |
5 | {{ Form::open('/') }}
6 |
7 |
8 | @if (Session::has('failed'))
9 | The email address and password do not match those on file.
10 | @endif
11 |
12 |
13 | {{ Form::create_form_input('text', 'login_email', $errors) }}
14 |
15 |
16 | {{ Form::create_form_input('password', 'login_password', $errors) }}
17 |
18 | {{ HTML::link('forgot_password', 'Forgot?') }}
19 |
20 | {{ Form::submit('Login →') }}
21 |
22 |
23 | {{ Form::close() }}
24 |
--------------------------------------------------------------------------------
/readme.md:
--------------------------------------------------------------------------------
1 | # ecom1_laravel
2 |
3 | This is the Laravel 3.x version of Larry Ullman's e-commerce demo [Knowledge is Power](http://ecom1.dmcinsights.com),
4 | from his book [Effortless E-Commerce with PHP and MySQL](http://www.larryullman.com/books/effortless-e-commerce-with-php-and-mysql).
5 |
6 | ### Features
7 |
8 | - Login/Logout
9 | - User registration
10 | - Forgot password
11 | - Change password
12 | - Tag as favorite, list of favorites
13 | - History
14 | - Add page
15 | - Upload/Download PDF
16 | - Most Popular list
17 |
18 | ### Live site
19 |
20 | http://ecom1laravel.phpfogapp.com
21 |
22 | ## Credits
23 |
24 | - [Larry Ullman](http://www.larryullman.com) for original code
25 | - [spyka Webmaster](http://www.spyka.net) for CSS template
26 | - [Laravel](http://laravel.com/)
--------------------------------------------------------------------------------
/application/models/pdfs.php:
--------------------------------------------------------------------------------
1 | $tmp_name,
14 | 'title' => strip_tags($pdf['title']),
15 | 'description' => strip_tags($pdf['description']),
16 | 'file_name' => $pdf['pdf']['name'],
17 | 'size' => round($pdf['pdf']['size'] / 1024),
18 | ));
19 | }
20 |
21 | public static function all()
22 | {
23 | return self::order_by('created_at', 'desc')->get();
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/laravel/cli/tasks/bundle/repository.php:
--------------------------------------------------------------------------------
1 | api.$bundle);
25 |
26 | return json_decode($bundle, true);
27 | }
28 |
29 | }
--------------------------------------------------------------------------------
/laravel/database/expression.php:
--------------------------------------------------------------------------------
1 | value = $value;
21 | }
22 |
23 | /**
24 | * Get the string value of the database expression.
25 | *
26 | * @return string
27 | */
28 | public function get()
29 | {
30 | return $this->value;
31 | }
32 |
33 | /**
34 | * Get the string value of the database expression.
35 | *
36 | * @return string
37 | */
38 | public function __toString()
39 | {
40 | return $this->get();
41 | }
42 |
43 | }
--------------------------------------------------------------------------------
/laravel/tests/cases/hash.test.php:
--------------------------------------------------------------------------------
1 | assertTrue(strlen(Hash::make('taylor')) == 60);
13 | }
14 |
15 | /**
16 | * Test the Hash::check method.
17 | *
18 | * @group laravel
19 | */
20 | public function testHashCheckFailsWhenNotMatching()
21 | {
22 | $hash = Hash::make('taylor');
23 |
24 | $this->assertFalse(Hash::check('foo', $hash));
25 | }
26 |
27 | /**
28 | * Test the Hash::check method.
29 | *
30 | * @group laravel
31 | */
32 | public function testHashCheckPassesWhenMatches()
33 | {
34 | $this->assertTrue(Hash::check('taylor', Hash::make('taylor')));
35 | }
36 |
37 | }
--------------------------------------------------------------------------------
/laravel/vendor/Symfony/Component/HttpFoundation/File/MimeType/ExtensionGuesserInterface.php:
--------------------------------------------------------------------------------
1 |
7 | *
8 | * For the full copyright and license information, please view the LICENSE
9 | * file that was distributed with this source code.
10 | */
11 |
12 | namespace Symfony\Component\HttpFoundation\File\MimeType;
13 |
14 | /**
15 | * Guesses the file extension corresponding to a given mime type
16 | */
17 | interface ExtensionGuesserInterface
18 | {
19 | /**
20 | * Makes a best guess for a file extension, given a mime type
21 | *
22 | * @param string $mimeType The mime type
23 | * @return string The guessed extension or NULL, if none could be guessed
24 | */
25 | function guess($mimeType);
26 | }
27 |
--------------------------------------------------------------------------------
/laravel/vendor/Symfony/Component/Console/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "symfony/console",
3 | "type": "library",
4 | "description": "Symfony Console Component",
5 | "keywords": [],
6 | "homepage": "http://symfony.com",
7 | "license": "MIT",
8 | "authors": [
9 | {
10 | "name": "Fabien Potencier",
11 | "email": "fabien@symfony.com"
12 | },
13 | {
14 | "name": "Symfony Community",
15 | "homepage": "http://symfony.com/contributors"
16 | }
17 | ],
18 | "require": {
19 | "php": ">=5.3.2"
20 | },
21 | "autoload": {
22 | "psr-0": { "Symfony\\Component\\Console": "" }
23 | },
24 | "target-dir": "Symfony/Component/Console",
25 | "extra": {
26 | "branch-alias": {
27 | "dev-master": "2.1-dev"
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/laravel/database/connectors/sqlite.php:
--------------------------------------------------------------------------------
1 | options($config);
14 |
15 | // SQLite provides supported for "in-memory" databases, which exist only for
16 | // lifetime of the request. Any given in-memory database may only have one
17 | // PDO connection open to it at a time. These are mainly for tests.
18 | if ($config['database'] == ':memory:')
19 | {
20 | return new PDO('sqlite::memory:', null, null, $options);
21 | }
22 |
23 | $path = path('storage').'database'.DS.$config['database'].'.sqlite';
24 |
25 | return new PDO('sqlite:'.$path, null, null, $options);
26 | }
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/public/.htaccess:
--------------------------------------------------------------------------------
1 | # Apache configuration file
2 | # http://httpd.apache.org/docs/2.2/mod/quickreference.html
3 |
4 | # Note: ".htaccess" files are an overhead for each request. This logic should
5 | # be placed in your Apache config whenever possible.
6 | # http://httpd.apache.org/docs/2.2/howto/htaccess.html
7 |
8 | # Turning on the rewrite engine is necessary for the following rules and
9 | # features. "+FollowSymLinks" must be enabled for this to work symbolically.
10 |
11 |
12 | Options +FollowSymLinks
13 | RewriteEngine On
14 |
15 |
16 | # For all files not found in the file system, reroute the request to the
17 | # "index.php" front controller, keeping the query string intact
18 |
19 |
20 | RewriteCond %{REQUEST_FILENAME} !-f
21 | RewriteCond %{REQUEST_FILENAME} !-d
22 | RewriteRule ^(.*)$ index.php/$1 [L]
23 |
--------------------------------------------------------------------------------
/artisan:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env php
2 |
9 | * @link http://laravel.com
10 | */
11 |
12 | // --------------------------------------------------------------
13 | // Set the core Laravel path constants.
14 | // --------------------------------------------------------------
15 | require 'paths.php';
16 |
17 | // --------------------------------------------------------------
18 | // Bootstrap the Laravel core.
19 | // --------------------------------------------------------------
20 | require path('sys').'core.php';
21 |
22 | // --------------------------------------------------------------
23 | // Launch the Laravel "Artisan" CLI.
24 | // --------------------------------------------------------------
25 | require path('sys').'cli/artisan'.EXT;
--------------------------------------------------------------------------------
/laravel/vendor/Symfony/Component/HttpFoundation/File/Exception/FileNotFoundException.php:
--------------------------------------------------------------------------------
1 |
7 | *
8 | * For the full copyright and license information, please view the LICENSE
9 | * file that was distributed with this source code.
10 | */
11 |
12 | namespace Symfony\Component\HttpFoundation\File\Exception;
13 |
14 | /**
15 | * Thrown when a file was not found
16 | *
17 | * @author Bernhard Schussek
18 | */
19 | class FileNotFoundException extends FileException
20 | {
21 | /**
22 | * Constructor.
23 | *
24 | * @param string $path The path to the file that was not found
25 | */
26 | public function __construct($path)
27 | {
28 | parent::__construct(sprintf('The file "%s" does not exist', $path));
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/laravel/vendor/Symfony/Component/HttpFoundation/LaravelResponse.php:
--------------------------------------------------------------------------------
1 |
7 | *
8 | * @api
9 | */
10 | class LaravelResponse extends Response
11 | {
12 |
13 | /**
14 | * Sends HTTP headers and content.
15 | *
16 | * @return Response
17 | *
18 | * @api
19 | */
20 | public function send()
21 | {
22 | $this->sendHeaders();
23 | $this->sendContent();
24 |
25 | return $this;
26 | }
27 |
28 | /**
29 | * Finishes the request for PHP-FastCGI
30 | *
31 | * @return void
32 | */
33 | public function finish()
34 | {
35 | if (function_exists('fastcgi_finish_request')) {
36 | fastcgi_finish_request();
37 | }
38 | }
39 |
40 | }
41 |
--------------------------------------------------------------------------------
/application/models/page.php:
--------------------------------------------------------------------------------
1 |
Thank you for your interest in this content. You must be logged in as a registered user to view site content.
13 | @elseif (User::is_expired())
14 |
Thank you for your interest in this content. Unfortunately your account has expired. Please {{ HTML::link('renew', 'renew your account') }} in order to access site content.
15 | @endif
16 |
17 | @if (empty($titles))
18 |
There are currently no pages of content associated with this category. Please check back again!
Thank you for your interest in this content. You must be logged in as a registered user to view any of the PDFs listed below.
13 | @elseif (User::is_expired())
14 |
Thank you for your interest in this content. Unfortunately your account has expired. Please = HTML::link('renew', 'renew your account') ?> in order to view any of the PDFs listed below.
15 | @endif
16 |
17 | @if (empty($titles))
18 |
There are currently no PDFs available to view. Please check back again!
Thank you for registering! To complete the process, please now click the button below so that you may pay for your site access via PayPal. The cost is $10 (US) per year.
16 |
17 | @else
18 |
Welcome
19 |
Welcome to Knowledge is Power, a site dedicated to keeping you up to date on the Web security and programming information you need to know.
20 |
21 |
Most Popular Pages
22 |
23 |
24 | @foreach(History::most_popular() as $page)
25 |
29 | @endif
30 |
31 | @endsection
--------------------------------------------------------------------------------
/laravel/vendor/Symfony/Component/HttpFoundation/Session/SessionBagInterface.php:
--------------------------------------------------------------------------------
1 |
7 | *
8 | * For the full copyright and license information, please view the LICENSE
9 | * file that was distributed with this source code.
10 | */
11 |
12 | namespace Symfony\Component\HttpFoundation\Session;
13 |
14 | /**
15 | * Session Bag store.
16 | *
17 | * @author Drak
18 | */
19 | interface SessionBagInterface
20 | {
21 | /**
22 | * Gets this bag's name
23 | *
24 | * @return string
25 | */
26 | function getName();
27 |
28 | /**
29 | * Initializes the Bag
30 | *
31 | * @param array $array
32 | */
33 | function initialize(array &$array);
34 |
35 | /**
36 | * Gets the storage key for this bag.
37 | *
38 | * @return string
39 | */
40 | function getStorageKey();
41 |
42 | /**
43 | * Clears out data from bag.
44 | *
45 | * @return mixed Whatever data was contained.
46 | */
47 | function clear();
48 | }
49 |
--------------------------------------------------------------------------------
/laravel/vendor/Symfony/Component/Console/Helper/Helper.php:
--------------------------------------------------------------------------------
1 |
7 | *
8 | * For the full copyright and license information, please view the LICENSE
9 | * file that was distributed with this source code.
10 | */
11 |
12 | namespace Symfony\Component\Console\Helper;
13 |
14 | /**
15 | * Helper is the base class for all helper classes.
16 | *
17 | * @author Fabien Potencier
18 | */
19 | abstract class Helper implements HelperInterface
20 | {
21 | protected $helperSet = null;
22 |
23 | /**
24 | * Sets the helper set associated with this helper.
25 | *
26 | * @param HelperSet $helperSet A HelperSet instance
27 | */
28 | public function setHelperSet(HelperSet $helperSet = null)
29 | {
30 | $this->helperSet = $helperSet;
31 | }
32 |
33 | /**
34 | * Gets the helper set associated with this helper.
35 | *
36 | * @return HelperSet A HelperSet instance
37 | */
38 | public function getHelperSet()
39 | {
40 | return $this->helperSet;
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/laravel/vendor/Symfony/Component/Console/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2004-2012 Fabien Potencier
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy
4 | of this software and associated documentation files (the "Software"), to deal
5 | in the Software without restriction, including without limitation the rights
6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | copies of the Software, and to permit persons to whom the Software is furnished
8 | to do so, subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in all
11 | copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | THE SOFTWARE.
20 |
--------------------------------------------------------------------------------
/application/views/about.blade.php:
--------------------------------------------------------------------------------
1 | @layout('base')
2 |
3 | @section('page_title')
4 | About
5 | @endsection
6 |
7 | @section('content')
8 |
9 |
About
10 |
11 |
12 |
Knowledge is Power is the first example from the book {{ HTML::link('http://www.larryullman.com/books/effortless-e-commerce-with-php-and-mysql/', 'Effortless E-Commerce with PHP and MySQL') }} by Larry Ullman
13 |
Original code by Larry Ullman. Laravel 3.x version by hush2.
14 |
15 |
Credits
16 |
Common Attack tips from {{ HTML::link('http://www.cmswire.com/cms/web-cms/how-they-hack-your-website-overview-of-common-techniques-002339.php', 'CMSWire') }}
17 |
Database Security tips from {{ HTML::link('https://securosis.com/blog/database-security-fundamentals-access-authorization/', 'Securosis') }}
18 |
General Web Security tips from {{ HTML::link('http://web.appstorm.net/roundups/self-publishing/15-great-ways-to-secure-your-website/', 'Web.AppStorm') }}
19 |
PHP Security tips from {{ HTML::link('http://www.ultramegatech.com/2009/08/5-basic-php-security-tips/', 'UltraMega') }}
20 |
21 | @endsection
22 |
--------------------------------------------------------------------------------
/laravel/vendor/Symfony/Component/HttpFoundation/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2004-2012 Fabien Potencier
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy
4 | of this software and associated documentation files (the "Software"), to deal
5 | in the Software without restriction, including without limitation the rights
6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | copies of the Software, and to permit persons to whom the Software is furnished
8 | to do so, subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in all
11 | copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | THE SOFTWARE.
20 |
--------------------------------------------------------------------------------
/laravel/vendor/Symfony/Component/HttpFoundation/Session/Storage/Proxy/NativeProxy.php:
--------------------------------------------------------------------------------
1 |
7 | *
8 | * For the full copyright and license information, please view the LICENSE
9 | * file that was distributed with this source code.
10 | */
11 |
12 | namespace Symfony\Component\HttpFoundation\Session\Storage\Proxy;
13 |
14 | /**
15 | * NativeProxy.
16 | *
17 | * This proxy is built-in session handlers in PHP 5.3.x
18 | *
19 | * @author Drak
20 | */
21 | class NativeProxy extends AbstractProxy
22 | {
23 | /**
24 | * Constructor.
25 | */
26 | public function __construct()
27 | {
28 | // this makes an educated guess as to what the handler is since it should already be set.
29 | $this->saveHandlerName = ini_get('session.save_handler');
30 | }
31 |
32 | /**
33 | * Returns true if this handler wraps an internal PHP session save handler using \SessionHandler.
34 | *
35 | * @return bool False.
36 | */
37 | public function isWrapper()
38 | {
39 | return false;
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/laravel/vendor/Symfony/Component/HttpFoundation/LaravelRequest.php:
--------------------------------------------------------------------------------
1 | server->get('CONTENT_TYPE'), 'application/x-www-form-urlencoded')
17 | && in_array(strtoupper($request->server->get('REQUEST_METHOD', 'GET')), array('PUT', 'DELETE', 'PATCH'))
18 | ) {
19 | parse_str($request->getContent(), $data);
20 | if (magic_quotes()) $data = array_strip_slashes($data);
21 | $request->request = new ParameterBag($data);
22 | }
23 |
24 | return $request;
25 | }
26 |
27 | /**
28 | * Get the root URL of the application.
29 | *
30 | * @return string
31 | */
32 | public function getRootUrl()
33 | {
34 | return $this->getScheme().'://'.$this->getHttpHost().$this->getBasePath();
35 | }
36 |
37 | }
--------------------------------------------------------------------------------
/laravel/vendor/Symfony/Component/Console/Helper/HelperInterface.php:
--------------------------------------------------------------------------------
1 |
7 | *
8 | * For the full copyright and license information, please view the LICENSE
9 | * file that was distributed with this source code.
10 | */
11 |
12 | namespace Symfony\Component\Console\Helper;
13 |
14 | /**
15 | * HelperInterface is the interface all helpers must implement.
16 | *
17 | * @author Fabien Potencier
18 | *
19 | * @api
20 | */
21 | interface HelperInterface
22 | {
23 | /**
24 | * Sets the helper set associated with this helper.
25 | *
26 | * @param HelperSet $helperSet A HelperSet instance
27 | *
28 | * @api
29 | */
30 | function setHelperSet(HelperSet $helperSet = null);
31 |
32 | /**
33 | * Gets the helper set associated with this helper.
34 | *
35 | * @return HelperSet A HelperSet instance
36 | *
37 | * @api
38 | */
39 | function getHelperSet();
40 |
41 | /**
42 | * Returns the canonical name of this helper.
43 | *
44 | * @return string The canonical name
45 | *
46 | * @api
47 | */
48 | function getName();
49 | }
50 |
--------------------------------------------------------------------------------
/public/js/tinyeditor/tinyeditor.css:
--------------------------------------------------------------------------------
1 | #tinyeditor {border:none; margin:0; padding:0; font:14px 'Courier New',Verdana}
2 | .tinyeditor {border:1px solid #bbb; padding:0 1px 1px; font:12px Verdana,Arial}
3 | .tinyeditor iframe {border:none; overflow:hidden}
4 | .tinyeditor-header {height:31px; border-bottom:1px solid #bbb; background:url(images/header-bg.gif) repeat-x; padding-top:1px}
5 | .tinyeditor-header select {float:left; margin-top:5px}
6 | .tinyeditor-font {margin-left:12px}
7 | .tinyeditor-size {margin:0 3px}
8 | .tinyeditor-style {margin-right:12px}
9 | .tinyeditor-divider {float:left; width:1px; height:30px; background:#ccc}
10 | .tinyeditor-control {float:left; width:34px; height:30px; cursor:pointer; background-image:url(images/icons.png)}
11 | .tinyeditor-control:hover {background-color:#fff; background-position:30px 0}
12 | .tinyeditor-footer {height:32px; border-top:1px solid #bbb; background:#f5f5f5}
13 | .toggle {float:left; background:url(images/icons.png) -34px 2px no-repeat; padding:9px 13px 0 31px; height:23px; border-right:1px solid #ccc; cursor:pointer; color:#666}
14 | .toggle:hover {background-color:#fff}
15 | .resize {float:right; height:32px; width:32px; background:url(images/resize.gif) 15px 15px no-repeat; cursor:s-resize}
16 | #editor {cursor:text; margin:10px}
--------------------------------------------------------------------------------
/public/index.php:
--------------------------------------------------------------------------------
1 |
8 | * @link http://laravel.com
9 | */
10 |
11 | // --------------------------------------------------------------
12 | // Tick... Tock... Tick... Tock...
13 | // --------------------------------------------------------------
14 | define('LARAVEL_START', microtime(true));
15 |
16 | // --------------------------------------------------------------
17 | // Indicate that the request is from the web.
18 | // --------------------------------------------------------------
19 | $web = true;
20 |
21 | // --------------------------------------------------------------
22 | // Set the core Laravel path constants.
23 | // --------------------------------------------------------------
24 | require '../paths.php';
25 |
26 | // --------------------------------------------------------------
27 | // Unset the temporary web variable.
28 | // --------------------------------------------------------------
29 | unset($web);
30 |
31 | // --------------------------------------------------------------
32 | // Launch Laravel.
33 | // --------------------------------------------------------------
34 | require path('sys').'laravel.php';
--------------------------------------------------------------------------------
/laravel/vendor/Symfony/Component/HttpFoundation/Session/Storage/Handler/NativeFileSessionHandler.php:
--------------------------------------------------------------------------------
1 |
7 | *
8 | * For the full copyright and license information, please view the LICENSE
9 | * file that was distributed with this source code.
10 | */
11 |
12 | namespace Symfony\Component\HttpFoundation\Session\Storage\Handler;
13 |
14 | /**
15 | * NativeFileSessionHandler.
16 | *
17 | * Native session handler using PHP's built in file storage.
18 | *
19 | * @author Drak
20 | */
21 | class NativeFileSessionHandler extends NativeSessionHandler
22 | {
23 | /**
24 | * Constructor.
25 | *
26 | * @param string $savePath Path of directory to save session files. Default null will leave setting as defined by PHP.
27 | */
28 | public function __construct($savePath = null)
29 | {
30 | if (null === $savePath) {
31 | $savePath = ini_get('session.save_path');
32 | }
33 |
34 | if ($savePath && !is_dir($savePath)) {
35 | mkdir($savePath, 0777, true);
36 | }
37 |
38 | ini_set('session.save_handler', 'files');
39 | ini_set('session.save_path', $savePath);
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/laravel/tests/phpunit.php:
--------------------------------------------------------------------------------
1 | relationships[$relationship] = null;
27 | }
28 | }
29 |
30 | /**
31 | * Match eagerly loaded child models to their parent models.
32 | *
33 | * @param array $parents
34 | * @param array $children
35 | * @return void
36 | */
37 | public function match($relationship, &$parents, $children)
38 | {
39 | $foreign = $this->foreign_key();
40 |
41 | foreach ($parents as &$parent)
42 | {
43 | $matching = array_first($children, function($k, $v) use (&$parent, $foreign)
44 | {
45 | return $v->$foreign == $parent->get_key();
46 | });
47 |
48 | $parent->relationships[$relationship] = $matching;
49 | }
50 | }
51 |
52 | }
--------------------------------------------------------------------------------
/laravel/tests/cases/fluent.test.php:
--------------------------------------------------------------------------------
1 | 'Taylor', 'age' => 25);
15 |
16 | $fluent = new Fluent($array);
17 |
18 | $this->assertEquals($array, $fluent->attributes);
19 | }
20 |
21 | /**
22 | * Test the Fluent::get method.
23 | *
24 | * @group laravel
25 | */
26 | public function testGetMethodReturnsAttribute()
27 | {
28 | $fluent = new Fluent(array('name' => 'Taylor'));
29 |
30 | $this->assertEquals('Taylor', $fluent->get('name'));
31 | $this->assertEquals('Default', $fluent->get('foo', 'Default'));
32 | $this->assertEquals('Taylor', $fluent->name);
33 | $this->assertNull($fluent->foo);
34 | }
35 |
36 | public function testMagicMethodsCanBeUsedToSetAttributes()
37 | {
38 | $fluent = new Fluent;
39 |
40 | $fluent->name = 'Taylor';
41 | $fluent->developer();
42 | $fluent->age(25);
43 |
44 | $this->assertEquals('Taylor', $fluent->name);
45 | $this->assertTrue($fluent->developer);
46 | $this->assertEquals(25, $fluent->age);
47 | $this->assertInstanceOf('Laravel\\Fluent', $fluent->programmer());
48 | }
49 |
50 | }
--------------------------------------------------------------------------------
/application/views/account/change_password.blade.php:
--------------------------------------------------------------------------------
1 | @layout('base')
2 |
3 | @section('page_title')
4 | Change Your Password
5 | @endsection
6 |
7 | @section('content')
8 |
9 | @if (Session::has('success'))
10 |
21 | {{ Form::label('new_password', 'New Password') }}
22 | {{ Form::create_form_input('password', 'new_password', $errors) }} Must be between 6 and 20 characters long, with at least one lowercase letter, one uppercase letter, and one number.
23 |
28 | {{ Form::submit('Change →', array('class' => 'formbutton')) }}
29 | {{ Form::close() }}
30 | @endif
31 |
32 | @endsection
33 |
--------------------------------------------------------------------------------
/laravel/session/drivers/apc.php:
--------------------------------------------------------------------------------
1 | apc = $apc;
21 | }
22 |
23 | /**
24 | * Load a session from storage by a given ID.
25 | *
26 | * If no session is found for the ID, null will be returned.
27 | *
28 | * @param string $id
29 | * @return array
30 | */
31 | public function load($id)
32 | {
33 | return $this->apc->get($id);
34 | }
35 |
36 | /**
37 | * Save a given session to storage.
38 | *
39 | * @param array $session
40 | * @param array $config
41 | * @param bool $exists
42 | * @return void
43 | */
44 | public function save($session, $config, $exists)
45 | {
46 | $this->apc->put($session['id'], $session, $config['lifetime']);
47 | }
48 |
49 | /**
50 | * Delete a session from storage by a given ID.
51 | *
52 | * @param string $id
53 | * @return void
54 | */
55 | public function delete($id)
56 | {
57 | $this->apc->forget($id);
58 | }
59 |
60 | }
--------------------------------------------------------------------------------
/laravel/session/drivers/cookie.php:
--------------------------------------------------------------------------------
1 | PDO::CASE_LOWER,
12 | PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
13 | PDO::ATTR_ORACLE_NULLS => PDO::NULL_NATURAL,
14 | PDO::ATTR_STRINGIFY_FETCHES => false,
15 | );
16 |
17 | /**
18 | * Establish a PDO database connection.
19 | *
20 | * @param array $config
21 | * @return PDO
22 | */
23 | public function connect($config)
24 | {
25 | extract($config);
26 |
27 | // Format the SQL Server connection string. This connection string format can
28 | // also be used to connect to Azure SQL Server databases. The port is defined
29 | // directly after the server name, so we'll create that first.
30 | $port = (isset($port)) ? ','.$port : '';
31 |
32 | //check for dblib for mac users connecting to mssql (utilizes freetds)
33 | if (!empty($dsn_type) and $dsn_type == 'dblib')
34 | {
35 | $dsn = "dblib:host={$host}{$port};dbname={$database}";
36 | }
37 | else
38 | {
39 | $dsn = "sqlsrv:Server={$host}{$port};Database={$database}";
40 | }
41 |
42 | return new PDO($dsn, $username, $password, $this->options($config));
43 | }
44 |
45 | }
--------------------------------------------------------------------------------
/laravel/session/drivers/redis.php:
--------------------------------------------------------------------------------
1 | redis = $redis;
21 | }
22 |
23 | /**
24 | * Load a session from storage by a given ID.
25 | *
26 | * If no session is found for the ID, null will be returned.
27 | *
28 | * @param string $id
29 | * @return array
30 | */
31 | public function load($id)
32 | {
33 | return $this->redis->get($id);
34 | }
35 |
36 | /**
37 | * Save a given session to storage.
38 | *
39 | * @param array $session
40 | * @param array $config
41 | * @param bool $exists
42 | * @return void
43 | */
44 | public function save($session, $config, $exists)
45 | {
46 | $this->redis->put($session['id'], $session, $config['lifetime']);
47 | }
48 |
49 | /**
50 | * Delete a session from storage by a given ID.
51 | *
52 | * @param string $id
53 | * @return void
54 | */
55 | public function delete($id)
56 | {
57 | $this->redis->forget($id);
58 | }
59 |
60 | }
--------------------------------------------------------------------------------
/application/views/admin/_editor.blade.php:
--------------------------------------------------------------------------------
1 | {{ HTML::style('js/tinyeditor/tinyeditor.css') }}
2 | {{ HTML::script('js/tinyeditor/tiny.editor.packed.js') }}
3 |
4 |
--------------------------------------------------------------------------------
/laravel/cli/tasks/key.php:
--------------------------------------------------------------------------------
1 | path = path('app').'config/application'.EXT;
23 | }
24 |
25 | /**
26 | * Generate a random key for the application.
27 | *
28 | * @param array $arguments
29 | * @return void
30 | */
31 | public function generate($arguments = array())
32 | {
33 | // By default the Crypter class uses AES-256 encryption which uses
34 | // a 32 byte input vector, so that is the length of string we will
35 | // generate for the application token unless another length is
36 | // specified through the CLI.
37 | $key = Str::random(array_get($arguments, 0, 32));
38 |
39 | $config = File::get($this->path);
40 |
41 | $config = str_replace("'key' => '',", "'key' => '{$key}',", $config, $count);
42 |
43 | File::put($this->path, $config);
44 |
45 | if ($count > 0)
46 | {
47 | echo "Configuration updated with secure key!";
48 | }
49 | else
50 | {
51 | echo "An application key already exists!";
52 | }
53 |
54 | echo PHP_EOL;
55 | }
56 |
57 | }
--------------------------------------------------------------------------------
/application/views/admin/add_pdf.blade.php:
--------------------------------------------------------------------------------
1 | @layout('base')
2 |
3 | @section('page_title')
4 | Add a PDF
5 | @endsection
6 |
7 | @section('content')
8 |
9 | @if (Session::has('success'))
10 |
The PDF has been added!
11 | @endif
12 |
13 |
Add a PDF
14 |
15 | {{ Form::open_for_files('add_pdf') }}
16 |
17 |
37 | {{ Form::close() }}
38 |
39 | @endsection
--------------------------------------------------------------------------------
/laravel/tests/application/controllers/home.php:
--------------------------------------------------------------------------------
1 |
7 | *
8 | * For the full copyright and license information, please view the LICENSE
9 | * file that was distributed with this source code.
10 | */
11 |
12 | namespace Symfony\Component\HttpFoundation;
13 |
14 | /**
15 | * Request represents an HTTP request from an Apache server.
16 | *
17 | * @author Fabien Potencier
18 | */
19 | class ApacheRequest extends Request
20 | {
21 | /**
22 | * {@inheritdoc}
23 | */
24 | protected function prepareRequestUri()
25 | {
26 | return $this->server->get('REQUEST_URI');
27 | }
28 |
29 | /**
30 | * {@inheritdoc}
31 | */
32 | protected function prepareBaseUrl()
33 | {
34 | $baseUrl = $this->server->get('SCRIPT_NAME');
35 |
36 | if (false === strpos($this->server->get('REQUEST_URI'), $baseUrl)) {
37 | // assume mod_rewrite
38 | return rtrim(dirname($baseUrl), '/\\');
39 | }
40 |
41 | return $baseUrl;
42 | }
43 |
44 | /**
45 | * {@inheritdoc}
46 | */
47 | protected function preparePathInfo()
48 | {
49 | return $this->server->get('PATH_INFO') ?: substr($this->prepareRequestUri(), strlen($this->prepareBaseUrl())) ?: '/';
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/laravel/hash.php:
--------------------------------------------------------------------------------
1 |
9 | * // Create a Bcrypt hash of a value
10 | * $hash = Hash::make('secret');
11 | *
12 | * // Use a specified number of iterations when creating the hash
13 | * $hash = Hash::make('secret', 12);
14 | *
15 | *
16 | * @param string $value
17 | * @param int $rounds
18 | * @return string
19 | */
20 | public static function make($value, $rounds = 8)
21 | {
22 | $work = str_pad($rounds, 2, '0', STR_PAD_LEFT);
23 |
24 | // Bcrypt expects the salt to be 22 base64 encoded characters including
25 | // dots and slashes. We will get rid of the plus signs included in the
26 | // base64 data and replace them with dots.
27 | if (function_exists('openssl_random_pseudo_bytes'))
28 | {
29 | $salt = openssl_random_pseudo_bytes(16);
30 | }
31 | else
32 | {
33 | $salt = Str::random(40);
34 | }
35 |
36 | $salt = substr(strtr(base64_encode($salt), '+', '.'), 0 , 22);
37 |
38 | return crypt($value, '$2a$'.$work.'$'.$salt);
39 | }
40 |
41 | /**
42 | * Determine if an unhashed value matches a Bcrypt hash.
43 | *
44 | * @param string $value
45 | * @param string $hash
46 | * @return bool
47 | */
48 | public static function check($value, $hash)
49 | {
50 | return crypt($value, $hash) === $hash;
51 | }
52 |
53 | }
--------------------------------------------------------------------------------
/laravel/session/drivers/memcached.php:
--------------------------------------------------------------------------------
1 | memcached = $memcached;
21 | }
22 |
23 | /**
24 | * Load a session from storage by a given ID.
25 | *
26 | * If no session is found for the ID, null will be returned.
27 | *
28 | * @param string $id
29 | * @return array
30 | */
31 | public function load($id)
32 | {
33 | return $this->memcached->get($id);
34 | }
35 |
36 | /**
37 | * Save a given session to storage.
38 | *
39 | * @param array $session
40 | * @param array $config
41 | * @param bool $exists
42 | * @return void
43 | */
44 | public function save($session, $config, $exists)
45 | {
46 | $this->memcached->put($session['id'], $session, $config['lifetime']);
47 | }
48 |
49 | /**
50 | * Delete a session from storage by a given ID.
51 | *
52 | * @param string $id
53 | * @return void
54 | */
55 | public function delete($id)
56 | {
57 | $this->memcached->forget($id);
58 | }
59 |
60 | }
--------------------------------------------------------------------------------
/laravel/cli/tasks/route.php:
--------------------------------------------------------------------------------
1 | route();
30 |
31 | echo PHP_EOL;
32 | }
33 |
34 | /**
35 | * Dump the results of the currently established route.
36 | *
37 | * @return void
38 | */
39 | protected function route()
40 | {
41 | // We'll call the router using the method and URI specified by
42 | // the developer on the CLI. If a route is found, we will not
43 | // run the filters, but simply dump the result.
44 | $route = Router::route(Request::method(), $_SERVER['REQUEST_URI']);
45 |
46 | if ( ! is_null($route))
47 | {
48 | var_dump($route->response());
49 | }
50 | else
51 | {
52 | echo '404: Not Found';
53 | }
54 | }
55 |
56 | }
57 |
--------------------------------------------------------------------------------
/application/models/favorite.php:
--------------------------------------------------------------------------------
1 | Auth::user()->id,
15 | 'page_id' => $page_id));
16 | }
17 | catch (Exception $e) {}
18 | }
19 | }
20 |
21 | public static function remove($page_id)
22 | {
23 | if (Page::find($page_id))
24 | {
25 | return self::where_user_id(Auth::user()->id)
26 | ->where_page_id($page_id)
27 | ->delete();
28 | }
29 | }
30 |
31 | public static function is_favorite($page_id)
32 | {
33 | return (bool) self::where_user_id(Auth::user()->id)
34 | ->where_page_id($page_id)
35 | ->count();
36 | }
37 |
38 | public static function all()
39 | {
40 | return DB::table('pages')
41 | ->join('favorite_pages', 'favorite_pages.page_id', '=', 'pages.id')
42 | ->where('favorite_pages.user_id', '=', Auth::user()->id)
43 | ->order_by('title')
44 | ->get(array('id', 'title', 'description'));
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/laravel/database/query/join.php:
--------------------------------------------------------------------------------
1 | type = $type;
36 | $this->table = $table;
37 | }
38 |
39 | /**
40 | * Add an ON clause to the join.
41 | *
42 | * @param string $column1
43 | * @param string $operator
44 | * @param string $column2
45 | * @param string $connector
46 | * @return Join
47 | */
48 | public function on($column1, $operator, $column2, $connector = 'AND')
49 | {
50 | $this->clauses[] = compact('column1', 'operator', 'column2', 'connector');
51 |
52 | return $this;
53 | }
54 |
55 | /**
56 | * Add an OR ON clause to the join.
57 | *
58 | * @param string $column1
59 | * @param string $operator
60 | * @param string $column2
61 | * @return Join
62 | */
63 | public function or_on($column1, $operator, $column2)
64 | {
65 | return $this->on($column1, $operator, $column2, 'OR');
66 | }
67 |
68 | }
--------------------------------------------------------------------------------
/laravel/cli/tasks/bundle/publisher.php:
--------------------------------------------------------------------------------
1 | move($path.'public', path('public').'bundles'.DS.$bundle);
27 |
28 | echo "Assets published for bundle [$bundle].".PHP_EOL;
29 | }
30 |
31 | /**
32 | * Copy the contents of a bundle's assets to the public folder.
33 | *
34 | * @param string $source
35 | * @param string $destination
36 | * @return void
37 | */
38 | protected function move($source, $destination)
39 | {
40 | File::cpdir($source, $destination);
41 | }
42 |
43 | /**
44 | * Get the "to" location of the bundle's assets.
45 | *
46 | * @param string $bundle
47 | * @return string
48 | */
49 | protected function to($bundle)
50 | {
51 | return path('public').'bundles'.DS.$bundle.DS;
52 | }
53 |
54 | /**
55 | * Get the "from" location of the bundle's assets.
56 | *
57 | * @param string $bundle
58 | * @return string
59 | */
60 | protected function from($bundle)
61 | {
62 | return Bundle::path($bundle).'public';
63 | }
64 |
65 | }
--------------------------------------------------------------------------------
/application/bundles.php:
--------------------------------------------------------------------------------
1 | array(
22 | | 'location' => 'admin',
23 | | 'handles' => 'admin',
24 | | ),
25 | |
26 | | Note that the "location" is relative to the "bundles" directory.
27 | | Now the bundle will be recognized by Laravel and will be able
28 | | to respond to requests beginning with "admin"!
29 | |
30 | | Have a bundle that lives in the root of the bundle directory
31 | | and doesn't respond to any requests? Just add the bundle
32 | | name to the array and we'll take care of the rest.
33 | |
34 | */
35 |
36 | return array(
37 |
38 | 'docs' => array('handles' => 'docs'),
39 |
40 | );
--------------------------------------------------------------------------------
/laravel/tests/application/bundles.php:
--------------------------------------------------------------------------------
1 | array(
22 | | 'location' => 'admin',
23 | | 'handles' => 'admin',
24 | | ),
25 | |
26 | | Note that the "location" is relative to the "bundles" directory.
27 | | Now the bundle will be recognized by Laravel and will be able
28 | | to respond to requests beginning with "admin"!
29 | |
30 | | Have a bundle that lives in the root of the bundle directory
31 | | and doesn't respond to any requests? Just add the bundle
32 | | name to the array and we'll take care of the rest.
33 | |
34 | */
35 |
36 | return array('dashboard' => array('handles' => 'dashboard'), 'dummy');
--------------------------------------------------------------------------------
/laravel/vendor/Symfony/Component/HttpFoundation/JsonResponse.php:
--------------------------------------------------------------------------------
1 |
7 | *
8 | * For the full copyright and license information, please view the LICENSE
9 | * file that was distributed with this source code.
10 | */
11 |
12 | namespace Symfony\Component\HttpFoundation;
13 |
14 | /**
15 | * Response represents an HTTP response in JSON format.
16 | *
17 | * @author Igor Wiedler
18 | */
19 | class JsonResponse extends Response
20 | {
21 | /**
22 | * Constructor.
23 | *
24 | * @param mixed $data The response data
25 | * @param integer $status The response status code
26 | * @param array $headers An array of response headers
27 | */
28 | public function __construct($data = array(), $status = 200, $headers = array())
29 | {
30 | // root should be JSON object, not array
31 | if (is_array($data) && 0 === count($data)) {
32 | $data = new \ArrayObject();
33 | }
34 |
35 | parent::__construct(
36 | json_encode($data),
37 | $status,
38 | array_merge(array('Content-Type' => 'application/json'), $headers)
39 | );
40 | }
41 |
42 | /**
43 | * {@inheritDoc}
44 | */
45 | static public function create($data = array(), $status = 200, $headers = array())
46 | {
47 | return new static($data, $status, $headers);
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/laravel/database/connectors/mysql.php:
--------------------------------------------------------------------------------
1 | options($config));
34 |
35 | // If a character set has been specified, we'll execute a query against
36 | // the database to set the correct character set. By default, this is
37 | // set to UTF-8 which should be fine for most scenarios.
38 | if (isset($config['charset']))
39 | {
40 | $connection->prepare("SET NAMES '{$config['charset']}'")->execute();
41 | }
42 |
43 | return $connection;
44 | }
45 |
46 | }
--------------------------------------------------------------------------------
/laravel/vendor/Symfony/Component/HttpFoundation/README.md:
--------------------------------------------------------------------------------
1 | HttpFoundation Component
2 | ========================
3 |
4 | HttpFoundation defines an object-oriented layer for the HTTP specification.
5 |
6 | It provides an abstraction for requests, responses, uploaded files, cookies,
7 | sessions, ...
8 |
9 | In this example, we get a Request object from the current PHP global
10 | variables:
11 |
12 | use Symfony\Component\HttpFoundation\Request;
13 | use Symfony\Component\HttpFoundation\Response;
14 |
15 | $request = Request::createFromGlobals();
16 | echo $request->getPathInfo();
17 |
18 | You can also create a Request directly -- that's interesting for unit testing:
19 |
20 | $request = Request::create('/?foo=bar', 'GET');
21 | echo $request->getPathInfo();
22 |
23 | And here is how to create and send a Response:
24 |
25 | $response = new Response('Not Found', 404, array('Content-Type' => 'text/plain'));
26 | $response->send();
27 |
28 | The Request and the Response classes have many other methods that implement
29 | the HTTP specification.
30 |
31 | Loading
32 | -------
33 |
34 | If you are using PHP 5.3.x you must add the following to your autoloader:
35 |
36 | // SessionHandlerInterface
37 | if (!interface_exists('SessionHandlerInterface')) {
38 | $loader->registerPrefixFallback(__DIR__.'/../vendor/symfony/src/Symfony/Component/HttpFoundation/Resources/stubs');
39 | }
40 |
41 |
42 | Resources
43 | ---------
44 |
45 | Unit tests:
46 |
47 | https://github.com/symfony/symfony/tree/master/tests/Symfony/Tests/Component/HttpFoundation
48 |
--------------------------------------------------------------------------------
/laravel/cli/artisan.php:
--------------------------------------------------------------------------------
1 | getMessage();
47 | }
48 |
49 | echo PHP_EOL;
--------------------------------------------------------------------------------
/laravel/vendor/Symfony/Component/HttpFoundation/Session/Storage/Handler/NullSessionHandler.php:
--------------------------------------------------------------------------------
1 |
7 | *
8 | * For the full copyright and license information, please view the LICENSE
9 | * file that was distributed with this source code.
10 | */
11 |
12 | namespace Symfony\Component\HttpFoundation\Session\Storage\Handler;
13 |
14 | /**
15 | * NullSessionHandler.
16 | *
17 | * Can be used in unit testing or in a sitation where persisted sessions are not desired.
18 | *
19 | * @author Drak
20 | *
21 | * @api
22 | */
23 | class NullSessionHandler implements \SessionHandlerInterface
24 | {
25 | /**
26 | * {@inheritdoc}
27 | */
28 | public function open($savePath, $sessionName)
29 | {
30 | return true;
31 | }
32 |
33 | /**
34 | * {@inheritdoc}
35 | */
36 | public function close()
37 | {
38 | return true;
39 | }
40 |
41 | /**
42 | * {@inheritdoc}
43 | */
44 | public function read($sessionId)
45 | {
46 | return '';
47 | }
48 |
49 | /**
50 | * {@inheritdoc}
51 | */
52 | public function write($sessionId, $data)
53 | {
54 | return true;
55 | }
56 |
57 | /**
58 | * {@inheritdoc}
59 | */
60 | public function destroy($sessionId)
61 | {
62 | return true;
63 | }
64 |
65 | /**
66 | * {@inheritdoc}
67 | */
68 | public function gc($lifetime)
69 | {
70 | return true;
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/application/models/user.php:
--------------------------------------------------------------------------------
1 | $form['first_name'],
12 | 'last_name' => $form['last_name'],
13 | 'username' => $form['username'],
14 | 'email' => $form['email'],
15 | 'pass' => Hash::make($form['password']),
16 | 'date_expires' => DB::Raw('ADDDATE(NOW(), INTERVAL 1 MONTH)'),
17 | ));
18 | }
19 |
20 | public static function password_update($password, $user=NULL)
21 | {
22 | if ($user OR $user = self::find(Auth::user()->id))
23 | {
24 | $user->pass = Hash::make($password);
25 | return $user->save();
26 | }
27 | }
28 |
29 | public static function new_password($email)
30 | {
31 | $new_password = substr(md5(uniqid(rand(), TRUE)), 10, 15);
32 | $user = self::where_email($email)->first();
33 | if (self::password_update($new_password, $user))
34 | {
35 | return $new_password;
36 | }
37 | }
38 | public static function renew()
39 | {
40 | $user = self::find(Auth::user()->id);
41 | $user->date_expires = DB::Raw('ADDDATE(NOW(), INTERVAL 1 MONTH)');
42 | return $user->save();
43 | }
44 |
45 | public static function is_expired()
46 | {
47 | return time() > strtotime(Auth::user()->date_expires);
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/laravel/vendor/Symfony/Component/HttpFoundation/ServerBag.php:
--------------------------------------------------------------------------------
1 |
7 | *
8 | * For the full copyright and license information, please view the LICENSE
9 | * file that was distributed with this source code.
10 | */
11 |
12 | namespace Symfony\Component\HttpFoundation;
13 |
14 | /**
15 | * ServerBag is a container for HTTP headers from the $_SERVER variable.
16 | *
17 | * @author Fabien Potencier
18 | * @author Bulat Shakirzyanov
19 | */
20 | class ServerBag extends ParameterBag
21 | {
22 | /**
23 | * Gets the HTTP headers.
24 | *
25 | * @return string
26 | */
27 | public function getHeaders()
28 | {
29 | $headers = array();
30 | foreach ($this->parameters as $key => $value) {
31 | if (0 === strpos($key, 'HTTP_')) {
32 | $headers[substr($key, 5)] = $value;
33 | }
34 | // CONTENT_* are not prefixed with HTTP_
35 | elseif (in_array($key, array('CONTENT_LENGTH', 'CONTENT_MD5', 'CONTENT_TYPE'))) {
36 | $headers[$key] = $this->parameters[$key];
37 | }
38 | }
39 |
40 | // PHP_AUTH_USER/PHP_AUTH_PW
41 | if (isset($this->parameters['PHP_AUTH_USER'])) {
42 | $pass = isset($this->parameters['PHP_AUTH_PW']) ? $this->parameters['PHP_AUTH_PW'] : '';
43 | $headers['AUTHORIZATION'] = 'Basic '.base64_encode($this->parameters['PHP_AUTH_USER'].':'.$pass);
44 | }
45 |
46 | return $headers;
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/laravel/tests/cases/ioc.test.php:
--------------------------------------------------------------------------------
1 | assertEquals('Taylor', IoC::resolve('foo'));
18 | }
19 |
20 | /**
21 | * Test that singletons are created once.
22 | *
23 | * @group laravel
24 | */
25 | public function testSingletonsAreCreatedOnce()
26 | {
27 | IoC::singleton('foo', function()
28 | {
29 | return new StdClass;
30 | });
31 |
32 | $object = IoC::resolve('foo');
33 |
34 | $this->assertTrue($object === IoC::resolve('foo'));
35 | }
36 |
37 | /**
38 | * Test the IoC::instance method.
39 | *
40 | * @group laravel
41 | */
42 | public function testInstancesAreReturnedBySingleton()
43 | {
44 | $object = new StdClass;
45 |
46 | IoC::instance('bar', $object);
47 |
48 | $this->assertTrue($object === IoC::resolve('bar'));
49 | }
50 |
51 | /**
52 | * Test the IoC::registered method.
53 | */
54 | public function testRegisteredMethodIndicatesIfRegistered()
55 | {
56 | IoC::register('foo', function() {});
57 |
58 | $this->assertTrue(IoC::registered('foo'));
59 | $this->assertFalse(IoC::registered('baz'));
60 | }
61 |
62 | /**
63 | * Test the IoC::controller method.
64 | *
65 | * @group laravel
66 | */
67 | public function testControllerMethodRegistersAController()
68 | {
69 | IoC::register('controller: ioc.test', function() {});
70 |
71 | $this->assertTrue(IoC::registered('controller: ioc.test'));
72 | }
73 |
74 | }
--------------------------------------------------------------------------------
/laravel/database/connectors/postgres.php:
--------------------------------------------------------------------------------
1 | PDO::CASE_LOWER,
12 | PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
13 | PDO::ATTR_ORACLE_NULLS => PDO::NULL_NATURAL,
14 | PDO::ATTR_STRINGIFY_FETCHES => false,
15 | );
16 |
17 | /**
18 | * Establish a PDO database connection.
19 | *
20 | * @param array $config
21 | * @return PDO
22 | */
23 | public function connect($config)
24 | {
25 | extract($config);
26 |
27 | $dsn = "pgsql:host={$host};dbname={$database}";
28 |
29 | // The developer has the freedom of specifying a port for the PostgresSQL
30 | // database or the default port (5432) will be used by PDO to create the
31 | // connection to the database for the developer.
32 | if (isset($config['port']))
33 | {
34 | $dsn .= ";port={$config['port']}";
35 | }
36 |
37 | $connection = new PDO($dsn, $username, $password, $this->options($config));
38 |
39 | // If a character set has been specified, we'll execute a query against
40 | // the database to set the correct character set. By default, this is
41 | // set to UTF-8 which should be fine for most scenarios.
42 | if (isset($config['charset']))
43 | {
44 | $connection->prepare("SET NAMES '{$config['charset']}'")->execute();
45 | }
46 |
47 | // If a schema has been specified, we'll execute a query against
48 | // the database to set the search path.
49 | if (isset($config['schema']))
50 | {
51 | $connection->prepare("SET search_path TO '{$config['schema']}'")->execute();
52 | }
53 |
54 | return $connection;
55 | }
56 |
57 | }
--------------------------------------------------------------------------------
/laravel/database/eloquent/relationships/has_one_or_many.php:
--------------------------------------------------------------------------------
1 | set_attribute($this->foreign_key(), $this->base->get_key());
20 |
21 | return $attributes->save() ? $attributes : false;
22 | }
23 | else
24 | {
25 | $attributes[$this->foreign_key()] = $this->base->get_key();
26 |
27 | return $this->model->create($attributes);
28 | }
29 | }
30 |
31 | /**
32 | * Update a record for the association.
33 | *
34 | * @param array $attributes
35 | * @return bool
36 | */
37 | public function update(array $attributes)
38 | {
39 | if ($this->model->timestamps())
40 | {
41 | $attributes['updated_at'] = new \DateTime;
42 | }
43 |
44 | return $this->table->update($attributes);
45 | }
46 |
47 | /**
48 | * Set the proper constraints on the relationship table.
49 | *
50 | * @return void
51 | */
52 | protected function constrain()
53 | {
54 | $this->table->where($this->foreign_key(), '=', $this->base->get_key());
55 | }
56 |
57 | /**
58 | * Set the proper constraints on the relationship table for an eager load.
59 | *
60 | * @param array $results
61 | * @return void
62 | */
63 | public function eagerly_constrain($results)
64 | {
65 | $this->table->where_in($this->foreign_key(), $this->keys($results));
66 | }
67 |
68 | }
--------------------------------------------------------------------------------
/laravel/vendor/Symfony/Component/Console/README.md:
--------------------------------------------------------------------------------
1 | Console Component
2 | =================
3 |
4 | Console eases the creation of beautiful and testable command line interfaces.
5 |
6 | The Application object manages the CLI application:
7 |
8 | use Symfony\Component\Console\Application;
9 |
10 | $console = new Application();
11 | $console->run();
12 |
13 | The ``run()`` method parses the arguments and options passed on the command
14 | line and executes the right command.
15 |
16 | Registering a new command can easily be done via the ``register()`` method,
17 | which returns a ``Command`` instance:
18 |
19 | use Symfony\Component\Console\Input\InputInterface;
20 | use Symfony\Component\Console\Input\InputArgument;
21 | use Symfony\Component\Console\Input\InputOption;
22 | use Symfony\Component\Console\Output\OutputInterface;
23 |
24 | $console
25 | ->register('ls')
26 | ->setDefinition(array(
27 | new InputArgument('dir', InputArgument::REQUIRED, 'Directory name'),
28 | ))
29 | ->setDescription('Displays the files in the given directory')
30 | ->setCode(function (InputInterface $input, OutputInterface $output) {
31 | $dir = $input->getArgument('dir');
32 |
33 | $output->writeln(sprintf('Dir listing for %s', $dir));
34 | })
35 | ;
36 |
37 | You can also register new commands via classes.
38 |
39 | The component provides a lot of features like output coloring, input and
40 | output abstractions (so that you can easily unit-test your commands),
41 | validation, automatic help messages, ...
42 |
43 | Resources
44 | ---------
45 |
46 | Unit tests:
47 |
48 | https://github.com/symfony/symfony/tree/master/tests/Symfony/Tests/Component/Console
49 |
--------------------------------------------------------------------------------
/laravel/vendor/Symfony/Component/HttpFoundation/File/MimeType/FileinfoMimeTypeGuesser.php:
--------------------------------------------------------------------------------
1 |
7 | *
8 | * For the full copyright and license information, please view the LICENSE
9 | * file that was distributed with this source code.
10 | */
11 |
12 | namespace Symfony\Component\HttpFoundation\File\MimeType;
13 |
14 | use Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException;
15 | use Symfony\Component\HttpFoundation\File\Exception\AccessDeniedException;
16 |
17 | /**
18 | * Guesses the mime type using the PECL extension FileInfo
19 | *
20 | * @author Bernhard Schussek
21 | */
22 | class FileinfoMimeTypeGuesser implements MimeTypeGuesserInterface
23 | {
24 | /**
25 | * Returns whether this guesser is supported on the current OS/PHP setup
26 | *
27 | * @return Boolean
28 | */
29 | static public function isSupported()
30 | {
31 | return function_exists('finfo_open');
32 | }
33 |
34 | /**
35 | * Guesses the mime type of the file with the given path
36 | *
37 | * @see MimeTypeGuesserInterface::guess()
38 | */
39 | public function guess($path)
40 | {
41 | if (!is_file($path)) {
42 | throw new FileNotFoundException($path);
43 | }
44 |
45 | if (!is_readable($path)) {
46 | throw new AccessDeniedException($path);
47 | }
48 |
49 | if (!self::isSupported()) {
50 | return null;
51 | }
52 |
53 | if (!$finfo = new \finfo(FILEINFO_MIME_TYPE)) {
54 | return null;
55 | }
56 |
57 | return $finfo->file($path);
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/laravel/vendor/Symfony/Component/Console/Formatter/OutputFormatterStyleInterface.php:
--------------------------------------------------------------------------------
1 |
7 | *
8 | * For the full copyright and license information, please view the LICENSE
9 | * file that was distributed with this source code.
10 | */
11 |
12 | namespace Symfony\Component\Console\Formatter;
13 |
14 | /**
15 | * Formatter style interface for defining styles.
16 | *
17 | * @author Konstantin Kudryashov
18 | *
19 | * @api
20 | */
21 | interface OutputFormatterStyleInterface
22 | {
23 | /**
24 | * Sets style foreground color.
25 | *
26 | * @param string $color color name
27 | *
28 | * @api
29 | */
30 | function setForeground($color = null);
31 |
32 | /**
33 | * Sets style background color.
34 | *
35 | * @param string $color color name
36 | *
37 | * @api
38 | */
39 | function setBackground($color = null);
40 |
41 | /**
42 | * Sets some specific style option.
43 | *
44 | * @param string $option option name
45 | *
46 | * @api
47 | */
48 | function setOption($option);
49 |
50 | /**
51 | * Unsets some specific style option.
52 | *
53 | * @param string $option option name
54 | */
55 | function unsetOption($option);
56 |
57 | /**
58 | * Sets multiple style options at once.
59 | *
60 | * @param array $options
61 | */
62 | function setOptions(array $options);
63 |
64 | /**
65 | * Applies the style to a given text.
66 | *
67 | * @param string $text The text to style
68 | *
69 | * @return string
70 | */
71 | function apply($text);
72 | }
73 |
--------------------------------------------------------------------------------
/laravel/vendor/Symfony/Component/HttpFoundation/Session/Storage/Handler/NativeSqliteSessionHandler.php:
--------------------------------------------------------------------------------
1 |
7 | *
8 | * For the full copyright and license information, please view the LICENSE
9 | * file that was distributed with this source code.
10 | */
11 |
12 | namespace Symfony\Component\HttpFoundation\Session\Storage\Handler;
13 |
14 | /**
15 | * NativeSqliteSessionHandler.
16 | *
17 | * Driver for the sqlite session save hadlers provided by the SQLite PHP extension.
18 | *
19 | * @author Drak
20 | */
21 | class NativeSqliteSessionHandler extends NativeSessionHandler
22 | {
23 | /**
24 | * Constructor.
25 | *
26 | * @param string $savePath Path to SQLite database file itself.
27 | * @param array $options Session configuration options.
28 | */
29 | public function __construct($savePath, array $options = array())
30 | {
31 | if (!extension_loaded('sqlite')) {
32 | throw new \RuntimeException('PHP does not have "sqlite" session module registered');
33 | }
34 |
35 | if (null === $savePath) {
36 | $savePath = ini_get('session.save_path');
37 | }
38 |
39 | ini_set('session.save_handler', 'sqlite');
40 | ini_set('session.save_path', $savePath);
41 |
42 | $this->setOptions($options);
43 | }
44 |
45 | /**
46 | * Set any sqlite ini values.
47 | *
48 | * @see http://php.net/sqlite.configuration
49 | */
50 | protected function setOptions(array $options)
51 | {
52 | foreach ($options as $key => $value) {
53 | if (in_array($key, array('sqlite.assoc_case'))) {
54 | ini_set($key, $value);
55 | }
56 | }
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/laravel/tests/cases/uri.test.php:
--------------------------------------------------------------------------------
1 | setRequestUri($uri);
41 |
42 | $this->assertEquals($expectation, URI::current());
43 | }
44 |
45 | /**
46 | * Test the URI::segment method.
47 | *
48 | * @group laravel
49 | */
50 | public function testSegmentMethodReturnsAURISegment()
51 | {
52 | $this->setRequestUri('/user/profile');
53 |
54 | $this->assertEquals('user', URI::segment(1));
55 | $this->assertEquals('profile', URI::segment(2));
56 | }
57 |
58 | /**
59 | * Data provider for the URI::current test.
60 | */
61 | public function requestUriProvider()
62 | {
63 | return array(
64 | array('/user', 'user'),
65 | array('/user/', 'user'),
66 | array('', '/'),
67 | array('/', '/'),
68 | array('//', '/'),
69 | array('/user', 'user'),
70 | array('/user/', 'user'),
71 | array('/user/profile', 'user/profile'),
72 | );
73 | }
74 |
75 | }
--------------------------------------------------------------------------------
/laravel/vendor/Symfony/Component/HttpFoundation/Session/Attribute/AttributeBagInterface.php:
--------------------------------------------------------------------------------
1 |
7 | *
8 | * For the full copyright and license information, please view the LICENSE
9 | * file that was distributed with this source code.
10 | */
11 |
12 | namespace Symfony\Component\HttpFoundation\Session\Attribute;
13 |
14 | use Symfony\Component\HttpFoundation\Session\SessionBagInterface;
15 |
16 | /**
17 | * Attributes store.
18 | *
19 | * @author Drak
20 | */
21 | interface AttributeBagInterface extends SessionBagInterface
22 | {
23 | /**
24 | * Checks if an attribute is defined.
25 | *
26 | * @param string $name The attribute name
27 | *
28 | * @return Boolean true if the attribute is defined, false otherwise
29 | */
30 | function has($name);
31 |
32 | /**
33 | * Returns an attribute.
34 | *
35 | * @param string $name The attribute name
36 | * @param mixed $default The default value if not found.
37 | *
38 | * @return mixed
39 | */
40 | function get($name, $default = null);
41 |
42 | /**
43 | * Sets an attribute.
44 | *
45 | * @param string $name
46 | * @param mixed $value
47 | */
48 | function set($name, $value);
49 |
50 | /**
51 | * Returns attributes.
52 | *
53 | * @return array Attributes
54 | */
55 | function all();
56 |
57 | /**
58 | * Sets attributes.
59 | *
60 | * @param array $attributes Attributes
61 | */
62 | function replace(array $attributes);
63 |
64 | /**
65 | * Removes an attribute.
66 | *
67 | * @param string $name
68 | *
69 | * @return mixed The removed value
70 | */
71 | function remove($name);
72 | }
73 |
--------------------------------------------------------------------------------
/laravel/documentation/database/raw.md:
--------------------------------------------------------------------------------
1 | # Raw Queries
2 |
3 | ## Contents
4 |
5 | - [The Basics](#the-basics)
6 | - [Other Query Methods](#other-query-methods)
7 | - [PDO Connections](#pdo-connections)
8 |
9 |
10 | ## The Basics
11 |
12 | The **query** method is used to execute arbitrary, raw SQL against your database connection.
13 |
14 | #### Selecting records from the database:
15 |
16 | $users = DB::query('select * from users');
17 |
18 | #### Selecting records from the database using bindings:
19 |
20 | $users = DB::query('select * from users where name = ?', array('test'));
21 |
22 | #### Inserting a record into the database
23 |
24 | $success = DB::query('insert into users values (?, ?)', $bindings);
25 |
26 | #### Updating table records and getting the number of affected rows:
27 |
28 | $affected = DB::query('update users set name = ?', $bindings);
29 |
30 | #### Deleting from a table and getting the number of affected rows:
31 |
32 | $affected = DB::query('delete from users where id = ?', array(1));
33 |
34 |
35 | ## Other Query Methods
36 |
37 | Laravel provides a few other methods to make querying your database simple. Here's an overview:
38 |
39 | #### Running a SELECT query and returning the first result:
40 |
41 | $user = DB::first('select * from users where id = 1');
42 |
43 | #### Running a SELECT query and getting the value of a single column:
44 |
45 | $email = DB::only('select email from users where id = 1');
46 |
47 |
48 | ## PDO Connections
49 |
50 | Sometimes you may wish to access the raw PDO connection behind the Laravel Connection object.
51 |
52 | #### Get the raw PDO connection for a database:
53 |
54 | $pdo = DB::connection('sqlite')->pdo;
55 |
56 | > **Note:** If no connection name is specified, the **default** connection will be returned.
--------------------------------------------------------------------------------
/application/views/content/page.blade.php:
--------------------------------------------------------------------------------
1 | @layout('base')
2 |
3 | @section('page_title')
4 | {{ $page->title }}
5 | @endsection
6 |
7 | @section('content')
8 |
9 |
{{ $page->title }}
10 |
11 | @if (Auth::guest())
12 |
Thank you for your interest in this content. You must be a logged in as a registered user to view this page in its entirety.
13 |
14 | {{ $page->description }}
15 |
16 | @else
17 | @if (User::is_expired())
18 |
Thank you for your interest in this content, but your account is no longer current. Please {{ HTML::link('renew', 'renew your account') }} in order to view this page in its entirety
28 | @if (Session::has('added'))
29 | {{ $heart }}This has been added to your favorites!{{ d(HTML::link("remove_from_favorites/$page->id", $cross)) }}
30 | @elseif (Session::has('removed'))
31 | This page has been removed from your favorites!{{ $cross }}
32 | @elseif (Favorite::is_favorite($page->id))
33 | {{ $heart }}This is a favorite!{{ d(HTML::link("remove_from_favorites/$page->id", $cross)) }}
34 | @else
35 | Make this a favorite!{{ d(HTML::link("add_to_favorites/$page->id", $heart)) }}
36 | @endif
37 |