diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..eb612d7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +# Eclipse project +.buildpath +.project +.settings diff --git a/code/auth_mysql.php b/code/auth_mysql.php deleted file mode 100644 index cf671db..0000000 --- a/code/auth_mysql.php +++ /dev/null @@ -1,38 +0,0 @@ - diff --git a/code/config.php.dist b/code/config.php.dist deleted file mode 100644 index 4993ec1..0000000 --- a/code/config.php.dist +++ /dev/null @@ -1,103 +0,0 @@ - get_web_base_dir(), - 'script-dir' => get_fs_base_dir(), - 'error-code' => 403, - 'error-message' => 'Unknown Error'); - // Placeholder for template fragments - $_template = array( 'messages' => array(), - 'redirect-to' => false, - 'head' => '', - 'title' => 'Default', - 'page' => ''); - // Forward declarations - $_session = null; - - // Templating - $_config['template-file'] = "{$_meta['script-dir']}/templates/default.php"; - - // Homepage - $_config['homepage'] = "{$_meta['script-dir']}/page-sources/home.php"; - - // Sessions - // How long a logged in session will last without activity from the user - $_config['session-login-timeout'] = 60*60*1; // One hour - // How long the username will be stoed in the users cookie - $_config['session-username-timeout'] = 60*60*24*7; // Seven days - - // See session-handler.php for reasons behind the session-network-* config variables - // session-network-mask is used to determine how much of the users IP is hashed into the salt - $_config['session-network-mask'] = 24; - // session-network-mode defines whether the above parameter was passed as a CIDR form, or dotted decimal form - $_config['session-network-mode'] = MASK_CIDR; - - // Maximum number of items to keep in the users session history - $_config['max-history'] = 5; - - // Account Lockout - // How many incorrect authentication attempts before the user is locked out - $_config['lockout-attempts'] = 3; - // How long the account lockout period lasts. During this time, the user will not - // be able to authenticate, even witha valid passwords - $_config['lockout-duration'] = 60*10; // Ten minutes - - - // Authantication - require_once( "{$_meta['script-dir']}/code/iauthenticator.php" ); - $_config['authentication-module'] = 'mysql'; - - // Database - // Mysql connections parameters - $_config['db'] = null; - $_config['mysql'] = array(); - $_config['mysql']['host'] = 'localhost'; - $_config['mysql']['port'] = 3306; - $_config['mysql']['username'] = ''; - $_config['mysql']['password'] = ''; - $_config['mysql']['database'] = ''; - - // Database tables - $_config['mysql']['prefix'] = ''; - - // Connecting to the database - $_db = null; - require_once( "{$_meta['script-dir']}/code/db_mysql.php" ); - - // Only show php error messages if the application is in debug mode - if( isset($_GET['nodebug']) ) $_config['DEBUG'] = false; - if( !$_config['DEBUG'] ) { - set_error_handler( "null_error_handler" ); - set_exception_handler( "null_exception_handler" ); - } - - // Set the default template for all individual pages - $_template['template-file'] = $_config['template-file']; - - - -?> diff --git a/code/db_mysql.php b/code/db_mysql.php deleted file mode 100644 index 840aa53..0000000 --- a/code/db_mysql.php +++ /dev/null @@ -1,21 +0,0 @@ - diff --git a/code/exceptions.php b/code/exceptions.php deleted file mode 100644 index 264cf86..0000000 --- a/code/exceptions.php +++ /dev/null @@ -1,41 +0,0 @@ -\n"; - echo '
';print_r($this->getTrace());echo '
'; - } - } - - }; - - - class FatalException extends BaseException { - // Overridden constructor prints an error message, then terminates the application - public function __construct( $message = '', $code = 0 ) { - parent::__construct( $message, $code ); - die( 'FATAL EXCEPTION: ' . $message ); - } - }; - - - class ConfigException extends BaseException {}; - class SessionException extends BaseException {}; - class AccountLockoutException extends BaseException {}; - class AuthenticationException extends BaseException {}; - class ParameterException extends BaseException {}; - class NotImplementedException extends BaseException {}; - -?> diff --git a/code/functions.php b/code/functions.php deleted file mode 100644 index 9db521f..0000000 --- a/code/functions.php +++ /dev/null @@ -1,78 +0,0 @@ - $value ) { - $dest[$key] = $value; - } - } - - function print_rating_graph( $star_rating ) { - global $_meta; -?> - Rated: <?php echo $star_rating; ?> - diff --git a/code/iauthenticator.php b/code/iauthenticator.php deleted file mode 100644 index 7f77cfb..0000000 --- a/code/iauthenticator.php +++ /dev/null @@ -1,60 +0,0 @@ - diff --git a/code/iauthorisor.php b/code/iauthorisor.php deleted file mode 100644 index 27b7703..0000000 --- a/code/iauthorisor.php +++ /dev/null @@ -1,58 +0,0 @@ - diff --git a/code/request_handler.php b/code/request_handler.php deleted file mode 100644 index 6885618..0000000 --- a/code/request_handler.php +++ /dev/null @@ -1,71 +0,0 @@ -request_string = $request_string; - $this->cache = array(); - } - - public function current_page() { - return $this->request_string; - } - - public function get( $key, $value_pattern = '[^/]*' ) { - // Look in the cache to see if weve already decoded this variable - if( in_array( $key, $this->cache ) ) return $this->cache[ $key ]; - - // Construct the regex to search for /$key/$value/ pairs, and return the $value part - $key = str_replace('£', '\£', $key); - $value_pattern = str_replace('£', '\£', $value_pattern); - $pattern = "£/{$key}/({$value_pattern})(/|\$)£"; - - // Look to see if this variable is in the request string - $count = preg_match( $pattern, $this->request_string, $matches ); - - // See if the variable was set - if( $count == 0 ) return null; - - // Store the result for next time - $this->cache[ $key ] = $matches[1]; - - // And return it to the user - return $matches[1]; - } - - public function construct() { - global $_meta; - - // Varargsy - $args = func_get_args(); - - // Construct the proper request string for these arguments - $request_string = "{$_meta['base-dir']}/"; - $count = count( $args ); - for( $i = 0 ; $i < $count; $i++ ) { - $arg = $args[ $i ]; - // If this item is null, try to find the value of the previous key from the current - // request object as a convenience to the user. It assumes the default value pattern. - if( $arg === null && $i > 0) { - $arg = $this->get( $args[ $i -1 ] ); - } - $request_string .= urlencode($arg) . '/'; - } - - return $request_string; - } - - }; - -?> diff --git a/code/session_handler.php b/code/session_handler.php deleted file mode 100644 index 779ffa7..0000000 --- a/code/session_handler.php +++ /dev/null @@ -1,229 +0,0 @@ -start_new_session(); - } else { - // The session already exists, check its validity - if( $this->is_session_valid() ) { - - } else { - // BAD USER SESSION, start a new one - $this->start_new_session(); - // And inform the user - $_template['messages'][] = "Bad session, starting a new one"; - } - } - - // Load the Authentication modules - $this->authentication = IAuthenticatorFactory::get( $_config['authentication-module'] ); - $this->authentication->initialise(); - - } - - public function __destruct() { - // Shut down the authentication modules - $this->authentication->uninitialise(); - } - - /* - * Accessors - */ - public function authenticator() { return $this->authentication; } - - /* - * The following methods deal with the user session - */ - - // Initialises all the variables we require in each user session - public function start_new_session() { - global $_config; - - // Set up all the session variables - $_SESSION['initialised'] = true; - $_SESSION['logged_in'] = false; - $_SESSION['username'] = ''; - $_SESSION['hash'] = $this->generate_hash(); - $_SESSION['previous_page'] = $_config['homepage']; - $_SESSION['requested_page'] = ''; - $_SESSION['history'] = array('home'); - $_SESSION['lockout'] = false; - $_SESSION['lockout-attempts'] = 0; - - // Be paranoid, change session id - $this->auth_state_changed(); - } - - public function is_session_valid() { - // Check that the identifying information given by the user matches that which was - // saved in the session when it was created - return ($_SESSION['hash'] == $this->generate_hash()); - } - - /* - * This function should be called whenever the authorisation level - * changes in order to keep the session secure. - * It prevents against Session Fixation (http://www.acros.si/papers/session_fixation.pdf) - */ - public function auth_state_changed() { - session_regenerate_id(); - } - - /* - * This function marks a user as having been logged into the system - */ - private function mark_logged_in_as( $username ) { - $_SESSION['username'] = $username; - $_SESSION['logged_in'] = true; - - // The login state has changed - $this->auth_state_changed(); - } - - /* - * This function marks a user as having been logged out of the system - */ - private function mark_logged_out() { - $_SESSION['logged_in'] = false; - - // The login state has changedd - $this->auth_state_changed(); - } - - /* - * This function returns whether or not the user is logged in - */ - public function is_logged_in() { - return $_SESSION['logged_in']; - } - - /* - * This function returns the username of the currently logged in user - */ - public function username() { - return $_SESSION['username']; - } - - /* - * This function requires a user to be logged in, else an exception is thrown - */ - public function require_logged_in() { - if( !$_SESSION['logged_in'] ) throw new AuthenticationException('You must be logged on to view this resource'); - } - - /* - * This function generates a hash from user identifiable information - * to try and prevent session theft. - * If the session id is stolen by an attacker, chances are some of the - * information used to generate the hash will change, and the session - * will be immediately marked as invalid. This hash is checked for - * consistency on every request. - */ - public function generate_hash() { - global $_config; - // Hash together the following pieces of identifying information which remain constant throughout the session: - // User Agent string - This will be constant for the user, but might not be for the attacker - // Netork Mask - ensures each request is coming from the same network. We may not be able to use the - // while ip, because some ISPs use load-balanced proxies, so subsequent requests may come from a - // different machine ip, but we can still use at least part of the address to filter out would be attackers. - $key = $_SERVER['HTTP_USER_AGENT'] . get_network_mask( $_SERVER['REMOTE_ADDR'], $_config['session-network-mask'], $_config['session-network-mode']); - return md5( $key ); - } - - /* - * The following methods deal with the users history - * These will be used to set up redirection after special pages, such as login - */ - - // Add a new item to the user history - public function history_add_request( $page ) { - global $_config; - // Add this item to the beginning of the history array - array_unshift( $_SESSION['history'], $page ); - // Keep the size below a fixed limit - if( count($_SESSION['history']) > $_config['max-history'] ) { - array_pop( $_SESSION['history'] ); - } - } - - // Remove the current item from the user history - public function history_drop_request() { - // remove the item from the beginning of the array - array_shift( $_SESSION['history'] ); - } - - // Return an item from the user history - public function history_get( $index ) { - if( is_numeric($index) ) { - if( $index < count($_SESSION['history']) ) { - return $_SESSION['history'][$index]; - } - } - } - - /* - * The following methods deal with user authentication and authorisation - */ - - // Log the user in - public function login( $username, $password ) { - global $_config; - - // Check the user hasnt been locked out before trying to login - if( $_SESSION['lockout'] == true ) { - // See if the lockout has expired - if($_SESSION['lockout-expiry'] > time() ) throw new AccountLockoutException('Your session is currently locked as a result of enterring too many incorrect passwords. You will not be able to attempt a login for another ' . date('i \m\i\n(\s), s \s\e\c(\s)', $_SESSION['lockout-expiry']-time())); - else { - // Unset the lockout - $_SESSION['lockout'] = false; - $_SESSION['lockout-expiry'] = 0; - $_SESSION['lockout-attempts'] = 0; - } - } - - - try { - // Attempt to authenticate with these credentials - $this->authentication->authenticate( $username, $password ); - } catch( Exception $e ) { - // Increment the number of failed authentication attempts - $_SESSION['lockout-attempts']++; - // Check the lockout attempts - if( $_SESSION['lockout-attempts'] >= $_config['lockout-attempts'] ) { - $_SESSION['lockout'] = true; - $_SESSION['lockout-expiry'] = time() + $_config['lockout-duration']; - throw new AccountLockoutException('You have enterred an incorrect password too many times, and your session has been locked. You will not be able to attempt another login for the next 10 minutes.'); - } - - // The login failed, rethrow the original exception - throw $e; - } - - // Successful login, update the session state - $this->mark_logged_in_as( $username ); - } - - // Log the current user out - public function logout() { - $this->mark_logged_out(); - } - - }; - -?> diff --git a/code/validation/ivalidator.php b/code/validation/ivalidator.php deleted file mode 100644 index 62afed3..0000000 --- a/code/validation/ivalidator.php +++ /dev/null @@ -1,115 +0,0 @@ -validate( $value ); - } - - // All successful - - } catch (ValidationException $e) { - // Add the friendly name of the variable that failed validation, and rethrow the exception - // for the calling code to catch - $e->append_name($name); - throw $e; - } - } - - - }; - - /* - * Validation Exceptions - */ - - class ValidationException extends BaseException { - - public function __construct($message) { - parent::__construct($message); - } - - public function append_name($name) { - $this->e .= ", while validating '{$name}'."; - } - - }; - - -?> diff --git a/code/validation/range_validator.php b/code/validation/range_validator.php deleted file mode 100644 index da0f9b3..0000000 --- a/code/validation/range_validator.php +++ /dev/null @@ -1,40 +0,0 @@ - $max ) - throw new ValidationException("Input is no in the range {$this->min}-{$this->max}"); - } - - }; - -?> diff --git a/index.php b/index.php deleted file mode 100644 index 0790792..0000000 --- a/index.php +++ /dev/null @@ -1,82 +0,0 @@ -get('page')) ? strtolower($_req->get('page')) : 'home'); - $_page = $_chroot . '/' . $_pagename . '.php'; - - // Capture this request so we know where the user wanted to go - $_session->history_add_request( $_SERVER['REQUEST_URI'] ); - - // Check that this path exists - $_realpath = realpath($_page); - if( $_realpath === false ) throw new Exception('Requested page doesnt exist', 404); - - // Check that the real file exists under the pages directory - if( substr($_realpath, 0, strlen($_chroot)) != $_chroot ) throw new Exception('Forbidden', 403); - - - } catch( Exception $e ) { - $_meta['error-code'] = $e->getCode(); - $_meta['error-message'] = $e->getMessage(); - $_page = "{$_meta['script-dir']}/page-sources/error.php"; - } - - // Capture the output and store it in the template - ob_start(); - - try { - include( $_page ); - } catch( AuthenticationException $e ) { - // Redirect to the login page - $_template['messages'][] = $e->getMessage(); - $_page = "{$_meta['script-dir']}/page-sources/login.php"; - // Get the new page - ob_clean(); - include( $_page ); - } catch( ParameterException $e ) { - // Redirect to the error page - $_meta['error-code'] = $e->getCode(); - $_meta['error-message'] = "Required parameter is either missing, or contains an illegal value: '{$e->getMessage()}'"; - $_page = "{$_meta['script-dir']}/page-sources/error.php"; - // Get the new page - ob_clean(); - include( $_page ); - } - - $_template['page'] = ob_get_contents(); - - // Since we've already caught them, prevent the contents from being - // passed to the browser - ob_end_clean(); - - // Get the template - include( $_template['template-file'] ); - - // Send any remaining output to the browser - ob_end_flush(); - -?> \ No newline at end of file diff --git a/page-sources/3yp.php b/page-sources/3yp.php deleted file mode 100644 index 4db99f1..0000000 --- a/page-sources/3yp.php +++ /dev/null @@ -1,26 +0,0 @@ - -

- I am still working on my project, but in the mean time I have some binaries available for user testing. - Please report any bugs you might find to my bug tracker. - (Note: The provider of my SSL certificates does not yet have their root CA certificate distributed with Internet Explorer or Opera, so if you need to, please add them as a Trusted CA.) -

-

- These binaries are solely for testing purposes, and may not be redistributed from anywhere other than this site. - I am in the process of packaging a source distribution. - -

-

- diff --git a/page-sources/error.php b/page-sources/error.php deleted file mode 100644 index 8242c23..0000000 --- a/page-sources/error.php +++ /dev/null @@ -1,15 +0,0 @@ -history_drop_request(); - // Display the error message, and redirect - $_template['title'] = "Errawr"; - $_template['messages'][] = $_meta['error-message']; - $_template['redirect-to'] = $_session->history_get(0); // Top of the list now - -?> \ No newline at end of file diff --git a/page-sources/home.php b/page-sources/home.php deleted file mode 100644 index 4a06114..0000000 --- a/page-sources/home.php +++ /dev/null @@ -1,31 +0,0 @@ - -
-Photo of Ben Roberts -

- I have almost finished the final year of a Master's degree in Computer Science at ECS, University of Southampton, UK and am due to graduate in June 2010. -

-

- Starting this summer, I will be working for Atos Origin as a Graduate Technical Specialist in the Managed Operations division. -

-

- I previously worked for Netcraft in Bath, while taking a year out from my degree studies. My roles included developing and running the SSL Server Survey, reviewing Automated Vulnerability Scan results, and performing occasional penetration tests against web applications for financial institutions. -

-

- On this site you can find a full copy of my CV, - or see what projects I have been working on in my spare time. -

-

- You can contact me via me@benroberts.net. -

- - -
diff --git a/page-sources/login.php b/page-sources/login.php deleted file mode 100644 index ec59b03..0000000 --- a/page-sources/login.php +++ /dev/null @@ -1,59 +0,0 @@ - 0 ) { - // Hide this request from the user's history - $_session->history_drop_request(); - // Now it wont matter how many times a user fails authentication, they will always be redirected to the - // page they requested in the first place - - // Check for the presence of the required form fields - if( !isset($_POST['username']) ) throw new ParameterException(); $username = $_POST['username']; - - $password = ''; - if( isset($_POST['password']) ) $password = $_POST['password']; - - // Attempt the login - try { - $_session->login( $username, $password ); - - // Present a message to the user - $_template['messages'][] = 'You have successfully logged in.'; - - // Set a redirection to the page the user was originally on (now the top of the list, because we dropped this page) - $_template['redirect-to'] = $_session->history_get(0); - - } catch (AuthenticationException $e) { - // Authentication failed - $_template['messages'][] = 'Authentication failed'; - _show_login_form(); - } - - } else { - _show_login_form(); - } - - function _show_login_form() { - global $_meta, $_req; - - // Present the login form to the user -?> -
-

-
- -

-
- diff --git a/page-sources/logout.php b/page-sources/logout.php deleted file mode 100644 index 2574f3d..0000000 --- a/page-sources/logout.php +++ /dev/null @@ -1,17 +0,0 @@ -logout(); - - // Leave the user a notice, and redirect them back to the home page - $_template['title'] = 'Logout'; - $_template['messages'][] = 'You have successfully been logged out.'; - $_template['redirect-to'] = $_req->construct('page','home'); - - -?> \ No newline at end of file diff --git a/page-sources/overlay.php b/page-sources/overlay.php deleted file mode 100644 index 57a9d8d..0000000 --- a/page-sources/overlay.php +++ /dev/null @@ -1,25 +0,0 @@ - -

- The ebuilds in this overlay have mostly been taken from the Gentoo - bugzilla, where the packages haven't yet made it into the portage tree. There - are also a couple of version-bumped packages, and packages to install my own - software on my own machines. Feel free to use these packages, but do so at your - own risk. -

- -

- You can install this overlay using layman. Add the the - Sihnon overlay url - to your overlays variable in /etc/layman/layman.cfg. Then update - the list of overlays with layman -L and add the Sihnon overlay - with layman -a sihnon. -

- -

- The contents of the overlay can be browsed in the - Sihnon overlay browser. -

- diff --git a/page-sources/projects.php b/page-sources/projects.php deleted file mode 100644 index d212534..0000000 --- a/page-sources/projects.php +++ /dev/null @@ -1,33 +0,0 @@ - -

Development projects:

-
-
" title="Gentoo Overlay">Gentoo Portage Overlay
-
Personally developed software, or miscellaneous ebuilds that can't be found in any other overlay.
- -
Sihnon Wiki
-
Documentation for various systems I've configured; mostly for personal reference, but may be useful to others.
- -
HandBrakeCluster
-
A collection of perl scripts to use HandBrakeCLI to batch rip DVD images using multiple machines.
- -
HandBrakeCluster WebUI
-
An alternative web-based UI for the HandBrakeCluster scripts, written in PHP.
- -
- - -

University projects:

-
-
" title="Third Year Project">Third Year Project
-
A cross-platform, zero-config file sharing client using public keys and a web of trust for password-less authentication and access control.
-
- diff --git a/private/.gitignore b/private/.gitignore new file mode 100644 index 0000000..52c2514 --- /dev/null +++ b/private/.gitignore @@ -0,0 +1,4 @@ +# configuration files +config.php +dbconfig.conf +settings.txt diff --git a/private/config.php.dist b/private/config.php.dist new file mode 100644 index 0000000..0672e2a --- /dev/null +++ b/private/config.php.dist @@ -0,0 +1,92 @@ + diff --git a/private/dbconfig.conf.dist b/private/dbconfig.conf.dist new file mode 100644 index 0000000..2d826ee --- /dev/null +++ b/private/dbconfig.conf.dist @@ -0,0 +1,5 @@ +hostname = localhost +username = homepage +password = changeme +dbname = homepage + diff --git a/private/htaccess.dist b/private/htaccess.dist new file mode 100644 index 0000000..7510cc3 --- /dev/null +++ b/private/htaccess.dist @@ -0,0 +1,16 @@ +SetEnv STATUSBOARD_CONFIG /etc/homepage/config.php + + + + RewriteEngine on + RewriteBase / + + RewriteCond %{REQUEST_FILENAME} !-f + RewriteCond %{REQUEST_FILENAME} !-d + RewriteRule ^(ajax/.*)$ a.php?l=$1 [L] + + RewriteCond %{REQUEST_FILENAME} !-f + RewriteCond %{REQUEST_FILENAME} !-d + RewriteRule ^(.*)$ index.php?l=$1 + + \ No newline at end of file diff --git a/private/settings.txt.dist b/private/settings.txt.dist new file mode 100644 index 0000000..798f346 --- /dev/null +++ b/private/settings.txt.dist @@ -0,0 +1,35 @@ +[logging.plugins] +type="array(string)" +value=FlatFile + +[logging.FlatFile] +type="array(string)" +value=logfile + +[logging.FlatFile.logfile.filename] +type=string +value=/var/log/homepage/homepage.log + +[logging.FlatFile.logfile.format] +type=string +value="%timestamp% %hostname%:%pid% %progname%:%shortfile%[%line%] %message%" + +[logging.FlatFile.logfile.severity] +type="array(string)" +value="debug +info +warning +error" + +[logging.FlatFile.logfile.category] +type="array(string)" +value="default" + +[cache.base_dir] +type=string +value=/dev/shm/homepage + +[debug.display_exceptions] +type=bool +value=1 + diff --git a/public/.htaccess b/public/.htaccess new file mode 100644 index 0000000..fde21da --- /dev/null +++ b/public/.htaccess @@ -0,0 +1,16 @@ +SetEnv HOMEPAGE_CONFIG /home/ben/projects/homepage/private/config.php + + + + RewriteEngine on + RewriteBase /~ben/homepage/ + + RewriteCond %{REQUEST_FILENAME} !-f + RewriteCond %{REQUEST_FILENAME} !-d + RewriteRule ^(ajax/.*)$ a.php?l=$1 [L] + + RewriteCond %{REQUEST_FILENAME} !-f + RewriteCond %{REQUEST_FILENAME} !-d + RewriteRule ^(.*)$ index.php?l=$1 + + diff --git a/public/_inc.php b/public/_inc.php new file mode 100644 index 0000000..c098636 --- /dev/null +++ b/public/_inc.php @@ -0,0 +1,16 @@ + diff --git a/files/BenRobertsCv.pdf b/public/files/BenRobertsCv.pdf similarity index 100% rename from files/BenRobertsCv.pdf rename to public/files/BenRobertsCv.pdf diff --git a/resources/at.png b/public/images/at.png similarity index 100% rename from resources/at.png rename to public/images/at.png diff --git a/files/portrait.jpg b/public/images/portrait.jpg similarity index 100% rename from files/portrait.jpg rename to public/images/portrait.jpg diff --git a/public/images/ripping-cluster/overview.png b/public/images/ripping-cluster/overview.png new file mode 100644 index 0000000..e395cfc Binary files /dev/null and b/public/images/ripping-cluster/overview.png differ diff --git a/public/images/status-board/overview.png b/public/images/status-board/overview.png new file mode 100644 index 0000000..07f94bb Binary files /dev/null and b/public/images/status-board/overview.png differ diff --git a/public/index.php b/public/index.php new file mode 100644 index 0000000..24a8f9f --- /dev/null +++ b/public/index.php @@ -0,0 +1,21 @@ +smarty(); + + $page = new Homepage_Page($smarty, $main->request()); + if ($page->evaluate()) { + $smarty->display('index.tpl'); + } + +} catch (Homepage_Exception $e) { + die("Uncaught Exception: " . $e->getMessage()); +} + +?> \ No newline at end of file diff --git a/public/scripts/3rdparty/bootstrap-alerts.js b/public/scripts/3rdparty/bootstrap-alerts.js new file mode 100644 index 0000000..37bb430 --- /dev/null +++ b/public/scripts/3rdparty/bootstrap-alerts.js @@ -0,0 +1,113 @@ +/* ========================================================== + * bootstrap-alerts.js v1.4.0 + * http://twitter.github.com/bootstrap/javascript.html#alerts + * ========================================================== + * Copyright 2011 Twitter, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ========================================================== */ + + +!function( $ ){ + + "use strict" + + /* CSS TRANSITION SUPPORT (https://gist.github.com/373874) + * ======================================================= */ + + var transitionEnd + + $(document).ready(function () { + + $.support.transition = (function () { + var thisBody = document.body || document.documentElement + , thisStyle = thisBody.style + , support = thisStyle.transition !== undefined || thisStyle.WebkitTransition !== undefined || thisStyle.MozTransition !== undefined || thisStyle.MsTransition !== undefined || thisStyle.OTransition !== undefined + return support + })() + + // set CSS transition event type + if ( $.support.transition ) { + transitionEnd = "TransitionEnd" + if ( $.browser.webkit ) { + transitionEnd = "webkitTransitionEnd" + } else if ( $.browser.mozilla ) { + transitionEnd = "transitionend" + } else if ( $.browser.opera ) { + transitionEnd = "oTransitionEnd" + } + } + + }) + + /* ALERT CLASS DEFINITION + * ====================== */ + + var Alert = function ( content, options ) { + this.settings = $.extend({}, $.fn.alert.defaults, options) + this.$element = $(content) + .delegate(this.settings.selector, 'click', this.close) + } + + Alert.prototype = { + + close: function (e) { + var $element = $(this).parent('.alert-message') + + e && e.preventDefault() + $element.removeClass('in') + + function removeElement () { + $element.remove() + } + + $.support.transition && $element.hasClass('fade') ? + $element.bind(transitionEnd, removeElement) : + removeElement() + } + + } + + + /* ALERT PLUGIN DEFINITION + * ======================= */ + + $.fn.alert = function ( options ) { + + if ( options === true ) { + return this.data('alert') + } + + return this.each(function () { + var $this = $(this) + + if ( typeof options == 'string' ) { + return $this.data('alert')[options]() + } + + $(this).data('alert', new Alert( this, options )) + + }) + } + + $.fn.alert.defaults = { + selector: '.close' + } + + $(document).ready(function () { + new Alert($('body'), { + selector: '.alert-message[data-alert] .close' + }) + }) + +}( window.jQuery || window.ender ); \ No newline at end of file diff --git a/public/scripts/3rdparty/bootstrap-dropdown.js b/public/scripts/3rdparty/bootstrap-dropdown.js new file mode 100644 index 0000000..cab0ec2 --- /dev/null +++ b/public/scripts/3rdparty/bootstrap-dropdown.js @@ -0,0 +1,55 @@ +/* ============================================================ + * bootstrap-dropdown.js v1.4.0 + * http://twitter.github.com/bootstrap/javascript.html#dropdown + * ============================================================ + * Copyright 2011 Twitter, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============================================================ */ + + +!function( $ ){ + + "use strict" + + /* DROPDOWN PLUGIN DEFINITION + * ========================== */ + + $.fn.dropdown = function ( selector ) { + return this.each(function () { + $(this).delegate(selector || d, 'click', function (e) { + var li = $(this).parent('li') + , isActive = li.hasClass('open') + + clearMenus() + !isActive && li.toggleClass('open') + return false + }) + }) + } + + /* APPLY TO STANDARD DROPDOWN ELEMENTS + * =================================== */ + + var d = 'a.menu, .dropdown-toggle' + + function clearMenus() { + $(d).parent('li').removeClass('open') + } + + $(function () { + $('html').bind("click", clearMenus) + $('body').dropdown( '[data-dropdown] a.menu, [data-dropdown] .dropdown-toggle' ) + }) + +}( window.jQuery || window.ender ); \ No newline at end of file diff --git a/public/scripts/3rdparty/bootstrap-modal.js b/public/scripts/3rdparty/bootstrap-modal.js new file mode 100644 index 0000000..be2315a --- /dev/null +++ b/public/scripts/3rdparty/bootstrap-modal.js @@ -0,0 +1,260 @@ +/* ========================================================= + * bootstrap-modal.js v1.4.0 + * http://twitter.github.com/bootstrap/javascript.html#modal + * ========================================================= + * Copyright 2011 Twitter, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ========================================================= */ + + +!function( $ ){ + + "use strict" + + /* CSS TRANSITION SUPPORT (https://gist.github.com/373874) + * ======================================================= */ + + var transitionEnd + + $(document).ready(function () { + + $.support.transition = (function () { + var thisBody = document.body || document.documentElement + , thisStyle = thisBody.style + , support = thisStyle.transition !== undefined || thisStyle.WebkitTransition !== undefined || thisStyle.MozTransition !== undefined || thisStyle.MsTransition !== undefined || thisStyle.OTransition !== undefined + return support + })() + + // set CSS transition event type + if ( $.support.transition ) { + transitionEnd = "TransitionEnd" + if ( $.browser.webkit ) { + transitionEnd = "webkitTransitionEnd" + } else if ( $.browser.mozilla ) { + transitionEnd = "transitionend" + } else if ( $.browser.opera ) { + transitionEnd = "oTransitionEnd" + } + } + + }) + + + /* MODAL PUBLIC CLASS DEFINITION + * ============================= */ + + var Modal = function ( content, options ) { + this.settings = $.extend({}, $.fn.modal.defaults, options) + this.$element = $(content) + .delegate('.close', 'click.modal', $.proxy(this.hide, this)) + + if ( this.settings.show ) { + this.show() + } + + return this + } + + Modal.prototype = { + + toggle: function () { + return this[!this.isShown ? 'show' : 'hide']() + } + + , show: function () { + var that = this + this.isShown = true + this.$element.trigger('show') + + escape.call(this) + backdrop.call(this, function () { + var transition = $.support.transition && that.$element.hasClass('fade') + + that.$element + .appendTo(document.body) + .show() + + if (transition) { + that.$element[0].offsetWidth // force reflow + } + + that.$element.addClass('in') + + transition ? + that.$element.one(transitionEnd, function () { that.$element.trigger('shown') }) : + that.$element.trigger('shown') + + }) + + return this + } + + , hide: function (e) { + e && e.preventDefault() + + if ( !this.isShown ) { + return this + } + + var that = this + this.isShown = false + + escape.call(this) + + this.$element + .trigger('hide') + .removeClass('in') + + $.support.transition && this.$element.hasClass('fade') ? + hideWithTransition.call(this) : + hideModal.call(this) + + return this + } + + } + + + /* MODAL PRIVATE METHODS + * ===================== */ + + function hideWithTransition() { + // firefox drops transitionEnd events :{o + var that = this + , timeout = setTimeout(function () { + that.$element.unbind(transitionEnd) + hideModal.call(that) + }, 500) + + this.$element.one(transitionEnd, function () { + clearTimeout(timeout) + hideModal.call(that) + }) + } + + function hideModal (that) { + this.$element + .hide() + .trigger('hidden') + + backdrop.call(this) + } + + function backdrop ( callback ) { + var that = this + , animate = this.$element.hasClass('fade') ? 'fade' : '' + if ( this.isShown && this.settings.backdrop ) { + var doAnimate = $.support.transition && animate + + this.$backdrop = $('