diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..39f48d9 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,15 @@ +# top-most EditorConfig file +root = true + +# Unix-style newlines with a newline ending every file +[*] +end_of_line = lf +insert_final_newline = true + +# Matches multiple files with brace expansion notation +# Set default charset +[*] +charset = utf-8 + +# Tab indentation (no size specified) +indent_style = tab diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..269044e --- /dev/null +++ b/.gitignore @@ -0,0 +1,31 @@ +.DS_Store + +application/cache/* +!application/cache/index.html + +application/logs/* +!application/logs/index.html + +!application/*/.htaccess + +composer.lock + +user_guide_src/build/* +user_guide_src/cilexer/build/* +user_guide_src/cilexer/dist/* +user_guide_src/cilexer/pycilexer.egg-info/* +/vendor/ + +# IDE Files +#------------------------- +/nbproject/ +.idea/* + +## Sublime Text cache files +*.tmlanguage.cache +*.tmPreferences.cache +*.stTheme.cache +*.sublime-workspace +*.sublime-project +/tests/tests/ +/tests/results/ diff --git a/.htaccess b/.htaccess new file mode 100644 index 0000000..1fea1ea --- /dev/null +++ b/.htaccess @@ -0,0 +1,4 @@ +RewriteEngine On +RewriteCond %{REQUEST_FILENAME} !-f +RewriteCond %{REQUEST_FILENAME} !-d +RewriteRule ^(.*)$ index.php?/$1 [L] \ No newline at end of file diff --git a/application/.htaccess b/application/.htaccess new file mode 100644 index 0000000..6c63ed4 --- /dev/null +++ b/application/.htaccess @@ -0,0 +1,6 @@ + + Require all denied + + + Deny from all + \ No newline at end of file diff --git a/application/cache/index.html b/application/cache/index.html new file mode 100644 index 0000000..b702fbc --- /dev/null +++ b/application/cache/index.html @@ -0,0 +1,11 @@ + + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + diff --git a/application/config/autoload.php b/application/config/autoload.php new file mode 100644 index 0000000..b960eab --- /dev/null +++ b/application/config/autoload.php @@ -0,0 +1,135 @@ + 'ua'); +*/ +$autoload['libraries'] = array('database', 'email', 'session'); + +/* +| ------------------------------------------------------------------- +| Auto-load Drivers +| ------------------------------------------------------------------- +| These classes are located in system/libraries/ or in your +| application/libraries/ directory, but are also placed inside their +| own subdirectory and they extend the CI_Driver_Library class. They +| offer multiple interchangeable driver options. +| +| Prototype: +| +| $autoload['drivers'] = array('cache'); +| +| You can also supply an alternative property name to be assigned in +| the controller: +| +| $autoload['drivers'] = array('cache' => 'cch'); +| +*/ +$autoload['drivers'] = array(); + +/* +| ------------------------------------------------------------------- +| Auto-load Helper Files +| ------------------------------------------------------------------- +| Prototype: +| +| $autoload['helper'] = array('url', 'file'); +*/ +$autoload['helper'] = array('url', 'file'); + +/* +| ------------------------------------------------------------------- +| Auto-load Config files +| ------------------------------------------------------------------- +| Prototype: +| +| $autoload['config'] = array('config1', 'config2'); +| +| NOTE: This item is intended for use ONLY if you have created custom +| config files. Otherwise, leave it blank. +| +*/ +$autoload['config'] = array(); + +/* +| ------------------------------------------------------------------- +| Auto-load Language files +| ------------------------------------------------------------------- +| Prototype: +| +| $autoload['language'] = array('lang1', 'lang2'); +| +| NOTE: Do not include the "_lang" part of your file. For example +| "codeigniter_lang.php" would be referenced as array('codeigniter'); +| +*/ +$autoload['language'] = array(); + +/* +| ------------------------------------------------------------------- +| Auto-load Models +| ------------------------------------------------------------------- +| Prototype: +| +| $autoload['model'] = array('first_model', 'second_model'); +| +| You can also supply an alternative model name to be assigned +| in the controller: +| +| $autoload['model'] = array('first_model' => 'first'); +*/ +$autoload['model'] = array(); diff --git a/application/config/config.php b/application/config/config.php new file mode 100644 index 0000000..c3267ac --- /dev/null +++ b/application/config/config.php @@ -0,0 +1,523 @@ +]+$/i +| +| DO NOT CHANGE THIS UNLESS YOU FULLY UNDERSTAND THE REPERCUSSIONS!! +| +*/ +$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-'; + +/* +|-------------------------------------------------------------------------- +| Enable Query Strings +|-------------------------------------------------------------------------- +| +| By default CodeIgniter uses search-engine friendly segment based URLs: +| example.com/who/what/where/ +| +| You can optionally enable standard query string based URLs: +| example.com?who=me&what=something&where=here +| +| Options are: TRUE or FALSE (boolean) +| +| The other items let you set the query string 'words' that will +| invoke your controllers and its functions: +| example.com/index.php?c=controller&m=function +| +| Please note that some of the helpers won't work as expected when +| this feature is enabled, since CodeIgniter is designed primarily to +| use segment based URLs. +| +*/ +$config['enable_query_strings'] = FALSE; +$config['controller_trigger'] = 'c'; +$config['function_trigger'] = 'm'; +$config['directory_trigger'] = 'd'; + +/* +|-------------------------------------------------------------------------- +| Allow $_GET array +|-------------------------------------------------------------------------- +| +| By default CodeIgniter enables access to the $_GET array. If for some +| reason you would like to disable it, set 'allow_get_array' to FALSE. +| +| WARNING: This feature is DEPRECATED and currently available only +| for backwards compatibility purposes! +| +*/ +$config['allow_get_array'] = TRUE; + +/* +|-------------------------------------------------------------------------- +| Error Logging Threshold +|-------------------------------------------------------------------------- +| +| You can enable error logging by setting a threshold over zero. The +| threshold determines what gets logged. Threshold options are: +| +| 0 = Disables logging, Error logging TURNED OFF +| 1 = Error Messages (including PHP errors) +| 2 = Debug Messages +| 3 = Informational Messages +| 4 = All Messages +| +| You can also pass an array with threshold levels to show individual error types +| +| array(2) = Debug Messages, without Error Messages +| +| For a live site you'll usually only enable Errors (1) to be logged otherwise +| your log files will fill up very fast. +| +*/ +$config['log_threshold'] = 0; + +/* +|-------------------------------------------------------------------------- +| Error Logging Directory Path +|-------------------------------------------------------------------------- +| +| Leave this BLANK unless you would like to set something other than the default +| application/logs/ directory. Use a full server path with trailing slash. +| +*/ +$config['log_path'] = ''; + +/* +|-------------------------------------------------------------------------- +| Log File Extension +|-------------------------------------------------------------------------- +| +| The default filename extension for log files. The default 'php' allows for +| protecting the log files via basic scripting, when they are to be stored +| under a publicly accessible directory. +| +| Note: Leaving it blank will default to 'php'. +| +*/ +$config['log_file_extension'] = ''; + +/* +|-------------------------------------------------------------------------- +| Log File Permissions +|-------------------------------------------------------------------------- +| +| The file system permissions to be applied on newly created log files. +| +| IMPORTANT: This MUST be an integer (no quotes) and you MUST use octal +| integer notation (i.e. 0700, 0644, etc.) +*/ +$config['log_file_permissions'] = 0644; + +/* +|-------------------------------------------------------------------------- +| Date Format for Logs +|-------------------------------------------------------------------------- +| +| Each item that is logged has an associated date. You can use PHP date +| codes to set your own date formatting +| +*/ +$config['log_date_format'] = 'Y-m-d H:i:s'; + +/* +|-------------------------------------------------------------------------- +| Error Views Directory Path +|-------------------------------------------------------------------------- +| +| Leave this BLANK unless you would like to set something other than the default +| application/views/errors/ directory. Use a full server path with trailing slash. +| +*/ +$config['error_views_path'] = ''; + +/* +|-------------------------------------------------------------------------- +| Cache Directory Path +|-------------------------------------------------------------------------- +| +| Leave this BLANK unless you would like to set something other than the default +| application/cache/ directory. Use a full server path with trailing slash. +| +*/ +$config['cache_path'] = ''; + +/* +|-------------------------------------------------------------------------- +| Cache Include Query String +|-------------------------------------------------------------------------- +| +| Whether to take the URL query string into consideration when generating +| output cache files. Valid options are: +| +| FALSE = Disabled +| TRUE = Enabled, take all query parameters into account. +| Please be aware that this may result in numerous cache +| files generated for the same page over and over again. +| array('q') = Enabled, but only take into account the specified list +| of query parameters. +| +*/ +$config['cache_query_string'] = FALSE; + +/* +|-------------------------------------------------------------------------- +| Encryption Key +|-------------------------------------------------------------------------- +| +| If you use the Encryption class, you must set an encryption key. +| See the user guide for more info. +| +| https://codeigniter.com/user_guide/libraries/encryption.html +| +*/ +$config['encryption_key'] = ''; + +/* +|-------------------------------------------------------------------------- +| Session Variables +|-------------------------------------------------------------------------- +| +| 'sess_driver' +| +| The storage driver to use: files, database, redis, memcached +| +| 'sess_cookie_name' +| +| The session cookie name, must contain only [0-9a-z_-] characters +| +| 'sess_expiration' +| +| The number of SECONDS you want the session to last. +| Setting to 0 (zero) means expire when the browser is closed. +| +| 'sess_save_path' +| +| The location to save sessions to, driver dependent. +| +| For the 'files' driver, it's a path to a writable directory. +| WARNING: Only absolute paths are supported! +| +| For the 'database' driver, it's a table name. +| Please read up the manual for the format with other session drivers. +| +| IMPORTANT: You are REQUIRED to set a valid save path! +| +| 'sess_match_ip' +| +| Whether to match the user's IP address when reading the session data. +| +| WARNING: If you're using the database driver, don't forget to update +| your session table's PRIMARY KEY when changing this setting. +| +| 'sess_time_to_update' +| +| How many seconds between CI regenerating the session ID. +| +| 'sess_regenerate_destroy' +| +| Whether to destroy session data associated with the old session ID +| when auto-regenerating the session ID. When set to FALSE, the data +| will be later deleted by the garbage collector. +| +| Other session cookie settings are shared with the rest of the application, +| except for 'cookie_prefix' and 'cookie_httponly', which are ignored here. +| +*/ +$config['sess_driver'] = 'files'; +$config['sess_cookie_name'] = 'ci_session'; +$config['sess_expiration'] = 7200; +$config['sess_save_path'] = NULL; +$config['sess_match_ip'] = FALSE; +$config['sess_time_to_update'] = 300; +$config['sess_regenerate_destroy'] = FALSE; + +/* +|-------------------------------------------------------------------------- +| Cookie Related Variables +|-------------------------------------------------------------------------- +| +| 'cookie_prefix' = Set a cookie name prefix if you need to avoid collisions +| 'cookie_domain' = Set to .your-domain.com for site-wide cookies +| 'cookie_path' = Typically will be a forward slash +| 'cookie_secure' = Cookie will only be set if a secure HTTPS connection exists. +| 'cookie_httponly' = Cookie will only be accessible via HTTP(S) (no javascript) +| +| Note: These settings (with the exception of 'cookie_prefix' and +| 'cookie_httponly') will also affect sessions. +| +*/ +$config['cookie_prefix'] = ''; +$config['cookie_domain'] = ''; +$config['cookie_path'] = '/'; +$config['cookie_secure'] = FALSE; +$config['cookie_httponly'] = FALSE; + +/* +|-------------------------------------------------------------------------- +| Standardize newlines +|-------------------------------------------------------------------------- +| +| Determines whether to standardize newline characters in input data, +| meaning to replace \r\n, \r, \n occurrences with the PHP_EOL value. +| +| WARNING: This feature is DEPRECATED and currently available only +| for backwards compatibility purposes! +| +*/ +$config['standardize_newlines'] = FALSE; + +/* +|-------------------------------------------------------------------------- +| Global XSS Filtering +|-------------------------------------------------------------------------- +| +| Determines whether the XSS filter is always active when GET, POST or +| COOKIE data is encountered +| +| WARNING: This feature is DEPRECATED and currently available only +| for backwards compatibility purposes! +| +*/ +$config['global_xss_filtering'] = FALSE; + +/* +|-------------------------------------------------------------------------- +| Cross Site Request Forgery +|-------------------------------------------------------------------------- +| Enables a CSRF cookie token to be set. When set to TRUE, token will be +| checked on a submitted form. If you are accepting user data, it is strongly +| recommended CSRF protection be enabled. +| +| 'csrf_token_name' = The token name +| 'csrf_cookie_name' = The cookie name +| 'csrf_expire' = The number in seconds the token should expire. +| 'csrf_regenerate' = Regenerate token on every submission +| 'csrf_exclude_uris' = Array of URIs which ignore CSRF checks +*/ +$config['csrf_protection'] = FALSE; +$config['csrf_token_name'] = 'csrf_test_name'; +$config['csrf_cookie_name'] = 'csrf_cookie_name'; +$config['csrf_expire'] = 7200; +$config['csrf_regenerate'] = TRUE; +$config['csrf_exclude_uris'] = array(); + +/* +|-------------------------------------------------------------------------- +| Output Compression +|-------------------------------------------------------------------------- +| +| Enables Gzip output compression for faster page loads. When enabled, +| the output class will test whether your server supports Gzip. +| Even if it does, however, not all browsers support compression +| so enable only if you are reasonably sure your visitors can handle it. +| +| Only used if zlib.output_compression is turned off in your php.ini. +| Please do not use it together with httpd-level output compression. +| +| VERY IMPORTANT: If you are getting a blank page when compression is enabled it +| means you are prematurely outputting something to your browser. It could +| even be a line of whitespace at the end of one of your scripts. For +| compression to work, nothing can be sent before the output buffer is called +| by the output class. Do not 'echo' any values with compression enabled. +| +*/ +$config['compress_output'] = FALSE; + +/* +|-------------------------------------------------------------------------- +| Master Time Reference +|-------------------------------------------------------------------------- +| +| Options are 'local' or any PHP supported timezone. This preference tells +| the system whether to use your server's local time as the master 'now' +| reference, or convert it to the configured one timezone. See the 'date +| helper' page of the user guide for information regarding date handling. +| +*/ +$config['time_reference'] = 'local'; + +/* +|-------------------------------------------------------------------------- +| Rewrite PHP Short Tags +|-------------------------------------------------------------------------- +| +| If your PHP installation does not have short tag support enabled CI +| can rewrite the tags on-the-fly, enabling you to utilize that syntax +| in your view files. Options are TRUE or FALSE (boolean) +| +| Note: You need to have eval() enabled for this to work. +| +*/ +$config['rewrite_short_tags'] = FALSE; + +/* +|-------------------------------------------------------------------------- +| Reverse Proxy IPs +|-------------------------------------------------------------------------- +| +| If your server is behind a reverse proxy, you must whitelist the proxy +| IP addresses from which CodeIgniter should trust headers such as +| HTTP_X_FORWARDED_FOR and HTTP_CLIENT_IP in order to properly identify +| the visitor's IP address. +| +| You can use both an array or a comma-separated list of proxy addresses, +| as well as specifying whole subnets. Here are a few examples: +| +| Comma-separated: '10.0.1.200,192.168.5.0/24' +| Array: array('10.0.1.200', '192.168.5.0/24') +*/ +$config['proxy_ips'] = ''; diff --git a/application/config/constants.php b/application/config/constants.php new file mode 100644 index 0000000..18d3b4b --- /dev/null +++ b/application/config/constants.php @@ -0,0 +1,85 @@ +db->last_query() and profiling of DB queries. +| When you run a query, with this setting set to TRUE (default), +| CodeIgniter will store the SQL statement for debugging purposes. +| However, this may cause high memory usage, especially if you run +| a lot of SQL queries ... disable this to avoid that problem. +| +| The $active_group variable lets you choose which connection group to +| make active. By default there is only one group (the 'default' group). +| +| The $query_builder variables lets you determine whether or not to load +| the query builder class. +*/ +$active_group = 'default'; +$query_builder = TRUE; + +$db['default'] = array( + 'dsn' => '', + 'hostname' => 'localhost', + 'username' => 'root', + 'password' => '', + 'database' => 'demo', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => (ENVIRONMENT !== 'production'), + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE +); diff --git a/application/config/doctypes.php b/application/config/doctypes.php new file mode 100644 index 0000000..59a7991 --- /dev/null +++ b/application/config/doctypes.php @@ -0,0 +1,24 @@ + '', + 'xhtml1-strict' => '', + 'xhtml1-trans' => '', + 'xhtml1-frame' => '', + 'xhtml-basic11' => '', + 'html5' => '', + 'html4-strict' => '', + 'html4-trans' => '', + 'html4-frame' => '', + 'mathml1' => '', + 'mathml2' => '', + 'svg10' => '', + 'svg11' => '', + 'svg11-basic' => '', + 'svg11-tiny' => '', + 'xhtml-math-svg-xh' => '', + 'xhtml-math-svg-sh' => '', + 'xhtml-rdfa-1' => '', + 'xhtml-rdfa-2' => '' +); diff --git a/application/config/foreign_chars.php b/application/config/foreign_chars.php new file mode 100644 index 0000000..0231f35 --- /dev/null +++ b/application/config/foreign_chars.php @@ -0,0 +1,114 @@ + 'ae', + '/ö|œ/' => 'oe', + '/ü/' => 'ue', + '/Ä/' => 'Ae', + '/Ü/' => 'Ue', + '/Ö/' => 'Oe', + '/À|Á|Â|Ã|Ä|Å|Ǻ|Ā|Ă|Ą|Ǎ|Α|Ά|Ả|Ạ|Ầ|Ẫ|Ẩ|Ậ|Ằ|Ắ|Ẵ|Ẳ|Ặ|А/' => 'A', + '/à|á|â|ã|å|ǻ|ā|ă|ą|ǎ|ª|α|ά|ả|ạ|ầ|ấ|ẫ|ẩ|ậ|ằ|ắ|ẵ|ẳ|ặ|а/' => 'a', + '/Б/' => 'B', + '/б/' => 'b', + '/Ç|Ć|Ĉ|Ċ|Č/' => 'C', + '/ç|ć|ĉ|ċ|č/' => 'c', + '/Д|Δ/' => 'D', + '/д|δ/' => 'd', + '/Ð|Ď|Đ/' => 'Dj', + '/ð|ď|đ/' => 'dj', + '/È|É|Ê|Ë|Ē|Ĕ|Ė|Ę|Ě|Ε|Έ|Ẽ|Ẻ|Ẹ|Ề|Ế|Ễ|Ể|Ệ|Е|Э/' => 'E', + '/è|é|ê|ë|ē|ĕ|ė|ę|ě|έ|ε|ẽ|ẻ|ẹ|ề|ế|ễ|ể|ệ|е|э/' => 'e', + '/Ф/' => 'F', + '/ф/' => 'f', + '/Ĝ|Ğ|Ġ|Ģ|Γ|Г|Ґ/' => 'G', + '/ĝ|ğ|ġ|ģ|γ|г|ґ/' => 'g', + '/Ĥ|Ħ/' => 'H', + '/ĥ|ħ/' => 'h', + '/Ì|Í|Î|Ï|Ĩ|Ī|Ĭ|Ǐ|Į|İ|Η|Ή|Ί|Ι|Ϊ|Ỉ|Ị|И|Ы/' => 'I', + '/ì|í|î|ï|ĩ|ī|ĭ|ǐ|į|ı|η|ή|ί|ι|ϊ|ỉ|ị|и|ы|ї/' => 'i', + '/Ĵ/' => 'J', + '/ĵ/' => 'j', + '/Θ/' => 'TH', + '/θ/' => 'th', + '/Ķ|Κ|К/' => 'K', + '/ķ|κ|к/' => 'k', + '/Ĺ|Ļ|Ľ|Ŀ|Ł|Λ|Л/' => 'L', + '/ĺ|ļ|ľ|ŀ|ł|λ|л/' => 'l', + '/М/' => 'M', + '/м/' => 'm', + '/Ñ|Ń|Ņ|Ň|Ν|Н/' => 'N', + '/ñ|ń|ņ|ň|ʼn|ν|н/' => 'n', + '/Ò|Ó|Ô|Õ|Ō|Ŏ|Ǒ|Ő|Ơ|Ø|Ǿ|Ο|Ό|Ω|Ώ|Ỏ|Ọ|Ồ|Ố|Ỗ|Ổ|Ộ|Ờ|Ớ|Ỡ|Ở|Ợ|О/' => 'O', + '/ò|ó|ô|õ|ō|ŏ|ǒ|ő|ơ|ø|ǿ|º|ο|ό|ω|ώ|ỏ|ọ|ồ|ố|ỗ|ổ|ộ|ờ|ớ|ỡ|ở|ợ|о/' => 'o', + '/П/' => 'P', + '/п/' => 'p', + '/Ŕ|Ŗ|Ř|Ρ|Р/' => 'R', + '/ŕ|ŗ|ř|ρ|р/' => 'r', + '/Ś|Ŝ|Ş|Ș|Š|Σ|С/' => 'S', + '/ś|ŝ|ş|ș|š|ſ|σ|ς|с/' => 's', + '/Ț|Ţ|Ť|Ŧ|Τ|Т/' => 'T', + '/ț|ţ|ť|ŧ|τ|т/' => 't', + '/Þ|þ/' => 'th', + '/Ù|Ú|Û|Ũ|Ū|Ŭ|Ů|Ű|Ų|Ư|Ǔ|Ǖ|Ǘ|Ǚ|Ǜ|Ũ|Ủ|Ụ|Ừ|Ứ|Ữ|Ử|Ự|У/' => 'U', + '/ù|ú|û|ũ|ū|ŭ|ů|ű|ų|ư|ǔ|ǖ|ǘ|ǚ|ǜ|υ|ύ|ϋ|ủ|ụ|ừ|ứ|ữ|ử|ự|у/' => 'u', + '/Ƴ|Ɏ|Ỵ|Ẏ|Ӳ|Ӯ|Ў|Ý|Ÿ|Ŷ|Υ|Ύ|Ϋ|Ỳ|Ỹ|Ỷ|Ỵ|Й/' => 'Y', + '/ẙ|ʏ|ƴ|ɏ|ỵ|ẏ|ӳ|ӯ|ў|ý|ÿ|ŷ|ỳ|ỹ|ỷ|ỵ|й/' => 'y', + '/В/' => 'V', + '/в/' => 'v', + '/Ŵ/' => 'W', + '/ŵ/' => 'w', + '/Φ/' => 'F', + '/φ/' => 'f', + '/Χ/' => 'CH', + '/χ/' => 'ch', + '/Ź|Ż|Ž|Ζ|З/' => 'Z', + '/ź|ż|ž|ζ|з/' => 'z', + '/Æ|Ǽ/' => 'AE', + '/ß/' => 'ss', + '/IJ/' => 'IJ', + '/ij/' => 'ij', + '/Œ/' => 'OE', + '/ƒ/' => 'f', + '/Ξ/' => 'KS', + '/ξ/' => 'ks', + '/Π/' => 'P', + '/π/' => 'p', + '/Β/' => 'V', + '/β/' => 'v', + '/Μ/' => 'M', + '/μ/' => 'm', + '/Ψ/' => 'PS', + '/ψ/' => 'ps', + '/Ё/' => 'Yo', + '/ё/' => 'yo', + '/Є/' => 'Ye', + '/є/' => 'ye', + '/Ї/' => 'Yi', + '/Ж/' => 'Zh', + '/ж/' => 'zh', + '/Х/' => 'Kh', + '/х/' => 'kh', + '/Ц/' => 'Ts', + '/ц/' => 'ts', + '/Ч/' => 'Ch', + '/ч/' => 'ch', + '/Ш/' => 'Sh', + '/ш/' => 'sh', + '/Щ/' => 'Shch', + '/щ/' => 'shch', + '/Ъ|ъ|Ь|ь/' => '', + '/Ю/' => 'Yu', + '/ю/' => 'yu', + '/Я/' => 'Ya', + '/я/' => 'ya' +); diff --git a/application/config/hooks.php b/application/config/hooks.php new file mode 100644 index 0000000..a8f38a5 --- /dev/null +++ b/application/config/hooks.php @@ -0,0 +1,13 @@ + + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + diff --git a/application/config/memcached.php b/application/config/memcached.php new file mode 100644 index 0000000..5c23b39 --- /dev/null +++ b/application/config/memcached.php @@ -0,0 +1,19 @@ + array( + 'hostname' => '127.0.0.1', + 'port' => '11211', + 'weight' => '1', + ), +); diff --git a/application/config/migration.php b/application/config/migration.php new file mode 100644 index 0000000..4b585a6 --- /dev/null +++ b/application/config/migration.php @@ -0,0 +1,84 @@ +migration->current() this is the version that schema will +| be upgraded / downgraded to. +| +*/ +$config['migration_version'] = 0; + +/* +|-------------------------------------------------------------------------- +| Migrations Path +|-------------------------------------------------------------------------- +| +| Path to your migrations folder. +| Typically, it will be within your application path. +| Also, writing permission is required within the migrations path. +| +*/ +$config['migration_path'] = APPPATH.'migrations/'; diff --git a/application/config/mimes.php b/application/config/mimes.php new file mode 100644 index 0000000..7aa5c9e --- /dev/null +++ b/application/config/mimes.php @@ -0,0 +1,184 @@ + array('application/mac-binhex40', 'application/mac-binhex', 'application/x-binhex40', 'application/x-mac-binhex40'), + 'cpt' => 'application/mac-compactpro', + 'csv' => array('text/x-comma-separated-values', 'text/comma-separated-values', 'application/octet-stream', 'application/vnd.ms-excel', 'application/x-csv', 'text/x-csv', 'text/csv', 'application/csv', 'application/excel', 'application/vnd.msexcel', 'text/plain'), + 'bin' => array('application/macbinary', 'application/mac-binary', 'application/octet-stream', 'application/x-binary', 'application/x-macbinary'), + 'dms' => 'application/octet-stream', + 'lha' => 'application/octet-stream', + 'lzh' => 'application/octet-stream', + 'exe' => array('application/octet-stream', 'application/x-msdownload'), + 'class' => 'application/octet-stream', + 'psd' => array('application/x-photoshop', 'image/vnd.adobe.photoshop'), + 'so' => 'application/octet-stream', + 'sea' => 'application/octet-stream', + 'dll' => 'application/octet-stream', + 'oda' => 'application/oda', + 'pdf' => array('application/pdf', 'application/force-download', 'application/x-download', 'binary/octet-stream'), + 'ai' => array('application/pdf', 'application/postscript'), + 'eps' => 'application/postscript', + 'ps' => 'application/postscript', + 'smi' => 'application/smil', + 'smil' => 'application/smil', + 'mif' => 'application/vnd.mif', + 'xls' => array('application/vnd.ms-excel', 'application/msexcel', 'application/x-msexcel', 'application/x-ms-excel', 'application/x-excel', 'application/x-dos_ms_excel', 'application/xls', 'application/x-xls', 'application/excel', 'application/download', 'application/vnd.ms-office', 'application/msword'), + 'ppt' => array('application/powerpoint', 'application/vnd.ms-powerpoint', 'application/vnd.ms-office', 'application/msword'), + 'pptx' => array('application/vnd.openxmlformats-officedocument.presentationml.presentation', 'application/x-zip', 'application/zip'), + 'wbxml' => 'application/wbxml', + 'wmlc' => 'application/wmlc', + 'dcr' => 'application/x-director', + 'dir' => 'application/x-director', + 'dxr' => 'application/x-director', + 'dvi' => 'application/x-dvi', + 'gtar' => 'application/x-gtar', + 'gz' => 'application/x-gzip', + 'gzip' => 'application/x-gzip', + 'php' => array('application/x-httpd-php', 'application/php', 'application/x-php', 'text/php', 'text/x-php', 'application/x-httpd-php-source'), + 'php4' => 'application/x-httpd-php', + 'php3' => 'application/x-httpd-php', + 'phtml' => 'application/x-httpd-php', + 'phps' => 'application/x-httpd-php-source', + 'js' => array('application/x-javascript', 'text/plain'), + 'swf' => 'application/x-shockwave-flash', + 'sit' => 'application/x-stuffit', + 'tar' => 'application/x-tar', + 'tgz' => array('application/x-tar', 'application/x-gzip-compressed'), + 'z' => 'application/x-compress', + 'xhtml' => 'application/xhtml+xml', + 'xht' => 'application/xhtml+xml', + 'zip' => array('application/x-zip', 'application/zip', 'application/x-zip-compressed', 'application/s-compressed', 'multipart/x-zip'), + 'rar' => array('application/x-rar', 'application/rar', 'application/x-rar-compressed'), + 'mid' => 'audio/midi', + 'midi' => 'audio/midi', + 'mpga' => 'audio/mpeg', + 'mp2' => 'audio/mpeg', + 'mp3' => array('audio/mpeg', 'audio/mpg', 'audio/mpeg3', 'audio/mp3'), + 'aif' => array('audio/x-aiff', 'audio/aiff'), + 'aiff' => array('audio/x-aiff', 'audio/aiff'), + 'aifc' => 'audio/x-aiff', + 'ram' => 'audio/x-pn-realaudio', + 'rm' => 'audio/x-pn-realaudio', + 'rpm' => 'audio/x-pn-realaudio-plugin', + 'ra' => 'audio/x-realaudio', + 'rv' => 'video/vnd.rn-realvideo', + 'wav' => array('audio/x-wav', 'audio/wave', 'audio/wav'), + 'bmp' => array('image/bmp', 'image/x-bmp', 'image/x-bitmap', 'image/x-xbitmap', 'image/x-win-bitmap', 'image/x-windows-bmp', 'image/ms-bmp', 'image/x-ms-bmp', 'application/bmp', 'application/x-bmp', 'application/x-win-bitmap'), + 'gif' => 'image/gif', + 'jpeg' => array('image/jpeg', 'image/pjpeg'), + 'jpg' => array('image/jpeg', 'image/pjpeg'), + 'jpe' => array('image/jpeg', 'image/pjpeg'), + 'jp2' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'), + 'j2k' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'), + 'jpf' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'), + 'jpg2' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'), + 'jpx' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'), + 'jpm' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'), + 'mj2' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'), + 'mjp2' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'), + 'png' => array('image/png', 'image/x-png'), + 'tiff' => 'image/tiff', + 'tif' => 'image/tiff', + 'css' => array('text/css', 'text/plain'), + 'html' => array('text/html', 'text/plain'), + 'htm' => array('text/html', 'text/plain'), + 'shtml' => array('text/html', 'text/plain'), + 'txt' => 'text/plain', + 'text' => 'text/plain', + 'log' => array('text/plain', 'text/x-log'), + 'rtx' => 'text/richtext', + 'rtf' => 'text/rtf', + 'xml' => array('application/xml', 'text/xml', 'text/plain'), + 'xsl' => array('application/xml', 'text/xsl', 'text/xml'), + 'mpeg' => 'video/mpeg', + 'mpg' => 'video/mpeg', + 'mpe' => 'video/mpeg', + 'qt' => 'video/quicktime', + 'mov' => 'video/quicktime', + 'avi' => array('video/x-msvideo', 'video/msvideo', 'video/avi', 'application/x-troff-msvideo'), + 'movie' => 'video/x-sgi-movie', + 'doc' => array('application/msword', 'application/vnd.ms-office'), + 'docx' => array('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/zip', 'application/msword', 'application/x-zip'), + 'dot' => array('application/msword', 'application/vnd.ms-office'), + 'dotx' => array('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/zip', 'application/msword'), + 'xlsx' => array('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'application/zip', 'application/vnd.ms-excel', 'application/msword', 'application/x-zip'), + 'word' => array('application/msword', 'application/octet-stream'), + 'xl' => 'application/excel', + 'eml' => 'message/rfc822', + 'json' => array('application/json', 'text/json'), + 'pem' => array('application/x-x509-user-cert', 'application/x-pem-file', 'application/octet-stream'), + 'p10' => array('application/x-pkcs10', 'application/pkcs10'), + 'p12' => 'application/x-pkcs12', + 'p7a' => 'application/x-pkcs7-signature', + 'p7c' => array('application/pkcs7-mime', 'application/x-pkcs7-mime'), + 'p7m' => array('application/pkcs7-mime', 'application/x-pkcs7-mime'), + 'p7r' => 'application/x-pkcs7-certreqresp', + 'p7s' => 'application/pkcs7-signature', + 'crt' => array('application/x-x509-ca-cert', 'application/x-x509-user-cert', 'application/pkix-cert'), + 'crl' => array('application/pkix-crl', 'application/pkcs-crl'), + 'der' => 'application/x-x509-ca-cert', + 'kdb' => 'application/octet-stream', + 'pgp' => 'application/pgp', + 'gpg' => 'application/gpg-keys', + 'sst' => 'application/octet-stream', + 'csr' => 'application/octet-stream', + 'rsa' => 'application/x-pkcs7', + 'cer' => array('application/pkix-cert', 'application/x-x509-ca-cert'), + '3g2' => 'video/3gpp2', + '3gp' => array('video/3gp', 'video/3gpp'), + 'mp4' => 'video/mp4', + 'm4a' => 'audio/x-m4a', + 'f4v' => array('video/mp4', 'video/x-f4v'), + 'flv' => 'video/x-flv', + 'webm' => 'video/webm', + 'aac' => array('audio/x-aac', 'audio/aac'), + 'm4u' => 'application/vnd.mpegurl', + 'm3u' => 'text/plain', + 'xspf' => 'application/xspf+xml', + 'vlc' => 'application/videolan', + 'wmv' => array('video/x-ms-wmv', 'video/x-ms-asf'), + 'au' => 'audio/x-au', + 'ac3' => 'audio/ac3', + 'flac' => 'audio/x-flac', + 'ogg' => array('audio/ogg', 'video/ogg', 'application/ogg'), + 'kmz' => array('application/vnd.google-earth.kmz', 'application/zip', 'application/x-zip'), + 'kml' => array('application/vnd.google-earth.kml+xml', 'application/xml', 'text/xml'), + 'ics' => 'text/calendar', + 'ical' => 'text/calendar', + 'zsh' => 'text/x-scriptzsh', + '7z' => array('application/x-7z-compressed', 'application/x-compressed', 'application/x-zip-compressed', 'application/zip', 'multipart/x-zip'), + '7zip' => array('application/x-7z-compressed', 'application/x-compressed', 'application/x-zip-compressed', 'application/zip', 'multipart/x-zip'), + 'cdr' => array('application/cdr', 'application/coreldraw', 'application/x-cdr', 'application/x-coreldraw', 'image/cdr', 'image/x-cdr', 'zz-application/zz-winassoc-cdr'), + 'wma' => array('audio/x-ms-wma', 'video/x-ms-asf'), + 'jar' => array('application/java-archive', 'application/x-java-application', 'application/x-jar', 'application/x-compressed'), + 'svg' => array('image/svg+xml', 'application/xml', 'text/xml'), + 'vcf' => 'text/x-vcard', + 'srt' => array('text/srt', 'text/plain'), + 'vtt' => array('text/vtt', 'text/plain'), + 'ico' => array('image/x-icon', 'image/x-ico', 'image/vnd.microsoft.icon'), + 'odc' => 'application/vnd.oasis.opendocument.chart', + 'otc' => 'application/vnd.oasis.opendocument.chart-template', + 'odf' => 'application/vnd.oasis.opendocument.formula', + 'otf' => 'application/vnd.oasis.opendocument.formula-template', + 'odg' => 'application/vnd.oasis.opendocument.graphics', + 'otg' => 'application/vnd.oasis.opendocument.graphics-template', + 'odi' => 'application/vnd.oasis.opendocument.image', + 'oti' => 'application/vnd.oasis.opendocument.image-template', + 'odp' => 'application/vnd.oasis.opendocument.presentation', + 'otp' => 'application/vnd.oasis.opendocument.presentation-template', + 'ods' => 'application/vnd.oasis.opendocument.spreadsheet', + 'ots' => 'application/vnd.oasis.opendocument.spreadsheet-template', + 'odt' => 'application/vnd.oasis.opendocument.text', + 'odm' => 'application/vnd.oasis.opendocument.text-master', + 'ott' => 'application/vnd.oasis.opendocument.text-template', + 'oth' => 'application/vnd.oasis.opendocument.text-web' +); diff --git a/application/config/profiler.php b/application/config/profiler.php new file mode 100644 index 0000000..3db22e3 --- /dev/null +++ b/application/config/profiler.php @@ -0,0 +1,14 @@ + my_controller/index +| my-controller/my-method -> my_controller/my_method +*/ +$route['default_controller'] = 'welcome'; +$route['404_override'] = ''; +$route['translate_uri_dashes'] = FALSE; +$route['dashboard'] = 'welcome/dashboard'; + +//Role// +$route['roles'] = 'role/listrole'; +$route['add_role'] = 'role/addrole'; +$route['edit_role'] = 'role/editrole'; +$route['delete_role'] = 'role/deleterole'; + + +//emplayee// +$route['employee'] = 'employee/employee_list'; +$route['add'] = 'employee/add_list'; +$route['add_employee'] = 'employee/add_employee'; +$route['edit_employees/(:num)'] = 'employee/editemployee/$1'; +$route['deleted_employee'] = 'employee/deleted_employee'; + +//Department// +$route['department'] = 'department/department_list'; +$route['add_department'] = 'department/add_department'; +$route['edit_department'] = 'department/edit_department'; +$route['delete_department'] = 'department/delete_department'; + +//Semester// +$route['semester'] = 'semester/semester_list'; +$route['add_semester'] = 'semester/add_semester'; +$route['edit_semester/(:num)'] = 'semester/edit_semester/$1'; +$route['deleted_semester'] = 'semester/deleted_semester'; + + + +//subject// +$route['subject'] = 'subject/subject_list'; +$route['add_subject'] = 'subject/add_subject'; +$route['edit_subject/(:num)'] = 'subject/edit_subject/$1'; +$route['deleted_subject'] = 'subject/deleted_subject'; + + +//faculty// +$route['faculty'] = 'faculty/faculty_list'; +$route['add_faculty'] = 'faculty/add_faculty'; +$route['edit_faculty/(:num)'] = 'faculty/edit_faculty/$1'; +$route['deleted_faculty'] = 'faculty/deleted_faculty'; + + +//student// +$route['student'] = 'student/student_list'; +$route['add_student'] = 'student/add_student'; +$route['edit_student/(:num)'] = 'student/edit_student/$1'; +$route['deleted_student'] = 'student/deleted_student'; \ No newline at end of file diff --git a/application/config/smileys.php b/application/config/smileys.php new file mode 100644 index 0000000..abf9a89 --- /dev/null +++ b/application/config/smileys.php @@ -0,0 +1,64 @@ + array('grin.gif', '19', '19', 'grin'), + ':lol:' => array('lol.gif', '19', '19', 'LOL'), + ':cheese:' => array('cheese.gif', '19', '19', 'cheese'), + ':)' => array('smile.gif', '19', '19', 'smile'), + ';-)' => array('wink.gif', '19', '19', 'wink'), + ';)' => array('wink.gif', '19', '19', 'wink'), + ':smirk:' => array('smirk.gif', '19', '19', 'smirk'), + ':roll:' => array('rolleyes.gif', '19', '19', 'rolleyes'), + ':-S' => array('confused.gif', '19', '19', 'confused'), + ':wow:' => array('surprise.gif', '19', '19', 'surprised'), + ':bug:' => array('bigsurprise.gif', '19', '19', 'big surprise'), + ':-P' => array('tongue_laugh.gif', '19', '19', 'tongue laugh'), + '%-P' => array('tongue_rolleye.gif', '19', '19', 'tongue rolleye'), + ';-P' => array('tongue_wink.gif', '19', '19', 'tongue wink'), + ':P' => array('raspberry.gif', '19', '19', 'raspberry'), + ':blank:' => array('blank.gif', '19', '19', 'blank stare'), + ':long:' => array('longface.gif', '19', '19', 'long face'), + ':ohh:' => array('ohh.gif', '19', '19', 'ohh'), + ':grrr:' => array('grrr.gif', '19', '19', 'grrr'), + ':gulp:' => array('gulp.gif', '19', '19', 'gulp'), + '8-/' => array('ohoh.gif', '19', '19', 'oh oh'), + ':down:' => array('downer.gif', '19', '19', 'downer'), + ':red:' => array('embarrassed.gif', '19', '19', 'red face'), + ':sick:' => array('sick.gif', '19', '19', 'sick'), + ':shut:' => array('shuteye.gif', '19', '19', 'shut eye'), + ':-/' => array('hmm.gif', '19', '19', 'hmmm'), + '>:(' => array('mad.gif', '19', '19', 'mad'), + ':mad:' => array('mad.gif', '19', '19', 'mad'), + '>:-(' => array('angry.gif', '19', '19', 'angry'), + ':angry:' => array('angry.gif', '19', '19', 'angry'), + ':zip:' => array('zip.gif', '19', '19', 'zipper'), + ':kiss:' => array('kiss.gif', '19', '19', 'kiss'), + ':ahhh:' => array('shock.gif', '19', '19', 'shock'), + ':coolsmile:' => array('shade_smile.gif', '19', '19', 'cool smile'), + ':coolsmirk:' => array('shade_smirk.gif', '19', '19', 'cool smirk'), + ':coolgrin:' => array('shade_grin.gif', '19', '19', 'cool grin'), + ':coolhmm:' => array('shade_hmm.gif', '19', '19', 'cool hmm'), + ':coolmad:' => array('shade_mad.gif', '19', '19', 'cool mad'), + ':coolcheese:' => array('shade_cheese.gif', '19', '19', 'cool cheese'), + ':vampire:' => array('vampire.gif', '19', '19', 'vampire'), + ':snake:' => array('snake.gif', '19', '19', 'snake'), + ':exclaim:' => array('exclaim.gif', '19', '19', 'exclaim'), + ':question:' => array('question.gif', '19', '19', 'question') + +); diff --git a/application/config/user_agents.php b/application/config/user_agents.php new file mode 100644 index 0000000..c1581e5 --- /dev/null +++ b/application/config/user_agents.php @@ -0,0 +1,216 @@ + 'Windows 10', + 'windows nt 6.3' => 'Windows 8.1', + 'windows nt 6.2' => 'Windows 8', + 'windows nt 6.1' => 'Windows 7', + 'windows nt 6.0' => 'Windows Vista', + 'windows nt 5.2' => 'Windows 2003', + 'windows nt 5.1' => 'Windows XP', + 'windows nt 5.0' => 'Windows 2000', + 'windows nt 4.0' => 'Windows NT 4.0', + 'winnt4.0' => 'Windows NT 4.0', + 'winnt 4.0' => 'Windows NT', + 'winnt' => 'Windows NT', + 'windows 98' => 'Windows 98', + 'win98' => 'Windows 98', + 'windows 95' => 'Windows 95', + 'win95' => 'Windows 95', + 'windows phone' => 'Windows Phone', + 'windows' => 'Unknown Windows OS', + 'android' => 'Android', + 'blackberry' => 'BlackBerry', + 'iphone' => 'iOS', + 'ipad' => 'iOS', + 'ipod' => 'iOS', + 'os x' => 'Mac OS X', + 'ppc mac' => 'Power PC Mac', + 'freebsd' => 'FreeBSD', + 'ppc' => 'Macintosh', + 'linux' => 'Linux', + 'debian' => 'Debian', + 'sunos' => 'Sun Solaris', + 'beos' => 'BeOS', + 'apachebench' => 'ApacheBench', + 'aix' => 'AIX', + 'irix' => 'Irix', + 'osf' => 'DEC OSF', + 'hp-ux' => 'HP-UX', + 'netbsd' => 'NetBSD', + 'bsdi' => 'BSDi', + 'openbsd' => 'OpenBSD', + 'gnu' => 'GNU/Linux', + 'unix' => 'Unknown Unix OS', + 'symbian' => 'Symbian OS' +); + + +// The order of this array should NOT be changed. Many browsers return +// multiple browser types so we want to identify the sub-type first. +$browsers = array( + 'OPR' => 'Opera', + 'Flock' => 'Flock', + 'Edge' => 'Edge', + 'Chrome' => 'Chrome', + // Opera 10+ always reports Opera/9.80 and appends Version/ to the user agent string + 'Opera.*?Version' => 'Opera', + 'Opera' => 'Opera', + 'MSIE' => 'Internet Explorer', + 'Internet Explorer' => 'Internet Explorer', + 'Trident.* rv' => 'Internet Explorer', + 'Shiira' => 'Shiira', + 'Firefox' => 'Firefox', + 'Chimera' => 'Chimera', + 'Phoenix' => 'Phoenix', + 'Firebird' => 'Firebird', + 'Camino' => 'Camino', + 'Netscape' => 'Netscape', + 'OmniWeb' => 'OmniWeb', + 'Safari' => 'Safari', + 'Mozilla' => 'Mozilla', + 'Konqueror' => 'Konqueror', + 'icab' => 'iCab', + 'Lynx' => 'Lynx', + 'Links' => 'Links', + 'hotjava' => 'HotJava', + 'amaya' => 'Amaya', + 'IBrowse' => 'IBrowse', + 'Maxthon' => 'Maxthon', + 'Ubuntu' => 'Ubuntu Web Browser' +); + +$mobiles = array( + // legacy array, old values commented out + 'mobileexplorer' => 'Mobile Explorer', +// 'openwave' => 'Open Wave', +// 'opera mini' => 'Opera Mini', +// 'operamini' => 'Opera Mini', +// 'elaine' => 'Palm', + 'palmsource' => 'Palm', +// 'digital paths' => 'Palm', +// 'avantgo' => 'Avantgo', +// 'xiino' => 'Xiino', + 'palmscape' => 'Palmscape', +// 'nokia' => 'Nokia', +// 'ericsson' => 'Ericsson', +// 'blackberry' => 'BlackBerry', +// 'motorola' => 'Motorola' + + // Phones and Manufacturers + 'motorola' => 'Motorola', + 'nokia' => 'Nokia', + 'nexus' => 'Nexus', + 'palm' => 'Palm', + 'iphone' => 'Apple iPhone', + 'ipad' => 'iPad', + 'ipod' => 'Apple iPod Touch', + 'sony' => 'Sony Ericsson', + 'ericsson' => 'Sony Ericsson', + 'blackberry' => 'BlackBerry', + 'cocoon' => 'O2 Cocoon', + 'blazer' => 'Treo', + 'lg' => 'LG', + 'amoi' => 'Amoi', + 'xda' => 'XDA', + 'mda' => 'MDA', + 'vario' => 'Vario', + 'htc' => 'HTC', + 'samsung' => 'Samsung', + 'sharp' => 'Sharp', + 'sie-' => 'Siemens', + 'alcatel' => 'Alcatel', + 'benq' => 'BenQ', + 'ipaq' => 'HP iPaq', + 'mot-' => 'Motorola', + 'playstation portable' => 'PlayStation Portable', + 'playstation 3' => 'PlayStation 3', + 'playstation vita' => 'PlayStation Vita', + 'hiptop' => 'Danger Hiptop', + 'nec-' => 'NEC', + 'panasonic' => 'Panasonic', + 'philips' => 'Philips', + 'sagem' => 'Sagem', + 'sanyo' => 'Sanyo', + 'spv' => 'SPV', + 'zte' => 'ZTE', + 'sendo' => 'Sendo', + 'nintendo dsi' => 'Nintendo DSi', + 'nintendo ds' => 'Nintendo DS', + 'nintendo 3ds' => 'Nintendo 3DS', + 'wii' => 'Nintendo Wii', + 'open web' => 'Open Web', + 'openweb' => 'OpenWeb', + 'meizu' => 'Meizu', + + // Operating Systems + 'android' => 'Android', + 'symbian' => 'Symbian', + 'SymbianOS' => 'SymbianOS', + 'elaine' => 'Palm', + 'series60' => 'Symbian S60', + 'windows ce' => 'Windows CE', + + // Browsers + 'obigo' => 'Obigo', + 'netfront' => 'Netfront Browser', + 'openwave' => 'Openwave Browser', + 'mobilexplorer' => 'Mobile Explorer', + 'operamini' => 'Opera Mini', + 'opera mini' => 'Opera Mini', + 'opera mobi' => 'Opera Mobile', + 'fennec' => 'Firefox Mobile', + + // Other + 'digital paths' => 'Digital Paths', + 'avantgo' => 'AvantGo', + 'xiino' => 'Xiino', + 'novarra' => 'Novarra Transcoder', + 'vodafone' => 'Vodafone', + 'docomo' => 'NTT DoCoMo', + 'o2' => 'O2', + + // Fallback + 'mobile' => 'Generic Mobile', + 'wireless' => 'Generic Mobile', + 'j2me' => 'Generic Mobile', + 'midp' => 'Generic Mobile', + 'cldc' => 'Generic Mobile', + 'up.link' => 'Generic Mobile', + 'up.browser' => 'Generic Mobile', + 'smartphone' => 'Generic Mobile', + 'cellphone' => 'Generic Mobile' +); + +// There are hundreds of bots but these are the most common. +$robots = array( + 'googlebot' => 'Googlebot', + 'msnbot' => 'MSNBot', + 'baiduspider' => 'Baiduspider', + 'bingbot' => 'Bing', + 'slurp' => 'Inktomi Slurp', + 'yahoo' => 'Yahoo', + 'ask jeeves' => 'Ask Jeeves', + 'fastcrawler' => 'FastCrawler', + 'infoseek' => 'InfoSeek Robot 1.0', + 'lycos' => 'Lycos', + 'yandex' => 'YandexBot', + 'mediapartners-google' => 'MediaPartners Google', + 'CRAZYWEBCRAWLER' => 'Crazy Webcrawler', + 'adsbot-google' => 'AdsBot Google', + 'feedfetcher-google' => 'Feedfetcher Google', + 'curious george' => 'Curious George', + 'ia_archiver' => 'Alexa Crawler', + 'MJ12bot' => 'Majestic-12', + 'Uptimebot' => 'Uptimebot' +); diff --git a/application/controllers/Dashboard.php b/application/controllers/Dashboard.php new file mode 100644 index 0000000..d0bc3b4 --- /dev/null +++ b/application/controllers/Dashboard.php @@ -0,0 +1,27 @@ + + * @see https://codeigniter.com/user_guide/general/urls.html + */ + public function add() + { + $this->load->view('welcome/dashboarde'); + } + + +} diff --git a/application/controllers/Department.php b/application/controllers/Department.php new file mode 100644 index 0000000..4c4c70c --- /dev/null +++ b/application/controllers/Department.php @@ -0,0 +1,131 @@ +load->model('Department_model'); + $this->load->model('Commonsql_model'); + + } + + /** + * Index Page for this controller. + * + * Maps to the following URL + * http://example.com/index.php/welcome + * - or - + * http://example.com/index.php/welcome/index + * - or - + * Since this controller is set as the default controller in + * config/routes.php, it's displayed at http://example.com/ + * + * So any other public methods not prefixed with an underscore will + * map to /index.php/welcome/ + * @see https://codeigniter.com/user_guide/general/urls.html + */ + public function department_list() + { + $data['dep']=$this->Department_model->dep_list(); + $this->load->view('department/department_list',$data); + } + + + + function add_department() + { + if($this->input->post('submit')) + { + $depname=$this->input->post('depname'); + $depcode=$this->input->post('depcode'); + + $table="department"; + + $values=array('name'=>$depname, + 'code'=>$depcode, + //'created_on'=>date('Y-m-d'), + 'created_by'=>1, + 'status'=>1); + + $result=$this->Commonsql_model->insert_table($table,$values); + if($result) + { + $this->session->set_userdata('suc','successfully added'); + redirect('department'); + } + else + { + $this->session->set_userdata('err','Please try again'); + redirect('department'); + } + + } + } + + + function edit_department() + { + if($this->input->post('submit')) + { + + $depname=$this->input->post('depname'); + $depcode=$this->input->post('depcode'); + $primaryid=$this->input->post('hiddendepid'); + + $table="department"; + $where=array("dep_id"=>$primaryid); + $values=array('name'=>$depname, + 'code'=>$depcode, + //'updated_on'=>date('Y-m-d'), + 'update_by'=>1, + 'status'=>1); + + $result=$this->Commonsql_model->updateTable($table,$where,$values); + //echo $this->db->last_query();exit; + if($result) + + { + $this->session->set_userdata('suc','successfully Updated'); + redirect('department'); + } + else + { + $this->session->set_userdata('err','Please try again'); + redirect('department'); + } + //echo $this->db->last_query();exit; + } + //$this->load->view('department/department_list',$data); + } + + + function delete_department() + { + if($this->input->post('submit')) + { + + $primaryid=$this->input->post('hiddengffgdtpid'); + //echo $primaryid ; exit; + $table="department"; + $where=array("dep_id"=>$primaryid); + $values=array( + 'status'=>0); + + $result=$this->Commonsql_model->updateTable($table,$where,$values); + if($result) + { + $this->session->set_userdata('suc','successfully deleted'); + redirect('department'); + + } + else + { + $this->session->set_userdata('err','Please try again'); + redirect('department'); + } + + } + } +} diff --git a/application/controllers/Employee.php b/application/controllers/Employee.php new file mode 100644 index 0000000..fb7f387 --- /dev/null +++ b/application/controllers/Employee.php @@ -0,0 +1,149 @@ +load->model('Employee_model'); + $this->load->model('Commonsql_model'); + } + + public function listrole() + { + $this->load->view('roles/role_list'); + } + + public function employee_list() + { + + $data['emp']=$this->Employee_model->list_emp(); + + $this->load->view('employee/employee',$data); + } + public function add_list() + { + $this->load->view('add_emplayee/add'); + } + function add_employee() + { + + if($this->input->post('submit')) + { + $employeename=$this->input->post('employeename'); + $number=$this->input->post('number'); + $address=$this->input->post('address'); + $email=$this->input->post('email'); + $code=$this->input->post('code'); + $img=$this->input->post('img'); + $user=$this->input->post('User'); + $password=$this->input->post('Password'); + + + $table="employee"; + $values=array('name'=>$employeename, + 'mobilenumer'=>$number, + 'address'=>$address, + 'email'=>$email, + 'pincode'=>$code, + 'img'=>$img, + 'username'=>$user, + 'password'=>$password, + 'created_on'=>date('Y-m-d'), + 'created_by'=>1, + 'status'=>1); + $result=$this->Commonsql_model->insert_table($table,$values); + if($result) + { + $this->session->set_userdata('suc','successfully added'); + redirect('employee'); + + } + else + { + $this->session->set_userdata('err','Please try again'); + redirect('employee'); + } + + } + } + function editemployee($empid) + { + if($this->input->post('submit')) + { + $employeename=$this->input->post('employeename'); + $number=$this->input->post('mnumber'); + $address=$this->input->post('address'); + $email=$this->input->post('email'); + $code=$this->input->post('code'); + $img=$this->input->post('img'); + $user=$this->input->post('User'); + $password=$this->input->post('Password'); + $hiddenpass=$this->input->post('hiddenpass'); + if($password=="") + { + $newpassword=$hiddenpass; + } + else + { + $newpassword=md5($password); + } + $table="employee"; + $where=array("id"=>$empid); + $values=array('name'=>$employeename, + 'mobilenumer'=>$number, + 'address'=>$address, + 'email'=>$email, + 'pincode'=>$code, + 'username'=>$user, + 'password'=>$newpassword, + 'update_on'=>date('Y-m-d'), + 'update_by'=>1, + 'status'=>1); + + $result=$this->Commonsql_model->updateTable($table,$where,$values); + if($result) + { + $this->session->set_userdata('suc','successfully Updated'); + redirect('employee'); + + } + else + { + $this->session->set_userdata('err','Please try again'); + redirect('employee'); + } + + } + //echo "sdsd";exit; + $data['emp']=$this->Employee_model->get_emp($empid); + //echo $this->db->last_query();exit; + $this->load->view('add_emplayee/edit',$data); + } + + function deleted_employee() + { + if($this->input->post('submit')) + { + $empid=$this->input->post('hiddenpass'); + + $table="employee"; + $where=array("id"=>$empid); + $values=array( + 'status'=>0); + + $result=$this->Commonsql_model->updateTable($table,$where,$values); + if($result) + { + $this->session->set_userdata('suc','successfully deleted'); + redirect('employee'); + + } + else + { + $this->session->set_userdata('err','Please try again'); + redirect('employee'); + } + } + } +} diff --git a/application/controllers/Faculty.php b/application/controllers/Faculty.php new file mode 100644 index 0000000..4609d2a --- /dev/null +++ b/application/controllers/Faculty.php @@ -0,0 +1,166 @@ +load->model('Faculty_model'); + $this->load->model('Commonsql_model'); + + } + + /** + * Index Page for this controller. + * + * Maps to the following URL + * http://example.com/index.php/welcome + * - or - + * http://example.com/index.php/welcome/index + * - or - + * Since this controller is set as the default controller in + * config/routes.php, it's displayed at http://example.com/ + * + * So any other public methods not prefixed with an underscore will + * map to /index.php/welcome/ + * @see https://codeigniter.com/user_guide/general/urls.html + */ + public function faculty_list() + { + $data['fac']=$this->Faculty_model->list_fa(); + $this->load->view('faculty/faculty_list',$data); + + } + + + function add_faculty() + { + + $this->load->view('faculty/add_faculty'); + + if($this->input->post('submit')) + { + $faculty=$this->input->post('faculty'); + $name=$this->input->post('name'); + $email=$this->input->post('email'); + //$dob=$this->input->post('dob'); + $gender=$this->input->post('gender'); + $number=$this->input->post('number'); + $address=$this->input->post('address'); + $desi=$this->input->post('desigation'); + $f_img=$this->input->post('f_img'); + + $table="faculty"; + $values=array('code'=>$faculty, + 'name'=>$name, + 'email'=>$email, + //'dob'=>$dob, + 'gender'=>$gender, + 'mobile'=>$number, + 'address'=>$address, + 'desigation'=>$desi, + 'f_img'=>$f_img, + 'created_on'=>date('Y-m-d'), + 'created_by'=>1, + 'status'=>1); + $result=$this->Commonsql_model->insert_table($table,$values); + if($result) + { + $this->session->set_userdata('suc','successfully added'); + redirect('faculty'); + + } + else + { + $this->session->set_userdata('err','Please try again'); + redirect('faculty'); + } + + } + } + + + function edit_faculty($id) + { + + $data['fac']=$this->Faculty_model->get_fac($id); + $this->load->view('faculty/edit_faculty',$data); + + if($this->input->post('submit')) + { + $faculty=$this->input->post('faculty'); + $name=$this->input->post('name'); + $email=$this->input->post('email'); + //$dob=$this->input->post('dob'); + $gender=$this->input->post('gender'); + $number=$this->input->post('number'); + $address=$this->input->post('address'); + $desi=$this->input->post('desigation'); + $f_img=$this->input->post('f_img'); + + + $table="faculty"; + $where=array("id"=>$id); + $values=array('code'=>$faculty, + 'name'=>$name, + 'email'=>$email, + //'dob'=>$dob, + 'gender'=>$gender, + 'mobile'=>$number, + 'address'=>$address, + 'desigation'=>$desi, + 'f_img'=>$f_img, + 'update_on'=>date('Y-m-d'), + 'update_by'=>1, + 'status'=>1); + + $result=$this->Commonsql_model->updateTable($table,$where,$values); + if($result) + { + $this->session->set_userdata('suc','successfully Updated'); + redirect('faculty'); + + } + else + { + $this->session->set_userdata('err','Please try again'); + redirect('faculty'); + } + + } + //echo "sdsd";exit; + + //echo $this->db->last_query();exit; + + } + + function deleted_faculty() + { + if($this->input->post('submit')) + { + $id=$this->input->post('hiddenpass'); + + $table="faculty"; + $where=array("id"=>$id); + $values=array( + 'status'=>0); + + $result=$this->Commonsql_model->updateTable($table,$where,$values); + if($result) + { + $this->session->set_userdata('suc','successfully deleted'); + redirect('faculty'); + + } + else + { + $this->session->set_userdata('err','Please try again'); + redirect('faculty'); + } + } + } + + + +} diff --git a/application/controllers/Role.php b/application/controllers/Role.php new file mode 100644 index 0000000..3d62bb5 --- /dev/null +++ b/application/controllers/Role.php @@ -0,0 +1,113 @@ +load->model('Role_model'); + $this->load->model('Commonsql_model'); + + } + + public function listrole() + { + $data['rol']=$this->Role_model->list_rol(); + $this->load->view('roles/role_list',$data); + } + function addrole() + { + if($this->input->post('submit')) + { + $role=$this->input->post('rolename'); + + $table="role"; + + $values=array('name'=>$role, + 'created_on'=>date('Y-m-d'), + 'created_by'=>1, + 'status'=>1); + + $result=$this->Commonsql_model->insert_table($table,$values); + if($result) + { + $this->session->set_userdata('suc','successfully added'); + redirect('roles'); + } + else + { + $this->session->set_userdata('err','Please try again'); + redirect('roles'); + } + + } + } + function editrole() + { + if($this->input->post('submit')) + { + $rolename=$this->input->post('rolename'); + $primaryid=$this->input->post('hiddenroleid'); + + $table="role"; + $where=array("role_id"=>$primaryid); + $values=array('name'=>$rolename, + 'updated_on'=>date('Y-m-d'), + 'updated_by'=>1, + 'status'=>1); + + $result=$this->Commonsql_model->updateTable($table,$where,$values); + //echo $this->db->last_query();exit; + if($result) + { + $this->session->set_userdata('suc','successfully Updated'); + redirect('roles'); + } + else + { + $this->session->set_userdata('err','Please try again'); + redirect('roles'); + } + //echo $this->db->last_query();exit; + } + $this->load->view('roles/role_list',$data); + } + function deleterole() + { + if($this->input->post('submit')) + { + + $primaryid=$this->input->post('hiddengffgdtpid'); + //echo $primaryid ; exit; + $table="role"; + $where=array("role_id"=>$primaryid); + $values=array( + 'status'=>0); + + $result=$this->Commonsql_model->updateTable($table,$where,$values); + if($result) + { + $this->session->set_userdata('suc','successfully deleted'); + redirect('roles'); + + } + else + { + $this->session->set_userdata('err','Please try again'); + redirect('roles'); + } + + } + } + + +//profile start// +public function profile_list() + { + //$data['rol']=$this->Role_model->list_rol(); + $this->load->view('profile'); + } + + + +} diff --git a/application/controllers/Semester.php b/application/controllers/Semester.php new file mode 100644 index 0000000..55e6b2b --- /dev/null +++ b/application/controllers/Semester.php @@ -0,0 +1,141 @@ +load->model('Semester_model'); + $this->load->model('Commonsql_model'); + + } + + /** + * Index Page for this controller. + * + * Maps to the following URL + * http://example.com/index.php/welcome + * - or - + * http://example.com/index.php/welcome/index + * - or - + * Since this controller is set as the default controller in + * config/routes.php, it's displayed at http://example.com/ + * + * So any other public methods not prefixed with an underscore will + * map to /index.php/welcome/ + * @see https://codeigniter.com/user_guide/general/urls.html + */ + public function semester_list() + { + $data['sem']=$this->Semester_model->list_sem(); + $this->load->view('semester/semester_list',$data); + } + + + function add_semester() + { + + $this->load->view('semester/add_semester'); + + if($this->input->post('submit')) + { + $name=$this->input->post('name'); + $hod=$this->input->post('hod'); + $staff=$this->input->post('staff'); + + $table="semester"; + $values=array('name'=>$name, + 'hod'=>$hod, + 'staff'=>$staff, + 'created_on'=>date('Y-m-d'), + 'created_by'=>1, + 'status'=>1); + $result=$this->Commonsql_model->insert_table($table,$values); + if($result) + { + $this->session->set_userdata('suc','successfully added'); + redirect('semester'); + + } + else + { + $this->session->set_userdata('err','Please try again'); + redirect('semester'); + } + + } + } + + + function edit_semester($id) + { + + $data['sem']=$this->Semester_model->get_sem($id); + $this->load->view('semester/edit_semester',$data); + + if($this->input->post('submit')) + { + $name=$this->input->post('name'); + $hod=$this->input->post('hod'); + $staff=$this->input->post('staff'); + + + $table="semester"; + $where=array("id"=>$id); + $values=array('name'=>$name, + 'hod'=>$hod, + 'staff'=>$staff, + //'update_on'=>date('Y-m-d'), + // 'update_by'=>1, + 'status'=>1); + + $result=$this->Commonsql_model->updateTable($table,$where,$values); + if($result) + { + $this->session->set_userdata('suc','successfully Updated'); + redirect('semester'); + + } + else + { + $this->session->set_userdata('err','Please try again'); + redirect('semester'); + } + + } + //echo "sdsd";exit; + + //echo $this->db->last_query();exit; + + } + + function deleted_semester() + { + if($this->input->post('submit')) + { + $id=$this->input->post('hiddenpass'); + + $table="semester"; + $where=array("id"=>$id); + $values=array( + 'status'=>0); + + $result=$this->Commonsql_model->updateTable($table,$where,$values); + if($result) + { + $this->session->set_userdata('suc','successfully deleted'); + redirect('semester'); + + } + else + { + $this->session->set_userdata('err','Please try again'); + redirect('semester'); + } + } + } + + + +} diff --git a/application/controllers/Student.php b/application/controllers/Student.php new file mode 100644 index 0000000..d169104 --- /dev/null +++ b/application/controllers/Student.php @@ -0,0 +1,153 @@ +load->model('Student_model'); + $this->load->model('Commonsql_model'); + + } + + /** + * Index Page for this controller. + * + * Maps to the following URL + * http://example.com/index.php/welcome + * - or - + * http://example.com/index.php/welcome/index + * - or - + * Since this controller is set as the default controller in + * config/routes.php, it's displayed at http://example.com/ + * + * So any other public methods not prefixed with an underscore will + * map to /index.php/welcome/ + * @see https://codeigniter.com/user_guide/general/urls.html + */ + public function Student_list() + { + $data['stu']=$this->Student_model->list_stu(); + $this->load->view('student/Student_list',$data); + } + + + function add_student() + { + + $this->load->view('student/add_student'); + + if($this->input->post('submit')) + { + $name=$this->input->post('name'); + $number=$this->input->post('number'); + $address=$this->input->post('address'); + $department=$this->input->post('department'); + $gender=$this->input->post('gender'); + $s_img=$this->input->post('s_img'); + + $table="student"; + $values=array('name'=>$name, + 'number'=>$number, + 'address'=>$address, + 'department'=>$department, + 'gender'=>$gender, + 's_img'=>$s_img, + 'created_on'=>date('Y-m-d'), + 'created_by'=>1, + 'status'=>1); + $result=$this->Commonsql_model->insert_table($table,$values); + if($result) + { + $this->session->set_userdata('suc','successfully added'); + redirect('student'); + + } + else + { + $this->session->set_userdata('err','Please try again'); + redirect('student'); + } + + } + } + + + function edit_student($id) + { + + $data['stu']=$this->Student_model->get_stu($id); + $this->load->view('student/edit_student',$data); + + if($this->input->post('submit')) + { + $name=$this->input->post('name'); + $number=$this->input->post('number'); + $address=$this->input->post('address'); + $department=$this->input->post('department'); + $gender=$this->input->post('gender'); + $s_img=$this->input->post('s_img'); + + + $table="student"; + $where=array("id"=>$id); + $values=array('name'=>$name, + 'number'=>$number, + 'address'=>$address, + 'department'=>$department, + 'gender'=>$gender, + 's_img'=>$s_img, + //'update_on'=>date('Y-m-d'), + // 'update_by'=>1, + 'status'=>1); + + $result=$this->Commonsql_model->updateTable($table,$where,$values); + if($result) + { + $this->session->set_userdata('suc','successfully Updated'); + redirect('student'); + + } + else + { + $this->session->set_userdata('err','Please try again'); + redirect('student'); + } + + } + //echo "sdsd";exit; + + //echo $this->db->last_query();exit; + + } + + function deleted_student() + { + if($this->input->post('submit')) + { + $id=$this->input->post('hiddenpass'); + + $table="student"; + $where=array("id"=>$id); + $values=array( + 'status'=>0); + + $result=$this->Commonsql_model->updateTable($table,$where,$values); + if($result) + { + $this->session->set_userdata('suc','successfully deleted'); + redirect('student'); + + } + else + { + $this->session->set_userdata('err','Please try again'); + redirect('student'); + } + } + } + + + +} diff --git a/application/controllers/Subject.php b/application/controllers/Subject.php new file mode 100644 index 0000000..150eac3 --- /dev/null +++ b/application/controllers/Subject.php @@ -0,0 +1,148 @@ +load->model('Subject_model'); + $this->load->model('Commonsql_model'); + + } + + /** + * Index Page for this controller. + * + * Maps to the following URL + * http://example.com/index.php/welcome + * - or - + * http://example.com/index.php/welcome/index + * - or - + * Since this controller is set as the default controller in + * config/routes.php, it's displayed at http://example.com/ + * + * So any other public methods not prefixed with an underscore will + * map to /index.php/welcome/ + * @see https://codeigniter.com/user_guide/general/urls.html + */ + public function subject_list() + { + $data['sub']=$this->Subject_model->list_sub(); + $this->load->view('subject/subject_list',$data); + } + +function add_subject() + { + + $this->load->view('subject/add_subject'); + + if($this->input->post('submit')) + { + $code=$this->input->post('code'); + $sub=$this->input->post('subject'); + $dep=$this->input->post('department'); + $semester=$this->input->post('semester'); + + $table="subject"; + $values=array('code'=>$code, + 'subject'=>$sub, + 'department'=>$dep, + 'semester'=>$semester, + 'created_on'=>date('Y-m-d'), + 'created_by'=>1, + 'status'=>1); + $result=$this->Commonsql_model->insert_table($table,$values); + if($result) + { + $this->session->set_userdata('suc','successfully added'); + redirect('subject'); + + } + else + { + $this->session->set_userdata('err','Please try again'); + redirect('subject'); + } + + } + } + + + + function edit_subject($id) + { + + $data['sub']=$this->Subject_model->get_sub($id); + //echo $this->db->last_query();exit; + $this->load->view('subject/edit_subject',$data); + + if($this->input->post('submit')) + { + + $code=$this->input->post('code'); + $sub=$this->input->post('subject'); + $dep=$this->input->post('department'); + $semester=$this->input->post('semester'); + + $table="subject"; + $where=array("id"=>$id); + $values=array('code'=>$code, + 'subject'=>$sub, + 'department'=>$dep, + 'semester'=>$semester, + 'updated_on'=>date('Y-m-d'), + //'update_by'=>1, + 'status'=>1); + + $result=$this->Commonsql_model->updateTable($table,$where,$values); + //echo $this->db->last_query();exit; + if($result) + + { + $this->session->set_userdata('suc','successfully Updated'); + redirect('subject'); + } + else + { + $this->session->set_userdata('err','Please try again'); + redirect('subject'); + } + + } + + } + + + + function deleted_subject() + { + if($this->input->post('submit')) + { + $id=$this->input->post('hiddenpass'); + + $table="subject"; + $where=array("id"=>$id); + $values=array( + 'status'=>0); + + $result=$this->Commonsql_model->updateTable($table,$where,$values); + if($result) + { + $this->session->set_userdata('suc','successfully deleted'); + redirect('subject'); + + } + else + { + $this->session->set_userdata('err','Please try again'); + redirect('subject'); + } + } + } + + + + + +} diff --git a/application/controllers/Welcome.php b/application/controllers/Welcome.php new file mode 100644 index 0000000..772ffff --- /dev/null +++ b/application/controllers/Welcome.php @@ -0,0 +1,64 @@ +load->model('Common_model'); + } + + /** + * Index Page for this controller. + * + * Maps to the following URL + * http://example.com/index.php/welcome + * - or - + * http://example.com/index.php/welcome/index + * - or - + * Since this controller is set as the default controller in + * config/routes.php, it's displayed at http://example.com/ + * + * So any other public methods not prefixed with an underscore will + * map to /index.php/welcome/ + * @see https://codeigniter.com/user_guide/general/urls.html + */ + public function index() + { + $this->load->view('login'); + } + public function dashboard() + { + $this->load->view('dashboard'); + } + public function admin_login() + { + + $username=$this->input->post('username'); + $password=$this->input->post('password'); + + $check=$this->Common_model->get_login_detail($username,$password); + + if($check->num_rows()>0) + { + + $ch =$check->row(); + //$usertype=$ch->user_type; + //$this->session->set_userdata('user_type',$ch->user_type); + $this->session->set_userdata('username',$ch->username); + $this->session->set_userdata('id',$ch->id); + $this->session->set_userdata('suc',' Successfully Logged in..!'); + if($usertype!=2){ + redirect('dashboard');} + else{ + redirect('dashboard');} + } + else + { + $this->session->set_userdata('err','The username or password is incorrect.'); + redirect('dashboard'); + } + + } + +} diff --git a/application/controllers/index.html b/application/controllers/index.html new file mode 100644 index 0000000..b702fbc --- /dev/null +++ b/application/controllers/index.html @@ -0,0 +1,11 @@ + + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + diff --git a/application/core/index.html b/application/core/index.html new file mode 100644 index 0000000..b702fbc --- /dev/null +++ b/application/core/index.html @@ -0,0 +1,11 @@ + + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + diff --git a/application/fonts/fontawesome-webfont3e6e.eot b/application/fonts/fontawesome-webfont3e6e.eot new file mode 100644 index 0000000..e9f60ca Binary files /dev/null and b/application/fonts/fontawesome-webfont3e6e.eot differ diff --git a/application/fonts/fontawesome-webfont3e6e.svg b/application/fonts/fontawesome-webfont3e6e.svg new file mode 100644 index 0000000..855c845 --- /dev/null +++ b/application/fonts/fontawesome-webfont3e6e.svg @@ -0,0 +1,2671 @@ + + + + +Created by FontForge 20120731 at Mon Oct 24 17:37:40 2016 + By ,,, +Copyright Dave Gandy 2016. All rights reserved. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/fonts/fontawesome-webfont3e6e.ttf b/application/fonts/fontawesome-webfont3e6e.ttf new file mode 100644 index 0000000..35acda2 Binary files /dev/null and b/application/fonts/fontawesome-webfont3e6e.ttf differ diff --git a/application/fonts/fontawesome-webfont3e6e.woff b/application/fonts/fontawesome-webfont3e6e.woff new file mode 100644 index 0000000..400014a Binary files /dev/null and b/application/fonts/fontawesome-webfont3e6e.woff differ diff --git a/application/fonts/fontawesome-webfont3e6e.woff2 b/application/fonts/fontawesome-webfont3e6e.woff2 new file mode 100644 index 0000000..4d13fc6 Binary files /dev/null and b/application/fonts/fontawesome-webfont3e6e.woff2 differ diff --git a/application/fonts/fontawesome-webfontd41d.eot b/application/fonts/fontawesome-webfontd41d.eot new file mode 100644 index 0000000..e9f60ca Binary files /dev/null and b/application/fonts/fontawesome-webfontd41d.eot differ diff --git a/application/helpers/index.html b/application/helpers/index.html new file mode 100644 index 0000000..b702fbc --- /dev/null +++ b/application/helpers/index.html @@ -0,0 +1,11 @@ + + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + diff --git a/application/hooks/index.html b/application/hooks/index.html new file mode 100644 index 0000000..b702fbc --- /dev/null +++ b/application/hooks/index.html @@ -0,0 +1,11 @@ + + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + diff --git a/application/index.html b/application/index.html new file mode 100644 index 0000000..b702fbc --- /dev/null +++ b/application/index.html @@ -0,0 +1,11 @@ + + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + diff --git a/application/language/english/index.html b/application/language/english/index.html new file mode 100644 index 0000000..b702fbc --- /dev/null +++ b/application/language/english/index.html @@ -0,0 +1,11 @@ + + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + diff --git a/application/language/index.html b/application/language/index.html new file mode 100644 index 0000000..b702fbc --- /dev/null +++ b/application/language/index.html @@ -0,0 +1,11 @@ + + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + diff --git a/application/libraries/index.html b/application/libraries/index.html new file mode 100644 index 0000000..b702fbc --- /dev/null +++ b/application/libraries/index.html @@ -0,0 +1,11 @@ + + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + diff --git a/application/models/Common_model.php b/application/models/Common_model.php new file mode 100644 index 0000000..0ddf672 --- /dev/null +++ b/application/models/Common_model.php @@ -0,0 +1,127 @@ + + * @version 0.0.0 + */ +if (!defined('BASEPATH')) + exit('No direct script access allowed'); + +class Common_model extends CI_Model { + + public function __construct() { + parent::__construct(); + } + + /* + * Add a new user to the system + * $tableName -> Name of the table + * $tableData -> Array -> Table data + */ + + function insert_table($tableName, $tableData = array()) { + // Insert the user record + if (isset($tableData) && count($tableData) > 0) { + $this->db->insert($tableName, $tableData); + return $this->db->insert_id(); + //echo $this->db->last_query(); exit; + } + return false; + } + + /* get the data to table + * $tableName -> Name of the table + * $whereData -> Array -> where fields + * $showField -> Array -> what are the fields need to show + * */ + + public function selectTable($tableName, $whereData = array(), $showField = array('*'), $orWhereData = array(), $group = array(), $order = '', $having = '', $limit = array(), $result_way = 'all', $echo = 0,$inWhereData = array(),$notInWhereData = array()) { + + $this->db->select($showField); + $this->db->from($tableName); + if (!empty($whereData) > 0) { + $this->db->where($whereData); + } + if (isset($orWhereData) && !empty($orWhereData)) { + $this->db->or_where($orWhereData); + } + if (isset($inWhereData) && !empty($inWhereData)) { + $this->db->where_in($inWhereData[0],$inWhereData[1]); + } + if (isset($notInWhereData) && !empty($notInWhereData)) { + $this->db->where_not_in($notInWhereData[0],$notInWhereData[1]); + } + if (!empty($group)) { + $this->db->group_by($group); + } + if ($order != '') { + $this->db->order_by($order,"DESC"); + } + /*if (count($limit>0)) { + //$this->db->limit($limit[0],$limit[1]);//example $limit[0] = "0,10" where 0 is for offset and 10 for limit + }*/ + $query = $this->db->get(); + + return $query; + } + + + /* update the data to table + * $tableName -> Name of the table + * $whereData -> Array -> where fields + * $updateData -> Array -> updated fields and data + * */ + + public function updateTable($tableName, $whereData = array(), $updateData = array()) { + $this->db->where($whereData); + $this->db->update($tableName, $updateData); + $return = $this->db->affected_rows() > 0; + return $return; + //$query->result_array(); + //$query->num_rows(); + } + + /* update the data to table + * $tableName -> Name of the table + * $whereData -> Array -> where fields + * $updateData -> Array -> updated fields and data + * */ + + public function deleteTableData($tableName, $whereData = array()) { + // Insert the user record + if (isset($whereData) && count($whereData) > 0) { + $insert_id = $this->db->delete($tableName, $whereData); + return true; + } + return false; + } + + +public function get_login_detail($username,$password) +{ + $this->db->select('*'); + $this->db->from('user'); + $this->db->where('username',$username); + $this->db->where(array('password'=>md5($password),'status'=>1)); + $query = $this->db->get(); + return $query; + +} + + + /* + * get a chat user to the system + */ + + + + + +} + +/* End of file user_groups.php */ +/* Location: ./application/models/user_groups.php */ \ No newline at end of file diff --git a/application/models/Commonsql_model.php b/application/models/Commonsql_model.php new file mode 100644 index 0000000..386dc17 --- /dev/null +++ b/application/models/Commonsql_model.php @@ -0,0 +1,76 @@ + 0) { + $this->db->insert($tableName, $tableData); + return $this->db->insert_id(); + } + return false; + } + + /* get the data to table + * $tableName -> Name of the table + * $whereData -> Array -> where fields + * $showField -> Array -> what are the fields need to show + * */ + + public function selectTable($tableName, $whereData = array(), $showField = array('*'), $order = '') { + + $this->db->select($showField); + $this->db->from($tableName); + if (!empty($whereData) > 0) { + $this->db->where($whereData); + } + if ($order != '') { + $this->db->order_by($order,"DESC"); + } + /*if (count($limit>0)) { + //$this->db->limit($limit[0],$limit[1]);//example $limit[0] = "0,10" where 0 is for offset and 10 for limit + }*/ + $query = $this->db->get(); + + return $query; + } + + + /* update the data to table + * $tableName -> Name of the table + * $whereData -> Array -> where fields + * $updateData -> Array -> updated fields and data + * */ + + public function updateTable($tableName, $whereData = array(), $updateData = array()) { + $this->db->where($whereData); + $this->db->update($tableName, $updateData); + $return = $this->db->affected_rows() > 0; + return $return; + //$query->result_array(); + //$query->num_rows(); + } + + /* update the data to table + * $tableName -> Name of the table + * $whereData -> Array -> where fields + * $updateData -> Array -> updated fields and data + * */ + + public function deleteTableData($tableName, $whereData = array()) { + // Insert the user record + if (isset($whereData) && count($whereData) > 0) { + $insert_id = $this->db->delete($tableName, $whereData); + return true; + } + return false; + } + + +} diff --git a/application/models/Department_model.php b/application/models/Department_model.php new file mode 100644 index 0000000..da3a074 --- /dev/null +++ b/application/models/Department_model.php @@ -0,0 +1,21 @@ +db->select('*'); + $this->db->from('department'); + $this->db->where(array('status'=>1)); + $query = $this->db->get(); + //echo $this->db->last_query();exit; + return $query; + } + +} diff --git a/application/models/Employee_model.php b/application/models/Employee_model.php new file mode 100644 index 0000000..cbf9031 --- /dev/null +++ b/application/models/Employee_model.php @@ -0,0 +1,30 @@ +db->select('*'); + $this->db->from('employee'); + $this->db->where(array('status'=>1)); + $query = $this->db->get(); + //echo $this->db->last_query();exit; + return $query; + } + function get_emp($id) + { + $this->db->select('*'); + $this->db->from('employee'); + $this->db->where(array('status'=>1,'id'=>$id)); + $query = $this->db->get(); + //echo $this->db->last_query();exit; + return $query; + } + +} diff --git a/application/models/Faculty.php b/application/models/Faculty.php new file mode 100644 index 0000000..4e548ef --- /dev/null +++ b/application/models/Faculty.php @@ -0,0 +1,31 @@ +db->select('*'); + $this->db->from('Semester'); + $this->db->where(array('status'=>1)); + $query = $this->db->get(); + //echo $this->db->last_query();exit; + return $query; + } + + function get_sem($id) + { + $this->db->select('*'); + $this->db->from('semester'); + $this->db->where(array('status'=>1,'id'=>$id)); + $query = $this->db->get(); + //echo $this->db->last_query();exit; + return $query; + } + +} diff --git a/application/models/Faculty_model.php b/application/models/Faculty_model.php new file mode 100644 index 0000000..1de75b8 --- /dev/null +++ b/application/models/Faculty_model.php @@ -0,0 +1,31 @@ +db->select('*'); + $this->db->from('faculty'); + $this->db->where(array('status'=>1)); + $query = $this->db->get(); + //echo $this->db->last_query();exit; + return $query; + } + + function get_fac($id) + { + $this->db->select('*'); + $this->db->from('faculty'); + $this->db->where(array('status'=>1,'id'=>$id)); + $query = $this->db->get(); + //echo $this->db->last_query();exit; + return $query; + } + +} diff --git a/application/models/Role.php b/application/models/Role.php new file mode 100644 index 0000000..83f6689 --- /dev/null +++ b/application/models/Role.php @@ -0,0 +1,21 @@ +db->select('*'); + $this->db->from('role'); + $this->db->where(array('status'=>1)); + $query = $this->db->get(); + //echo $this->db->last_query();exit; + return $query; + } + +} diff --git a/application/models/Role_model.php b/application/models/Role_model.php new file mode 100644 index 0000000..cae9510 --- /dev/null +++ b/application/models/Role_model.php @@ -0,0 +1,21 @@ +db->select('*'); + $this->db->from('role'); + $this->db->where(array('status'=>1)); + $query = $this->db->get(); + //echo $this->db->last_query();exit; + return $query; + } + +} diff --git a/application/models/Semester_model.php b/application/models/Semester_model.php new file mode 100644 index 0000000..4e548ef --- /dev/null +++ b/application/models/Semester_model.php @@ -0,0 +1,31 @@ +db->select('*'); + $this->db->from('Semester'); + $this->db->where(array('status'=>1)); + $query = $this->db->get(); + //echo $this->db->last_query();exit; + return $query; + } + + function get_sem($id) + { + $this->db->select('*'); + $this->db->from('semester'); + $this->db->where(array('status'=>1,'id'=>$id)); + $query = $this->db->get(); + //echo $this->db->last_query();exit; + return $query; + } + +} diff --git a/application/models/Student_model.php b/application/models/Student_model.php new file mode 100644 index 0000000..080c0e3 --- /dev/null +++ b/application/models/Student_model.php @@ -0,0 +1,31 @@ +db->select('*'); + $this->db->from('student'); + $this->db->where(array('status'=>1)); + $query = $this->db->get(); + //echo $this->db->last_query();exit; + return $query; + } + + function get_stu($id) + { + $this->db->select('*'); + $this->db->from('student'); + $this->db->where(array('status'=>1,'id'=>$id)); + $query = $this->db->get(); + //echo $this->db->last_query();exit; + return $query; + } + +} diff --git a/application/models/Subject_model.php b/application/models/Subject_model.php new file mode 100644 index 0000000..55c8d63 --- /dev/null +++ b/application/models/Subject_model.php @@ -0,0 +1,31 @@ +db->select('*'); + $this->db->from('subject'); + $this->db->where(array('status'=>1)); + $query = $this->db->get(); + //echo $this->db->last_query();exit; + return $query; + } + + function get_sub($id) + { + $this->db->select('*'); + $this->db->from('subject'); + $this->db->where(array('status'=>1,'id'=>$id)); + $query = $this->db->get(); + //echo $this->db->last_query();exit; + return $query; + } + +} diff --git a/application/models/index.html b/application/models/index.html new file mode 100644 index 0000000..b702fbc --- /dev/null +++ b/application/models/index.html @@ -0,0 +1,11 @@ + + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + diff --git a/application/third_party/index.html b/application/third_party/index.html new file mode 100644 index 0000000..b702fbc --- /dev/null +++ b/application/third_party/index.html @@ -0,0 +1,11 @@ + + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + diff --git a/application/views/add_emplayee/add.php b/application/views/add_emplayee/add.php new file mode 100644 index 0000000..ba0cc03 --- /dev/null +++ b/application/views/add_emplayee/add.php @@ -0,0 +1,130 @@ + +load->view('includes/header');?> +
+ + load->view('includes/sidebar');?> + +
+
+
+
+
+
Add Employee
+
+ +
+
+ +
+
+
+
+
Employee
+
+
+
+
+
+ +
+ +
+
+
+ +
+
+
+
+ +
+ +
+
+ + +
+ +
+
+ + + + +
+
+
+ + +
+ +
+ +
+
+
+ +
+ +
+
+ + +
+ +
+
+
+
+ +
+
+
+
+
+
+
+ + +
+
+
+
+
+
+
+
+
+
+ +
+ + + + + + load->view('includes/footer');?> \ No newline at end of file diff --git a/application/views/add_emplayee/edit.php b/application/views/add_emplayee/edit.php new file mode 100644 index 0000000..1b06a00 --- /dev/null +++ b/application/views/add_emplayee/edit.php @@ -0,0 +1,168 @@ + +load->view('includes/header');?> + +
+ load->view('includes/sidebar');?> +
+
+
+
+
+
Edit Employee
+
+ +
+
+ + num_rows()>0) + { + $e=$emp->row(); + $eid=$e->id; + $name=$e->name; + $mobilenumer=$e->mobilenumer; + $email=$e->email; + $img=$e->img; + $address=$e->address; + $pincode=$e->pincode; + $username=$e->username; + $password=$e->password; + } ?> + +
+
+
+
+
Edit Employee
+
+
+
+
+
+ +
+ +
+
+
+ +
+
+
+
+ +
+ +
+
+ + +
+ +
+
+ + + + +
+
+
+ + + +
+ +
+ +
+
+ +
+ +
+ +
+
+
+ +
+
+
+
+ +
+
+ +
+
+
+
+
+ + +
+
+
+
+
+
+
+
+
+
+ +
+ + + load->view('includes/footer');?> \ No newline at end of file diff --git a/application/views/dashboard.php b/application/views/dashboard.php new file mode 100644 index 0000000..9435367 --- /dev/null +++ b/application/views/dashboard.php @@ -0,0 +1,534 @@ +load->view('includes/header');?> + + +
+ load->view('includes/sidebar');?> + + +
+
+
+
+
+
Dashboard
+
+ +
+
+ +
+
+
+
+ group +
+ Total Students + 450 + +
+ +
+ +
+ +
+
+ person +
+ Total Faculties + 90 +
+ +
+ +
+ +
+
+ content_cut +
+ Total Subjects + 52 +
+ +
+ +
+ +
+
+ monetization_on +
+ Total Courses + 5 +
+ +
+ +
+ +
+
+ + +
+
+
+
+
Projects
+
+ + + +
+
+
+
+ +
+
+
+
+ +
+ +
+
+
+
+
+ +
+
+ + +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
S.NoDateProject NameSubjectStudent NameActions
+ 1 + 12/05/2016 + Test 1 + English + Dr.Rajesh + +
+ + +
+
+ 2 + 12/05/2016 Test 2 English + Dr.Sarah Smith + +
+ + +
+
+ 3 + 12/05/2016 Test 3 English + Dr.Rajesh + +
+ + +
+
+ 4 + 12/05/2016 Test 3 English + Dr.Megha Trivedi + +
+ + +
+
+ 5 + 12/05/2016 Test 4 English + Dr.Sarah Smith + +
+ + +
+
+ 6 + 12/05/2016 Test 5 English + Dr.Megha Trivedi + +
+ + +
+
+
+
+
+
+ +
+ +
+
+ + +
+
+ +
+ +
+
+
+
+
Online
+
+
    +
  • ... + +
    +
    John Deo
    +
    Spine Surgeon
    +
    +
  • +
  • +
    + 5 +
    ... + +
    +
    Rajesh
    +
    Director
    +
    +
  • +
  • ... + +
    +
    Jacob Ryan
    +
    Ortho Surgeon
    +
    +
  • +
  • +
    + 8 +
    ... + +
    +
    Kehn Anderson
    +
    CEO
    +
    +
  • +
  • ... + +
    +
    Sarah Smith
    +
    Anaesthetics
    +
    +
  • +
  • ... + +
    +
    Vlad Cardella
    +
    Cardiologist
    +
    +
  • +
+
+
Offline
+
+
    +
  • +
    + 4 +
    ... + +
    +
    Jennifer Maklen
    +
    Nurse
    +
    Last seen 01:20 AM
    +
    +
  • +
  • ... + +
    +
    Lina Smith
    +
    Ortho Surgeon
    +
    Last seen 11:14 PM
    +
    +
  • +
  • +
    + 9 +
    ... + +
    +
    Jeff Adam
    +
    Compounder
    +
    Last seen 3:31 PM
    +
    +
  • +
  • ... + +
    +
    Anjelina Cardella
    +
    Physiotherapist
    +
    Last seen 7:45 PM
    +
    +
  • +
+
+
+ +
+ + +
+
+
+
Layout Settings
+
+
+
+
+
Sidebar Position
+
+ +
+
+
+
Header
+
+ +
+
+ +
+
Footer
+
+ +
+
+
+
+
Account Settings
+
+
+
+
Notifications
+
+
+ +
+
+
+
+
Show Online
+
+
+ +
+
+
+
+
Status
+
+
+ +
+
+
+
+
2 Steps Verification
+
+
+ +
+
+
+
+
+
General Settings
+
+
+
+
Location
+
+
+ +
+
+
+
+
Save Histry
+
+
+ +
+
+
+
+
Auto Updates
+
+
+ +
+
+
+
+
+
+
+
+
+
+ +
+ + + load->view('includes/footer');?> \ No newline at end of file diff --git a/application/views/department/department_list.php b/application/views/department/department_list.php new file mode 100644 index 0000000..352e764 --- /dev/null +++ b/application/views/department/department_list.php @@ -0,0 +1,248 @@ + + +load->view('includes/header');?> + +
+ + load->view('includes/sidebar');?> + +
+
+
+
+
+
Department List
+
+ +
+
+ load->view('includes/msg');?> +
+
+
+
+
+
+
+ +
+
+ +
+
+ + + + + + + + + + + num_rows()>0) + { + $i=1; + foreach($dep->result() as $r) + { + + //$id=$r->id; + $dep_id=$r->dep_id; + $depname=$r->name; + $depcode=$r->code; + //echo $dep_id; exit; + ?> + + + + + + + + + + +
S.No Name Code Action
+ + + + + + + + +
+
+ +
+
+
+
+ +
+
+
+ + + + + + + + load->view('includes/footer');?> + + + + + + \ No newline at end of file diff --git a/application/views/employee/employee.php b/application/views/employee/employee.php new file mode 100644 index 0000000..fd14c18 --- /dev/null +++ b/application/views/employee/employee.php @@ -0,0 +1,146 @@ + + +load->view('includes/header');?> + +
+ + load->view('includes/sidebar');?> + +
+
+
+
+
+
Employee List
+
+ +
+
+ load->view('includes/msg');?> +
+
+
+
+
+
+
+ +
+
+ +
+
+ + + + + + + + + + + + + + num_rows()>0) + { + $i=1; + foreach($emp->result() as $e) + { + $eid=$e->id; + $name=$e->name; + $mobilenumer=$e->mobilenumer; + $email=$e->email; + $img=$e->img; + $address=$e->address; + ?> + + + + + + + + + + + + +
S. No Name Mobile Number Email Address Action
+ + + + + + + + +
+
+
+
+
+
+
+
+
+ + + + load->view('includes/footer');?> + + + + + \ No newline at end of file diff --git a/application/views/errors/cli/error_404.php b/application/views/errors/cli/error_404.php new file mode 100644 index 0000000..6984b61 --- /dev/null +++ b/application/views/errors/cli/error_404.php @@ -0,0 +1,8 @@ + + +An uncaught Exception was encountered + +Type: +Message: +Filename: getFile(), "\n"; ?> +Line Number: getLine(); ?> + + + +Backtrace: +getTrace() as $error): ?> + + File: + Line: + Function: + + + + diff --git a/application/views/errors/cli/error_general.php b/application/views/errors/cli/error_general.php new file mode 100644 index 0000000..6984b61 --- /dev/null +++ b/application/views/errors/cli/error_general.php @@ -0,0 +1,8 @@ + + +A PHP Error was encountered + +Severity: +Message: +Filename: +Line Number: + + + +Backtrace: + + + File: + Line: + Function: + + + + diff --git a/application/views/errors/cli/index.html b/application/views/errors/cli/index.html new file mode 100644 index 0000000..b702fbc --- /dev/null +++ b/application/views/errors/cli/index.html @@ -0,0 +1,11 @@ + + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + diff --git a/application/views/errors/html/error_404.php b/application/views/errors/html/error_404.php new file mode 100644 index 0000000..756ea9d --- /dev/null +++ b/application/views/errors/html/error_404.php @@ -0,0 +1,64 @@ + + + + +404 Page Not Found + + + +
+

+ +
+ + \ No newline at end of file diff --git a/application/views/errors/html/error_db.php b/application/views/errors/html/error_db.php new file mode 100644 index 0000000..f5a43f6 --- /dev/null +++ b/application/views/errors/html/error_db.php @@ -0,0 +1,64 @@ + + + + +Database Error + + + +
+

+ +
+ + \ No newline at end of file diff --git a/application/views/errors/html/error_exception.php b/application/views/errors/html/error_exception.php new file mode 100644 index 0000000..8784886 --- /dev/null +++ b/application/views/errors/html/error_exception.php @@ -0,0 +1,32 @@ + + +
+ +

An uncaught Exception was encountered

+ +

Type:

+

Message:

+

Filename: getFile(); ?>

+

Line Number: getLine(); ?>

+ + + +

Backtrace:

+ getTrace() as $error): ?> + + + +

+ File:
+ Line:
+ Function: +

+ + + + + + +
\ No newline at end of file diff --git a/application/views/errors/html/error_general.php b/application/views/errors/html/error_general.php new file mode 100644 index 0000000..fc3b2eb --- /dev/null +++ b/application/views/errors/html/error_general.php @@ -0,0 +1,64 @@ + + + + +Error + + + +
+

+ +
+ + \ No newline at end of file diff --git a/application/views/errors/html/error_php.php b/application/views/errors/html/error_php.php new file mode 100644 index 0000000..b146f9c --- /dev/null +++ b/application/views/errors/html/error_php.php @@ -0,0 +1,33 @@ + + +
+ +

A PHP Error was encountered

+ +

Severity:

+

Message:

+

Filename:

+

Line Number:

+ + + +

Backtrace:

+ + + + +

+ File:
+ Line:
+ Function: +

+ + + + + + + +
\ No newline at end of file diff --git a/application/views/errors/html/index.html b/application/views/errors/html/index.html new file mode 100644 index 0000000..b702fbc --- /dev/null +++ b/application/views/errors/html/index.html @@ -0,0 +1,11 @@ + + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + diff --git a/application/views/errors/index.html b/application/views/errors/index.html new file mode 100644 index 0000000..b702fbc --- /dev/null +++ b/application/views/errors/index.html @@ -0,0 +1,11 @@ + + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + diff --git a/application/views/faculty/add_faculty.php b/application/views/faculty/add_faculty.php new file mode 100644 index 0000000..fb9e703 --- /dev/null +++ b/application/views/faculty/add_faculty.php @@ -0,0 +1,133 @@ + +load->view('includes/header');?> +
+ + load->view('includes/sidebar');?> + +
+
+
+
+
+
Add Faculty
+
+ +
+
+ +
+
+
+
+
Faculty
+
+
+
+
+
+ +
+ +
+
+
+ +
+
+
+
+ +
+
+ + +
+
+
+
+ +
+
+
+
+ +
+
+ + +
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+
+
+
+ +
+ +
+
+
+
+
+
+
+ + +
+
+
+ +
+
+
+
+
+
+ + + + + + + + load->view('includes/footer');?> \ No newline at end of file diff --git a/application/views/faculty/edit_faculty.php b/application/views/faculty/edit_faculty.php new file mode 100644 index 0000000..747a3d4 --- /dev/null +++ b/application/views/faculty/edit_faculty.php @@ -0,0 +1,165 @@ + +load->view('includes/header');?> + +
+ load->view('includes/sidebar');?> +
+
+
+
+
+
Edit Faculty
+
+ +
+
+ + num_rows()>0) + { + $f=$fac->row(); + $id=$f->id; + $faculty=$f->code; + $name=$f->name; + $email=$f->email; + $number=$f->number; + $dob=$f->dob; + $gender=$f->gender; + $address=$f->address; + $desi=$f->desi; + $f_img=$f->f_img; + + } ?> +
+
+
+
+
Edit Faculty
+
+
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+
+ + + + +
+
+
+
+ +
+ +
+
+
+ +
+
+ + +
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+ +
+ +
+ +
+
+
+
+
+ + +
+
+
+ +
+
+
+
+
+
+ +
+
+ + load->view('includes/footer');?> \ No newline at end of file diff --git a/application/views/faculty/faculty_list.php b/application/views/faculty/faculty_list.php new file mode 100644 index 0000000..375a1bd --- /dev/null +++ b/application/views/faculty/faculty_list.php @@ -0,0 +1,148 @@ + + +load->view('includes/header');?> + +
+ + load->view('includes/sidebar');?> + +
+
+
+
+
+
Faculty List
+
+ +
+
+ load->view('includes/msg');?> +
+
+
+
+
+
+
+ +
+
+ +
+
+ + + + + + + + + + + + + num_rows()>0) + { + $i=1; + foreach($fac->result() as $f) + { + $id=$f->id; + $faculty=$f->code; + $name=$f->name; + $email=$f->email; + //$number=$f->number; + //$dob=$f->dob; + //$gender=$f->gender; + //$address=$f->address; + $desi=$f->desigation; + //$f_img=$f->f_img; + ?> + + + + + + + + + + + + +
S.No ID Name Email Designation Action
+ + + + + + + + +
+
+
+
+
+
+
+
+
+ + + + load->view('includes/footer');?> + + + + + \ No newline at end of file diff --git a/application/views/includes/footer.php b/application/views/includes/footer.php new file mode 100644 index 0000000..45cd5b4 --- /dev/null +++ b/application/views/includes/footer.php @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/application/views/includes/header.php b/application/views/includes/header.php new file mode 100644 index 0000000..3b36c37 --- /dev/null +++ b/application/views/includes/header.php @@ -0,0 +1,256 @@ + + + + + + + + + + + + + Student + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + \ No newline at end of file diff --git a/application/views/includes/msg.php b/application/views/includes/msg.php new file mode 100644 index 0000000..5ffa7a3 --- /dev/null +++ b/application/views/includes/msg.php @@ -0,0 +1,11 @@ + session->userdata('suc')) { ?> + +session->userdata('err')) { ?> + + \ No newline at end of file diff --git a/application/views/includes/sidebar.php b/application/views/includes/sidebar.php new file mode 100644 index 0000000..31b5abc --- /dev/null +++ b/application/views/includes/sidebar.php @@ -0,0 +1,93 @@ + + + + + \ No newline at end of file diff --git a/application/views/index.html b/application/views/index.html new file mode 100644 index 0000000..b702fbc --- /dev/null +++ b/application/views/index.html @@ -0,0 +1,11 @@ + + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + diff --git a/application/views/login.php b/application/views/login.php new file mode 100644 index 0000000..36506d7 --- /dev/null +++ b/application/views/login.php @@ -0,0 +1,115 @@ + + + + + + + + + + + + Student + + + + + + + + + + + + + + +
+
+
+
+ + + Log in + +
+ + +
+
+ + +
+ +
+ + +
+
+ +
+ +
+
+
+
+ + + + + + + + + + + \ No newline at end of file diff --git a/application/views/profile.php b/application/views/profile.php new file mode 100644 index 0000000..707617c --- /dev/null +++ b/application/views/profile.php @@ -0,0 +1,68 @@ + +load->view('includes/header');?> +
+ + load->view('includes/sidebar');?> + +
+
+
+
+
+
My Profile
+
+ +
+
+ +
+
+
+
+
My Profile
+
+
+
+
+
+ +
+
+
+
+ +
+
+
+
+
+
+
+ + +
+
+
+
+
+
+
+
+
+
+ +
+
+ + + + + load->view('includes/footer');?> \ No newline at end of file diff --git a/application/views/roles/role_list.php b/application/views/roles/role_list.php new file mode 100644 index 0000000..8103f4b --- /dev/null +++ b/application/views/roles/role_list.php @@ -0,0 +1,224 @@ + + +load->view('includes/header');?> + +
+ + load->view('includes/sidebar');?> + +
+
+
+
+
+
Roles List
+
+ +
+
+ load->view('includes/msg');?> +
+
+
+ +
+
+
+
+ +
+
+ +
+
+ + + + + + + + + + num_rows()>0) + { + $i=1; + foreach($rol->result() as $r) + { + + //$id=$r->id; + $role_id=$r->role_id; + $rolename=$r->name; + ?> + + + + + + + + + +
S.No Name Action
+ + + + + + + +
+
+ +
+
+
+
+ +
+
+
+ + + + + + + + load->view('includes/footer');?> + + + + + + \ No newline at end of file diff --git a/application/views/semester/add_semester.php b/application/views/semester/add_semester.php new file mode 100644 index 0000000..62473c7 --- /dev/null +++ b/application/views/semester/add_semester.php @@ -0,0 +1,77 @@ + +load->view('includes/header');?> +
+ + load->view('includes/sidebar');?> + +
+
+
+
+
+
Add Semester
+
+ +
+
+ +
+
+
+
+
Semester
+
+
+
+
+
+ +
+ +
+
+
+ +
+
+
+
+ +
+
+
+
+
+
+
+
+ + +
+
+
+ +
+
+
+
+
+
+ + + + + + + + load->view('includes/footer');?> \ No newline at end of file diff --git a/application/views/semester/edit_semester.php b/application/views/semester/edit_semester.php new file mode 100644 index 0000000..fcc0ab7 --- /dev/null +++ b/application/views/semester/edit_semester.php @@ -0,0 +1,107 @@ + +load->view('includes/header');?> + +
+ load->view('includes/sidebar');?> +
+
+
+
+
+
Edit Semester
+
+ +
+
+ + num_rows()>0) + { + $s=$sem->row(); + $id=$s->id; + $name=$s->name; + $hod=$s->hod; + $staff=$s->staff; + + } ?> +
+
+
+
+
Edit Semester
+
+
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+
+ + +
+
+
+ +
+
+
+
+
+
+ +
+
+ + load->view('includes/footer');?> \ No newline at end of file diff --git a/application/views/semester/semester_list.php b/application/views/semester/semester_list.php new file mode 100644 index 0000000..15f51cf --- /dev/null +++ b/application/views/semester/semester_list.php @@ -0,0 +1,140 @@ + + +load->view('includes/header');?> + +
+ + load->view('includes/sidebar');?> + +
+
+
+
+
+
Semester List
+
+ +
+
+ load->view('includes/msg');?> +
+
+
+
+
+
+
+ +
+
+ +
+
+ + + + + + + + + + + + num_rows()>0) + { + $i=1; + foreach($sem->result() as $s) + { + $id=$s->id; + $name=$s->name; + $hod=$s->hod; + $staff=$s->staff; + ?> + + + + + + + + + + + +
S.No Name Hod Staff Action
+ + + + + + + + +
+
+
+
+
+
+
+
+
+ + + + load->view('includes/footer');?> + + + + + \ No newline at end of file diff --git a/application/views/student/add_student.php b/application/views/student/add_student.php new file mode 100644 index 0000000..67120fc --- /dev/null +++ b/application/views/student/add_student.php @@ -0,0 +1,123 @@ + +load->view('includes/header');?> +
+ + load->view('includes/sidebar');?> + +
+
+
+
+
+
Add Student
+
+ +
+
+ +
+
+
+
+
Student
+
+
+
+
+
+ +
+ +
+
+
+ +
+
+
+ +
+ +
+
+
+
+ +
+
+ + +
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+
+
+
+ +
+ +
+
+
+
+
+
+
+ + +
+
+
+ +
+
+
+
+
+
+ + + + + + + + load->view('includes/footer');?> \ No newline at end of file diff --git a/application/views/student/edit_student.php b/application/views/student/edit_student.php new file mode 100644 index 0000000..6f160ad --- /dev/null +++ b/application/views/student/edit_student.php @@ -0,0 +1,137 @@ + +load->view('includes/header');?> + +
+ load->view('includes/sidebar');?> +
+
+
+
+
+
Edit Student
+
+ +
+
+ + num_rows()>0) + { + $s=$stu->row(); + $id=$s->id; + $name=$s->name; + $number=$s->number; + $address=$s->address; + $department=$s->department; + $gender=$s->gender; + $s_img=$s->s_img; + + } ?> +
+
+
+
+
Edit Student
+
+
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+ +
+ +
+ +
+
+
+ +
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+
+ + +
+
+
+ +
+
+
+
+
+
+ +
+
+ + load->view('includes/footer');?> \ No newline at end of file diff --git a/application/views/student/student_list.php b/application/views/student/student_list.php new file mode 100644 index 0000000..3a28b9f --- /dev/null +++ b/application/views/student/student_list.php @@ -0,0 +1,146 @@ + + +load->view('includes/header');?> + +
+ + load->view('includes/sidebar');?> + +
+
+
+
+
+
Student List
+
+ +
+
+ load->view('includes/msg');?> +
+
+
+
+
+
+
+ +
+
+ +
+
+ + + + + + + + + + + + + num_rows()>0) + { + $i=1; + foreach($stu->result() as $s) + { + $id=$s->id; + $name=$s->name; + $number=$s->number; + $address=$s->address; + $department=$s->department; + $gender=$s->gender; + $s_img=$s->s_img; + ?> + + + + + + + + + + + + + +
S.No Name Mobile Number Department Gender Action
+ + + + + + + + +
+
+
+
+
+
+
+
+
+ + + + load->view('includes/footer');?> + + + + + \ No newline at end of file diff --git a/application/views/subject/add_subject.php b/application/views/subject/add_subject.php new file mode 100644 index 0000000..f6b9c5b --- /dev/null +++ b/application/views/subject/add_subject.php @@ -0,0 +1,92 @@ + +load->view('includes/header');?> +
+ + load->view('includes/sidebar');?> + +
+
+
+
+
+
Add Subject
+
+ +
+
+ +
+
+
+
+
Subject
+
+
+
+
+
+ +
+ +
+
+
+ +
+
+
+
+ +
+
+
+
+ +
+
+
+
+ +
+ +
+
+ +
+
+
+
+
+ + +
+
+
+ +
+
+
+
+
+
+ + + + + + + + load->view('includes/footer');?> \ No newline at end of file diff --git a/application/views/subject/edit_subject.php b/application/views/subject/edit_subject.php new file mode 100644 index 0000000..e057220 --- /dev/null +++ b/application/views/subject/edit_subject.php @@ -0,0 +1,123 @@ + +load->view('includes/header');?> + +
+ load->view('includes/sidebar');?> +
+
+
+
+
+
Edit Subject
+
+ +
+
+ + num_rows()>0) + { + $s=$sub->row(); + $id=$s->id; + $code=$s->code; + $sub=$s->subject; + $dep=$s->department; + $semester=$s->semester; + $p_img=$s->p_img; + + } ?> +
+
+
+
+
Edit Subject
+
+
+
+
+
+ +
+ +
+
+
+ +
+
+
+
+ +
+
+
+
+ +
+
+
+
+ +
+ +
+
+ +
+
+
+
+ + +
+
+
+
+
+
+
+
+
+
+ +
+ + + load->view('includes/footer');?> \ No newline at end of file diff --git a/application/views/subject/subject_list.php b/application/views/subject/subject_list.php new file mode 100644 index 0000000..9aaf537 --- /dev/null +++ b/application/views/subject/subject_list.php @@ -0,0 +1,144 @@ + + +load->view('includes/header');?> + +
+ + load->view('includes/sidebar');?> + +
+
+
+
+
+
Suject List
+
+ +
+
+ load->view('includes/msg');?> +
+
+
+
+
+
+
+ +
+
+ +
+
+ + + + + + + + + + + + + + num_rows()>0) + { + $i=1; + foreach($sub->result() as $s) + { + $id=$s->id; + $code=$s->code; + $sub=$s->subject; + $dep=$s->department; + $semester=$s->semester; + $p_img=$s->p_img; + ?> + + + + + + + + + + + +
S.No Subject code Name of the Subject Department Semester Action
+ + + + + + + + +
+
+
+
+
+
+
+
+
+ + + + load->view('includes/footer');?> + + + + + \ No newline at end of file diff --git a/application/views/welcome_message.php b/application/views/welcome_message.php new file mode 100644 index 0000000..ff5376b --- /dev/null +++ b/application/views/welcome_message.php @@ -0,0 +1,75 @@ + + + + + + + + + + + + Negamaa + + + + + + + + + + + + + + +
+
+
+
+ + + Log in + +
+ + +
+
+ + +
+
+ + +
+
+ +
+ +
+
+
+
+ + + + + + + + + + + \ No newline at end of file diff --git a/assets/app.js b/assets/app.js new file mode 100644 index 0000000..a75572a --- /dev/null +++ b/assets/app.js @@ -0,0 +1,757 @@ +/** + * Document : app.js + * Author : redstar + * Description: Core script to handle the entire theme and core functions + * + **/ +var App = function() { + + // IE mode + var isIE8 = false; + var isIE9 = false; + var isIE10 = false; + + var resizeHandlers = []; + + var assetsPath = ''; + + var globalImgPath = 'img/'; + + var globalPluginsPath = 'global/plugins/'; + + var globalCssPath = 'css/'; + + /************* Setting for IE ****************/ + var handleInit = function() { + + + isIE8 = !!navigator.userAgent.match(/MSIE 8.0/); + isIE9 = !!navigator.userAgent.match(/MSIE 9.0/); + isIE10 = !!navigator.userAgent.match(/MSIE 10.0/); + + if (isIE10) { + $('html').addClass('ie10'); // detect IE10 version + } + + if (isIE10 || isIE9 || isIE8) { + $('html').addClass('ie'); // detect IE10 version + } + }; + + /*************** Change theme color *************/ + var handleColorSetting = function() { + + $(document).on('click', '.control-sidebar-btn', function () { + jQuery( ".quick-setting" ).toggle( "slide"); + }); + + }; + + /*************** Change Language *************/ + var handleLanguage = function() { + + $(document).on('click', '.language-switch .dropdown-menu li a', function () { + $(".language-switch>a").html($(this).html()+''); + $(".language-switch>a img").addClass("position-left"); + }); + + }; + /*************** Hover Sidemenu *************/ + var handleHoverSidemenu = function() { + $(".sidemenu-hover-submenu").parent().parent().css("position","relative"); + }; + + /************* Handle theme layout ****************/ + var handleTheme = function() { + + var panel = $('.chatpane'); + + if ($('body').hasClass('page-boxed') === false) { + $('.layout-option', panel).val("fluid"); + } + + $('.sidebar-option', panel).val("default"); + $('.page-header-option', panel).val("fixed"); + $('.page-footer-option', panel).val("default"); + if ($('.sidebar-pos-option').attr("disabled") === false) { + $('.sidebar-pos-option', panel).val('left'); + } + var lastSelectedLayout = ''; + + var setLayout = function() { + + var layoutOption = $('.layout-option', panel).val(); + var sidebarOption = $('.sidebar-option', panel).val(); + var headerOption = $('.page-header-option', panel).val(); + var footerOption = $('.page-footer-option', panel).val(); + var sidebarPosOption = $('.sidebar-pos-option', panel).val(); + var sidebarStyleOption = $('.sidebar-style-option', panel).val(); + var sidebarMenuOption = $('.sidebar-menu-option', panel).val(); + var headerTopDropdownStyle = $('.page-header-top-dropdown-style-option', panel).val(); + + if (sidebarOption == "fixed" && headerOption == "default") { + alert('Default Header with Fixed Sidebar option is not supported. Proceed with Fixed Header with Fixed Sidebar.'); + $('.page-header-option', panel).val("fixed"); + $('.sidebar-option', panel).val("fixed"); + sidebarOption = 'fixed'; + headerOption = 'fixed'; + } + + resetLayout(); // reset layout to default state + + if (layoutOption === "boxed") { + $("body").addClass("page-boxed"); + + // set header + $('.page-header > .page-header-inner').addClass("container"); + var cont = $('body > .clearfix').after('
'); + + // set content + $('.page-container').appendTo('body > .container'); + + // set footer + if (footerOption === 'fixed') { + $('.page-footer').html('
' + $('.page-footer').html() + '
'); + } else { + $('.page-footer').appendTo('body > .container'); + } + } + + if (lastSelectedLayout != layoutOption) { + //layout changed, run responsive handler: + App.runResizeHandlers(); + } + lastSelectedLayout = layoutOption; + + /************ header ******************/ + if (headerOption === 'fixed') { + $("body").addClass("page-header-fixed"); + $(".page-header").removeClass("navbar-static-top").addClass("navbar-fixed-top"); + } else { + $("body").removeClass("page-header-fixed"); + $(".page-header").removeClass("navbar-fixed-top").addClass("navbar-static-top"); + } + + /************ sidebar *****************/ + if ($('body').hasClass('page-full-width') === false) { + if (sidebarOption === 'fixed') { + $("body").addClass("sidemenu-container-fixed"); + $("sidemenu").addClass("sidemenu-fixed"); + $("sidemenu").removeClass("page-sidebar-menu-default"); + Layout.initFixedSidebarHoverEffect(); + } else { + $("body").removeClass("sidemenu-container-fixed"); + $("page-sidebar-menu").addClass("page-sidebar-menu-default"); + $("page-sidebar-menu").removeClass("sidemenu-default"); + $('.sidemenu').unbind('mouseenter').unbind('mouseleave'); + } + } + + /********* top dropdown style ************/ + if (headerTopDropdownStyle === 'dark') { + $(".top-menu > .navbar-nav > li.dropdown").addClass("dropdown-dark"); + } else { + $(".top-menu > .navbar-nav > li.dropdown").removeClass("dropdown-dark"); + } + + /************* footer ****************/ + if (footerOption === 'fixed') { + $("body").addClass("page-footer-fixed"); + } else { + $("body").removeClass("page-footer-fixed"); + } + + /*********** sidebar style ***************/ + if (sidebarStyleOption === 'light') { + $(".page-sidebar-menu").addClass("page-sidebar-menu-light"); + } else { + $(".page-sidebar-menu").removeClass("page-sidebar-menu-light"); + } + + /********* sidebar menu ***********************/ + if (sidebarMenuOption === 'hover') { + if (sidebarOption == 'fixed') { + $('.sidebar-menu-option', panel).val("accordion"); + alert("Hover Sidebar Menu is not compatible with Fixed Sidebar Mode. Select Default Sidebar Mode Instead."); + } else { + $(".sidemenu").addClass("sidemenu-hover-submenu"); + } + } else { + $(".sidemenu").removeClass("sidemenu-hover-submenu"); + } + + /**************** sidebar left right position setting **************/ + if (sidebarPosOption === 'right') { + $("body").addClass("sidemenu-container-reversed"); + $('#frontend-link').tooltip('destroy').tooltip({ + placement: 'left' + }); + } else { + $("body").removeClass("sidemenu-container-reversed"); + $('#frontend-link').tooltip('destroy').tooltip({ + placement: 'right' + }); + } + + Layout.fixContentHeight(); // fix content height + Layout.initFixedSidebar(); // reinitialize fixed sidebar + }; + + $(document).on('click', '.toggler', panel, function() { + $('.toggler').hide(); + $('.toggler-close').show(); + $('.chatpane > .theme-options').show(); + }); + + $(document).on('click', '.toggler-close', panel, function() { + $('.toggler').show(); + $('.toggler-close').hide(); + $('.chatpane > .theme-options').hide(); + }); + + /*************** spinner button ******************/ + $(document).on('click', '.spinner button', function() { + var btn = $(this); + var input = btn.closest('.spinner').find('input'); + var step = 1; + if (input.attr('step') != undefined) { + step = parseInt(input.attr('step'),10); + } + if (btn.attr('data-dir') == 'up') { + if (input.attr('max') == undefined || parseInt(input.val(),10) < parseInt(input.attr('max'),10)) { + input.val(parseInt(input.val(), 10) + step); + } else { + btn.next("disabled", true); + } + } else { + if (input.attr('min') == undefined || parseInt(input.val(),10) > parseInt(input.attr('min'),10)) { + input.val(parseInt(input.val(), 10) - step); + } else { + btn.prev("disabled", true); + } + } + }); + + /*************** TO DO **********************/ + $(document).on('click', '.todo-check label', function() { + $(this).parents('li').children('.todo-title').toggleClass('line-through'); + }); + $(document).on('click', '.todo-remove', function() { + $(this).closest("li").remove(); + return false; + }); + + $(document).on('click', '.panel .tools .fa-times', function() { + $(this).parents(".panel").parent().remove(); + }); + $('.tooltips').tooltip(); + + // clickable row for email + $(document).on('click', '.clickable-row', function() { + window.document.location = $(this).data("link"); + }); + + + /************* collapse button in panel***************8*/ + $(document).on('click', '.card .tools .t-collapse', function() { + var el = $(this).parents(".card").children(".card-body"); + if ($(this).hasClass("fa-chevron-down")) { + $(this).removeClass("fa-chevron-down").addClass("fa-chevron-up"); + el.slideUp(200); + } else { + $(this).removeClass("fa-chevron-up").addClass("fa-chevron-down"); + el.slideDown(200); + } + }); + + /**************** close button in panel *****************/ + $(document).on('click', '.card .tools .t-close', function() { + $(this).parents(".card").parent().remove(); + }); + + /****************** refresh button in panel *****************/ + $('.box-refresh').on('click', function(br) { + br.preventDefault(); + $("
").appendTo($(this).parents('.tools').parents('.card-head').parents('.card')); + setTimeout(function() { + $('.refresh-block').remove(); + }, 1000); + }); + + /***************** set default theme options **************************/ + + if ($("body").hasClass("page-boxed")) { + $('.layout-option', panel).val("boxed"); + } + + if ($("body").hasClass("sidemenu-container-fixed")) { + $('.sidebar-option', panel).val("fixed"); + } + + if ($("body").hasClass("page-header-fixed")) { + $('.page-header-option', panel).val("fixed"); + } + + if ($("body").hasClass("page-footer-fixed")) { + $('.page-footer-option', panel).val("fixed"); + } + + if ($("body").hasClass("sidemenu-container-reversed")) { + $('.sidebar-pos-option', panel).val("right"); + } + + if ($(".page-sidebar-menu").hasClass("page-sidebar-menu-light")) { + $('.sidebar-style-option', panel).val("light"); + } + + if ($(".page-sidebar-menu").hasClass("page-sidebar-menu-hover-submenu")) { + $('.sidebar-menu-option', panel).val("hover"); + } + + var sidebarOption = $('.sidebar-option', panel).val(); + var headerOption = $('.page-header-option', panel).val(); + var footerOption = $('.page-footer-option', panel).val(); + var sidebarPosOption = $('.sidebar-pos-option', panel).val(); + var sidebarStyleOption = $('.sidebar-style-option', panel).val(); + var sidebarMenuOption = $('.sidebar-menu-option', panel).val(); + + $('.layout-option, .page-header-option, .page-header-top-dropdown-style-option, .sidebar-option, .page-footer-option, .sidebar-pos-option, .sidebar-style-option, .sidebar-menu-option', panel).change(setLayout); + }; + + /************ Reset theme layout ********************/ + var resetLayout = function() { + $("body"). + removeClass("page-boxed"). + removeClass("page-footer-fixed"). + removeClass("sidemenu-container-fixed"). + removeClass("page-header-fixed"). + removeClass("sidemenu-container-reversed"); + + $('.page-header > .page-header-inner').removeClass("container"); + + if ($('.page-container').parent(".container").length === 1) { + $('.page-container').insertAfter('body > .clearfix'); + } + + if ($('.page-footer > .container').length === 1) { + $('.page-footer').html($('.page-footer > .container').html()); + } else if ($('.page-footer').parent(".container").length === 1) { + $('.page-footer').insertAfter('.page-container'); + $('.scroll-to-top').insertAfter('.page-footer'); + } + + $(".top-menu > .navbar-nav > li.dropdown").removeClass("dropdown-dark"); + + $('body > .container').remove(); + }; + + + // runs callback functions set by App.addResponsiveHandler(). + var _runResizeHandlers = function() { + // reinitialize other subscribed elements + for (var i = 0; i < resizeHandlers.length; i++) { + var each = resizeHandlers[i]; + each.call(); + } + }; + + /********** handle the layout reinitialization on window resize ***********/ + var handleOnResize = function() { + var resize; + if (isIE8) { + var currheight; + $(window).resize(function() { + if (currheight == document.documentElement.clientHeight) { + return; //quite event since only body resized not window. + } + if (resize) { + clearTimeout(resize); + } + resize = setTimeout(function() { + _runResizeHandlers(); + }, 50); // wait 50ms until window resize finishes. + currheight = document.documentElement.clientHeight; // store last body client height + }); + } else { + $(window).resize(function() { + if (resize) { + clearTimeout(resize); + } + resize = setTimeout(function() { + _runResizeHandlers(); + }, 50); // wait 50ms until window resize finishes. + }); + } + }; + + /*************** Handles Bootstrap switches in setting panel ********/ + var handleBootstrapSwitch = function() { + if (!$().bootstrapSwitch) { + return; + } + $('.make-switch').bootstrapSwitch(); + }; + + /*************** Handles Bootstrap Tabs **********************/ + var handleTabs = function() { + //activate tab if tab id provided in the URL + if (encodeURI(location.hash)) { + var tabid = encodeURI(location.hash.substr(1)); + $('a[href="#' + tabid + '"]').parents('.tab-pane:hidden').each(function() { + var tabid = $(this).attr("id"); + $('a[href="#' + tabid + '"]').click(); + }); + $('a[href="#' + tabid + '"]').click(); + } + + if ($().tabdrop) { + $('.tabbable-tabdrop .nav-pills, .tabbable-tabdrop .nav-tabs').tabdrop({ + text: ' ' + }); + } + }; + + /************* Handles Bootstrap Dropdowns ********************/ + var handleDropdowns = function() { + /* + Hold dropdown on click + */ + $('body').on('click', '.dropdown-menu.hold-on-click', function(e) { + e.stopPropagation(); + }); + }; + + /************** Handles counterup plugin wrapper ****************/ + var handleCounterup = function() { + if (!$().counterUp) { + return; + } + + $("[data-counter='counterup']").counterUp({ + delay: 10, + time: 1000 + }); + }; + + // Fix input placeholder issue for IE8 and IE9 + var handleFixInputPlaceholderForIE = function() { + //fix html5 placeholder attribute for ie7 & ie8 + if (isIE8 || isIE9) { // ie8 & ie9 + // this is html5 placeholder fix for inputs, inputs with placeholder-no-fix class will be skipped(e.g: we need this for password fields) + $('input[placeholder]:not(.placeholder-no-fix), textarea[placeholder]:not(.placeholder-no-fix)').each(function() { + var input = $(this); + + if (input.val() === '' && input.attr("placeholder") !== '') { + input.addClass("placeholder").val(input.attr('placeholder')); + } + + input.focus(function() { + if (input.val() == input.attr('placeholder')) { + input.val(''); + } + }); + + input.blur(function() { + if (input.val() === '' || input.val() == input.attr('placeholder')) { + input.val(input.attr('placeholder')); + } + }); + }); + } + }; + + // Handle Select2 Dropdowns + var handleSelect2 = function() { + if ($().select2) { + $.fn.select2.defaults.set("theme", "bootstrap"); + $('.select2me').select2({ + placeholder: "Select", + width: 'auto', + allowClear: true + }); + } + }; + + // handle group element heights + var handleHeight = function() { + $('[data-auto-height]').each(function() { + var parent = $(this); + var items = $('[data-height]', parent); + var height = 0; + var mode = parent.attr('data-mode'); + var data_offset = parent.attr('data-offset') ? parent.attr('data-offset') : 0; + var offset = parseInt(data_offset,10); + + items.each(function() { + if ($(this).attr('data-height') == "height") { + $(this).css('height', ''); + } else { + $(this).css('min-height', ''); + } + + var height_ = (mode == 'base-height' ? $(this).outerHeight() : $(this).outerHeight(true)); + if (height_ > height) { + height = height_; + } + }); + + height = height + offset; + + items.each(function() { + if ($(this).attr('data-height') == "height") { + $(this).css('height', height); + } else { + $(this).css('min-height', height); + } + }); + + if (parent.attr('data-related')) { + $(parent.attr('data-related')).css('height', parent.height()); + } + }); + } + + // Handles quick sidebar toggler + var handleQuickSidebarToggler = function() { + // close sidebar using button click + $(document).on('click', '.dropdown-quick-sidebar-toggler a', function(e) { + $('body').toggleClass('chat-sidebar-open'); + }); + // close sidebar when click outside box + $(document).on('click', '.page-content', function(e) { + if($("body").hasClass("chat-sidebar-open")){ + $('body').toggleClass('chat-sidebar-open'); + } + }); + // close sidebar using esc key + $( document ).on( 'keydown', function ( e ) { + if ( e.keyCode === 27 && $("body").hasClass("chat-sidebar-open")) { // ESC + $('body').toggleClass('chat-sidebar-open'); + } + }); + }; + + /********Sidebar slim-menu*********/ + var handleslimscroll_menu = function() { + $(".slimscroll-style").slimscroll({ + height: $( window ).height() - 90, + position: "right", + size: "5px", + color: "#9ea5ab", + wheelStep: 5 + }); + $(".small-slimscroll-style").slimscroll({ + height: "260px", + position: "right", + size: "5px", + color: "#9ea5ab", + wheelStep: 5 + }); + }; + + handleChatScrollbar = function() { + var t = $(".chat-sidebar-chat"), + i = function() { + var i, a = t.find(".chat-sidebar-item"), + e = $(".chat-sidebar-chat-users").attr("data-height"); + i = $(".chat-sidebar-chat-users").attr("data-height") - 80 - t.find(".nav-justified > .nav-tabs").outerHeight(), a.attr("data-height", i), a.css("height", e + "px"), a.css("overflow-y", "auto") + }; + i(), App.addResizeHandler(i) + }; + + // Handles quick sidebar settings + var handleQuickSidebarSettings = function() { + var wrapper = $('.chat-sidebar-container'); + + var initSettingsSlimScroll = function() { + var settingsList = wrapper.find('.chat-sidebar-settings-list'); + var settingsListHeight; + + settingsListHeight = wrapper.height() - 80 - wrapper.find('.nav-justified > .nav-tabs').outerHeight(); + + // alerts list + settingsList.attr("data-height", settingsListHeight); + settingsList.css("height", wrapper.height() + "px"); + settingsList.css("overflow-y", "auto"); + }; + + initSettingsSlimScroll(); + App.addResizeHandler(initSettingsSlimScroll); // reinitialize on window resize + }; + + + + //* END:CORE HANDLERS *// + + return { + + //main function to initiate the theme + init: function() { + + //Core handlers + handleInit(); // initialize core variables + handleTheme(); + handleOnResize(); // set and handle responsive + handleColorSetting(); + handleLanguage(); + handleHoverSidemenu(); + + //UI Component handlers + handleBootstrapSwitch(); // handle bootstrap switch plugin + handleSelect2(); // handle custom Select2 dropdowns + handleDropdowns(); // handle dropdowns + handleTabs(); // handle tabs + handleCounterup(); // handle counterup instances + + handleQuickSidebarToggler(); // handles quick sidebar's toggler + handleQuickSidebarSettings(); // handles quick sidebar's setting + handleChatScrollbar(); + + handleslimscroll_menu(); + + //Handle group element heights + this.addResizeHandler(handleHeight); // handle auto calculating height on window resize + + handleFixInputPlaceholderForIE(); //IE8 & IE9 input placeholder issue fix + }, + + //public function to add callback a function which will be called on window resize + addResizeHandler: function(func) { + resizeHandlers.push(func); + }, + + //public functon to call _runresizeHandlers + runResizeHandlers: function() { + _runResizeHandlers(); + }, + + // wrApper function to scroll(focus) to an element + scrollTo: function(el, offeset) { + var pos = (el && el.length > 0) ? el.offset().top : 0; + + if (el) { + if ($('body').hasClass('page-header-fixed')) { + pos = pos - $('.page-header').height(); + } else if ($('body').hasClass('page-header-top-fixed')) { + pos = pos - $('.page-header-top').height(); + } else if ($('body').hasClass('page-header-menu-fixed')) { + pos = pos - $('.page-header-menu').height(); + } + pos = pos + (offeset ? offeset : -1 * el.height()); + } + + $('html,body').animate({ + scrollTop: pos + }, 'slow'); + }, + // function to scroll to the top + scrollTop: function() { + App.scrollTo(); + }, + + startPageLoading: function(options) { + if (options && options.animate) { + $('.page-spinner-bar').remove(); + $('body').append('
'); + } else { + $('.page-loading').remove(); + $('body').append('
  ' + (options && options.message ? options.message : 'Loading...') + '
'); + } + }, + + stopPageLoading: function() { + $('.page-loading, .page-spinner-bar').remove(); + }, + + //public helper function to get actual input value(used in IE9 and IE8 due to placeholder attribute not supported) + getActualVal: function(el) { + el = $(el); + if (el.val() === el.attr("placeholder")) { + return ""; + } + return el.val(); + }, + + //public function to get a paremeter by name from URL + getURLParameter: function(paramName) { + var searchString = window.location.search.substring(1), + i, val, params = searchString.split("&"); + + for (i = 0; i < params.length; i++) { + val = params[i].split("="); + if (val[0] == paramName) { + return unescape(val[1]); + } + } + return null; + }, + + getViewPort: function() { + var e = window, + a = 'inner'; + if (!('innerWidth' in window)) { + a = 'client'; + e = document.documentElement || document.body; + } + + return { + width: e[a + 'Width'], + height: e[a + 'Height'] + }; + }, + + getUniqueID: function(prefix) { + return 'prefix_' + Math.floor(Math.random() * (new Date()).getTime()); + }, + + // check IE8 mode + isIE8: function() { + return isIE8; + }, + + // check IE9 mode + isIE9: function() { + return isIE9; + }, + + getAssetsPath: function() { + return assetsPath; + }, + + setAssetsPath: function(path) { + assetsPath = path; + }, + + setGlobalImgPath: function(path) { + globalImgPath = path; + }, + + getGlobalImgPath: function() { + return assetsPath + globalImgPath; + }, + + getGlobalCssPath: function() { + return assetsPath + globalCssPath; + }, + + getResponsiveBreakpoint: function(size) { + // bootstrap responsive breakpoints + var sizes = { + 'xs': 480, // extra small + 'sm': 768, // small + 'md': 992, // medium + 'lg': 1200 // large + }; + + return sizes[size] ? sizes[size] : 0; + } + }; + +}(); + +jQuery(document).ready(function() { + App.init(); // init core componets + $(".chat-sidebar-chat-user-messages").animate({ + scrollTop: $(document).height() + }, 1000); +}); \ No newline at end of file diff --git a/assets/bootstrap-colorpicker/css/bootstrap-colorpicker.css b/assets/bootstrap-colorpicker/css/bootstrap-colorpicker.css new file mode 100644 index 0000000..c446ef8 --- /dev/null +++ b/assets/bootstrap-colorpicker/css/bootstrap-colorpicker.css @@ -0,0 +1,222 @@ +/*! + * Bootstrap Colorpicker v2.3.6 + * https://itsjavi.com/bootstrap-colorpicker/ + * + * Originally written by (c) 2012 Stefan Petre + * Licensed under the Apache License v2.0 + * http://www.apache.org/licenses/LICENSE-2.0.txt + * + */ +.colorpicker-saturation { + width: 100px; + height: 100px; + background-image: url("../img/bootstrap-colorpicker/saturation.png"); + cursor: crosshair; + float: left; +} +.colorpicker-saturation i { + display: block; + height: 5px; + width: 5px; + border: 1px solid #000; + -webkit-border-radius: 5px; + -moz-border-radius: 5px; + border-radius: 5px; + position: absolute; + top: 0; + left: 0; + margin: -4px 0 0 -4px; +} +.colorpicker-saturation i b { + display: block; + height: 5px; + width: 5px; + border: 1px solid #fff; + -webkit-border-radius: 5px; + -moz-border-radius: 5px; + border-radius: 5px; +} +.colorpicker-hue, +.colorpicker-alpha { + width: 15px; + height: 100px; + float: left; + cursor: row-resize; + margin-left: 4px; + margin-bottom: 4px; +} +.colorpicker-hue i, +.colorpicker-alpha i { + display: block; + height: 1px; + background: #000; + border-top: 1px solid #fff; + position: absolute; + top: 0; + left: 0; + width: 100%; + margin-top: -1px; +} +.colorpicker-hue { + background-image: url("../img/bootstrap-colorpicker/hue.png"); +} +.colorpicker-alpha { + background-image: url("../img/bootstrap-colorpicker/alpha.png"); + display: none; +} +.colorpicker-saturation, +.colorpicker-hue, +.colorpicker-alpha { + background-size: contain; +} +.colorpicker { + padding: 4px; + min-width: 130px; + margin-top: 1px; + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + border-radius: 4px; + z-index: 2500; +} +.colorpicker:before, +.colorpicker:after { + display: table; + content: ""; + line-height: 0; +} +.colorpicker:after { + clear: both; +} +.colorpicker:before { + content: ''; + display: inline-block; + border-left: 7px solid transparent; + border-right: 7px solid transparent; + border-bottom: 7px solid #ccc; + border-bottom-color: rgba(0, 0, 0, 0.2); + position: absolute; + top: -7px; + left: 6px; +} +.colorpicker:after { + content: ''; + display: inline-block; + border-left: 6px solid transparent; + border-right: 6px solid transparent; + border-bottom: 6px solid #ffffff; + position: absolute; + top: -6px; + left: 7px; +} +.colorpicker div { + position: relative; +} +.colorpicker.colorpicker-with-alpha { + min-width: 140px; +} +.colorpicker.colorpicker-with-alpha .colorpicker-alpha { + display: block; +} +.colorpicker-color { + height: 10px; + margin-top: 5px; + clear: both; + background-image: url("../img/bootstrap-colorpicker/alpha.png"); + background-position: 0 100%; +} +.colorpicker-color div { + height: 10px; +} +.colorpicker-selectors { + display: none; + height: 10px; + margin-top: 5px; + clear: both; +} +.colorpicker-selectors i { + cursor: pointer; + float: left; + height: 10px; + width: 10px; +} +.colorpicker-selectors i + i { + margin-left: 3px; +} +.colorpicker-element .input-group-addon i, +.colorpicker-element .add-on i { + display: inline-block; + cursor: pointer; + height: 16px; + vertical-align: text-top; + width: 16px; +} +.colorpicker.colorpicker-inline { + position: relative; + display: inline-block; + float: none; + z-index: auto; +} +.colorpicker.colorpicker-horizontal { + width: 110px; + min-width: 110px; + height: auto; +} +.colorpicker.colorpicker-horizontal .colorpicker-saturation { + margin-bottom: 4px; +} +.colorpicker.colorpicker-horizontal .colorpicker-color { + width: 100px; +} +.colorpicker.colorpicker-horizontal .colorpicker-hue, +.colorpicker.colorpicker-horizontal .colorpicker-alpha { + width: 100px; + height: 15px; + float: left; + cursor: col-resize; + margin-left: 0px; + margin-bottom: 4px; +} +.colorpicker.colorpicker-horizontal .colorpicker-hue i, +.colorpicker.colorpicker-horizontal .colorpicker-alpha i { + display: block; + height: 15px; + background: #ffffff; + position: absolute; + top: 0; + left: 0; + width: 1px; + border: none; + margin-top: 0px; +} +.colorpicker.colorpicker-horizontal .colorpicker-hue { + background-image: url("../img/bootstrap-colorpicker/hue-horizontal.png"); +} +.colorpicker.colorpicker-horizontal .colorpicker-alpha { + background-image: url("../img/bootstrap-colorpicker/alpha-horizontal.png"); +} +.colorpicker.colorpicker-hidden { + display: none; +} +.colorpicker.colorpicker-visible { + display: block; +} +.colorpicker-inline.colorpicker-visible { + display: inline-block; +} +.colorpicker-right:before { + left: auto; + right: 6px; +} +.colorpicker-right:after { + left: auto; + right: 7px; +} +.colorpicker-no-arrow:before { + border-right: 0; + border-left: 0; +} +.colorpicker-no-arrow:after { + border-right: 0; + border-left: 0; +} +/*# sourceMappingURL=bootstrap-colorpicker.css.map */ \ No newline at end of file diff --git a/assets/bootstrap-colorpicker/img/bootstrap-colorpicker/alpha-horizontal.png b/assets/bootstrap-colorpicker/img/bootstrap-colorpicker/alpha-horizontal.png new file mode 100644 index 0000000..f831889 Binary files /dev/null and b/assets/bootstrap-colorpicker/img/bootstrap-colorpicker/alpha-horizontal.png differ diff --git a/assets/bootstrap-colorpicker/img/bootstrap-colorpicker/alpha.png b/assets/bootstrap-colorpicker/img/bootstrap-colorpicker/alpha.png new file mode 100644 index 0000000..2e53a30 Binary files /dev/null and b/assets/bootstrap-colorpicker/img/bootstrap-colorpicker/alpha.png differ diff --git a/assets/bootstrap-colorpicker/img/bootstrap-colorpicker/hue-horizontal.png b/assets/bootstrap-colorpicker/img/bootstrap-colorpicker/hue-horizontal.png new file mode 100644 index 0000000..3dcd594 Binary files /dev/null and b/assets/bootstrap-colorpicker/img/bootstrap-colorpicker/hue-horizontal.png differ diff --git a/assets/bootstrap-colorpicker/img/bootstrap-colorpicker/hue.png b/assets/bootstrap-colorpicker/img/bootstrap-colorpicker/hue.png new file mode 100644 index 0000000..6f5ec2e Binary files /dev/null and b/assets/bootstrap-colorpicker/img/bootstrap-colorpicker/hue.png differ diff --git a/assets/bootstrap-colorpicker/img/bootstrap-colorpicker/saturation.png b/assets/bootstrap-colorpicker/img/bootstrap-colorpicker/saturation.png new file mode 100644 index 0000000..170841c Binary files /dev/null and b/assets/bootstrap-colorpicker/img/bootstrap-colorpicker/saturation.png differ diff --git a/assets/bootstrap-colorpicker/js/bootstrap-colorpicker-init.js b/assets/bootstrap-colorpicker/js/bootstrap-colorpicker-init.js new file mode 100644 index 0000000..eed6bdb --- /dev/null +++ b/assets/bootstrap-colorpicker/js/bootstrap-colorpicker-init.js @@ -0,0 +1,3 @@ +$(function() { $('#colorinput1').colorpicker({ color: "", format: "hex" }); }); +$(function() { $('#colorinput2').colorpicker({ color: "#AA3399", format: "rgba"}); }); +$(function() { $('#cp1').colorpicker(); }); \ No newline at end of file diff --git a/assets/bootstrap-colorpicker/js/bootstrap-colorpicker.js b/assets/bootstrap-colorpicker/js/bootstrap-colorpicker.js new file mode 100644 index 0000000..0fa68ba --- /dev/null +++ b/assets/bootstrap-colorpicker/js/bootstrap-colorpicker.js @@ -0,0 +1,1322 @@ +/*! + * Bootstrap Colorpicker v2.5.2 + * https://itsjavi.com/bootstrap-colorpicker/ + * + * Originally written by (c) 2012 Stefan Petre + * Licensed under the Apache License v2.0 + * http://www.apache.org/licenses/LICENSE-2.0.txt + * + */ + +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module unless amdModuleId is set + define(["jquery"], function(jq) { + return (factory(jq)); + }); + } else if (typeof exports === 'object') { + // Node. Does not work with strict CommonJS, but + // only CommonJS-like environments that support module.exports, + // like Node. + module.exports = factory(require("jquery")); + } else if (jQuery && !jQuery.fn.colorpicker) { + factory(jQuery); + } +}(this, function($) { + 'use strict'; + /** + * Color manipulation helper class + * + * @param {Object|String} [val] + * @param {Object} [predefinedColors] + * @param {String|null} [fallbackColor] + * @param {String|null} [fallbackFormat] + * @param {Boolean} [hexNumberSignPrefix] + * @constructor + */ + var Color = function( + val, predefinedColors, fallbackColor, fallbackFormat, hexNumberSignPrefix) { + this.fallbackValue = fallbackColor ? + ( + (typeof fallbackColor === 'string') ? + this.parse(fallbackColor) : + fallbackColor + ) : + null; + + this.fallbackFormat = fallbackFormat ? fallbackFormat : 'rgba'; + + this.hexNumberSignPrefix = hexNumberSignPrefix === true; + + this.value = this.fallbackValue; + + this.origFormat = null; // original string format + + this.predefinedColors = predefinedColors ? predefinedColors : {}; + + // We don't want to share aliases across instances so we extend new object + this.colors = $.extend({}, Color.webColors, this.predefinedColors); + + if (val) { + if (typeof val.h !== 'undefined') { + this.value = val; + } else { + this.setColor(String(val)); + } + } + + if (!this.value) { + // Initial value is always black if no arguments are passed or val is empty + this.value = { + h: 0, + s: 0, + b: 0, + a: 1 + }; + } + }; + + Color.webColors = { // 140 predefined colors from the HTML Colors spec + "aliceblue": "f0f8ff", + "antiquewhite": "faebd7", + "aqua": "00ffff", + "aquamarine": "7fffd4", + "azure": "f0ffff", + "beige": "f5f5dc", + "bisque": "ffe4c4", + "black": "000000", + "blanchedalmond": "ffebcd", + "blue": "0000ff", + "blueviolet": "8a2be2", + "brown": "a52a2a", + "burlywood": "deb887", + "cadetblue": "5f9ea0", + "chartreuse": "7fff00", + "chocolate": "d2691e", + "coral": "ff7f50", + "cornflowerblue": "6495ed", + "cornsilk": "fff8dc", + "crimson": "dc143c", + "cyan": "00ffff", + "darkblue": "00008b", + "darkcyan": "008b8b", + "darkgoldenrod": "b8860b", + "darkgray": "a9a9a9", + "darkgreen": "006400", + "darkkhaki": "bdb76b", + "darkmagenta": "8b008b", + "darkolivegreen": "556b2f", + "darkorange": "ff8c00", + "darkorchid": "9932cc", + "darkred": "8b0000", + "darksalmon": "e9967a", + "darkseagreen": "8fbc8f", + "darkslateblue": "483d8b", + "darkslategray": "2f4f4f", + "darkturquoise": "00ced1", + "darkviolet": "9400d3", + "deeppink": "ff1493", + "deepskyblue": "00bfff", + "dimgray": "696969", + "dodgerblue": "1e90ff", + "firebrick": "b22222", + "floralwhite": "fffaf0", + "forestgreen": "228b22", + "fuchsia": "ff00ff", + "gainsboro": "dcdcdc", + "ghostwhite": "f8f8ff", + "gold": "ffd700", + "goldenrod": "daa520", + "gray": "808080", + "green": "008000", + "greenyellow": "adff2f", + "honeydew": "f0fff0", + "hotpink": "ff69b4", + "indianred": "cd5c5c", + "indigo": "4b0082", + "ivory": "fffff0", + "khaki": "f0e68c", + "lavender": "e6e6fa", + "lavenderblush": "fff0f5", + "lawngreen": "7cfc00", + "lemonchiffon": "fffacd", + "lightblue": "add8e6", + "lightcoral": "f08080", + "lightcyan": "e0ffff", + "lightgoldenrodyellow": "fafad2", + "lightgrey": "d3d3d3", + "lightgreen": "90ee90", + "lightpink": "ffb6c1", + "lightsalmon": "ffa07a", + "lightseagreen": "20b2aa", + "lightskyblue": "87cefa", + "lightslategray": "778899", + "lightsteelblue": "b0c4de", + "lightyellow": "ffffe0", + "lime": "00ff00", + "limegreen": "32cd32", + "linen": "faf0e6", + "magenta": "ff00ff", + "maroon": "800000", + "mediumaquamarine": "66cdaa", + "mediumblue": "0000cd", + "mediumorchid": "ba55d3", + "mediumpurple": "9370d8", + "mediumseagreen": "3cb371", + "mediumslateblue": "7b68ee", + "mediumspringgreen": "00fa9a", + "mediumturquoise": "48d1cc", + "mediumvioletred": "c71585", + "midnightblue": "191970", + "mintcream": "f5fffa", + "mistyrose": "ffe4e1", + "moccasin": "ffe4b5", + "navajowhite": "ffdead", + "navy": "000080", + "oldlace": "fdf5e6", + "olive": "808000", + "olivedrab": "6b8e23", + "orange": "ffa500", + "orangered": "ff4500", + "orchid": "da70d6", + "palegoldenrod": "eee8aa", + "palegreen": "98fb98", + "paleturquoise": "afeeee", + "palevioletred": "d87093", + "papayawhip": "ffefd5", + "peachpuff": "ffdab9", + "peru": "cd853f", + "pink": "ffc0cb", + "plum": "dda0dd", + "powderblue": "b0e0e6", + "purple": "800080", + "red": "ff0000", + "rosybrown": "bc8f8f", + "royalblue": "4169e1", + "saddlebrown": "8b4513", + "salmon": "fa8072", + "sandybrown": "f4a460", + "seagreen": "2e8b57", + "seashell": "fff5ee", + "sienna": "a0522d", + "silver": "c0c0c0", + "skyblue": "87ceeb", + "slateblue": "6a5acd", + "slategray": "708090", + "snow": "fffafa", + "springgreen": "00ff7f", + "steelblue": "4682b4", + "tan": "d2b48c", + "teal": "008080", + "thistle": "d8bfd8", + "tomato": "ff6347", + "turquoise": "40e0d0", + "violet": "ee82ee", + "wheat": "f5deb3", + "white": "ffffff", + "whitesmoke": "f5f5f5", + "yellow": "ffff00", + "yellowgreen": "9acd32", + "transparent": "transparent" + }; + + Color.prototype = { + constructor: Color, + colors: {}, // merged web and predefined colors + predefinedColors: {}, + /** + * @return {Object} + */ + getValue: function() { + return this.value; + }, + /** + * @param {Object} val + */ + setValue: function(val) { + this.value = val; + }, + _sanitizeNumber: function(val) { + if (typeof val === 'number') { + return val; + } + if (isNaN(val) || (val === null) || (val === '') || (val === undefined)) { + return 1; + } + if (val === '') { + return 0; + } + if (typeof val.toLowerCase !== 'undefined') { + if (val.match(/^\./)) { + val = "0" + val; + } + return Math.ceil(parseFloat(val) * 100) / 100; + } + return 1; + }, + isTransparent: function(strVal) { + if (!strVal || !(typeof strVal === 'string' || strVal instanceof String)) { + return false; + } + strVal = strVal.toLowerCase().trim(); + return (strVal === 'transparent') || (strVal.match(/#?00000000/)) || (strVal.match(/(rgba|hsla)\(0,0,0,0?\.?0\)/)); + }, + rgbaIsTransparent: function(rgba) { + return ((rgba.r === 0) && (rgba.g === 0) && (rgba.b === 0) && (rgba.a === 0)); + }, + // parse a string to HSB + /** + * @protected + * @param {String} strVal + * @returns {boolean} Returns true if it could be parsed, false otherwise + */ + setColor: function(strVal) { + strVal = strVal.toLowerCase().trim(); + if (strVal) { + if (this.isTransparent(strVal)) { + this.value = { + h: 0, + s: 0, + b: 0, + a: 0 + }; + return true; + } else { + var parsedColor = this.parse(strVal); + if (parsedColor) { + this.value = this.value = { + h: parsedColor.h, + s: parsedColor.s, + b: parsedColor.b, + a: parsedColor.a + }; + if (!this.origFormat) { + this.origFormat = parsedColor.format; + } + } else if (this.fallbackValue) { + // if parser fails, defaults to fallbackValue if defined, otherwise the value won't be changed + this.value = this.fallbackValue; + } + } + } + return false; + }, + setHue: function(h) { + this.value.h = 1 - h; + }, + setSaturation: function(s) { + this.value.s = s; + }, + setBrightness: function(b) { + this.value.b = 1 - b; + }, + setAlpha: function(a) { + this.value.a = Math.round((parseInt((1 - a) * 100, 10) / 100) * 100) / 100; + }, + toRGB: function(h, s, b, a) { + if (arguments.length === 0) { + h = this.value.h; + s = this.value.s; + b = this.value.b; + a = this.value.a; + } + + h *= 360; + var R, G, B, X, C; + h = (h % 360) / 60; + C = b * s; + X = C * (1 - Math.abs(h % 2 - 1)); + R = G = B = b - C; + + h = ~~h; + R += [C, X, 0, 0, X, C][h]; + G += [X, C, C, X, 0, 0][h]; + B += [0, 0, X, C, C, X][h]; + + return { + r: Math.round(R * 255), + g: Math.round(G * 255), + b: Math.round(B * 255), + a: a + }; + }, + toHex: function(ignoreFormat, h, s, b, a) { + if (arguments.length <= 1) { + h = this.value.h; + s = this.value.s; + b = this.value.b; + a = this.value.a; + } + + var prefix = '#'; + var rgb = this.toRGB(h, s, b, a); + + if (this.rgbaIsTransparent(rgb)) { + return 'transparent'; + } + + if (!ignoreFormat) { + prefix = (this.hexNumberSignPrefix ? '#' : ''); + } + + var hexStr = prefix + ( + (1 << 24) + + (parseInt(rgb.r) << 16) + + (parseInt(rgb.g) << 8) + + parseInt(rgb.b)) + .toString(16) + .slice(1); + + return hexStr; + }, + toHSL: function(h, s, b, a) { + if (arguments.length === 0) { + h = this.value.h; + s = this.value.s; + b = this.value.b; + a = this.value.a; + } + + var H = h, + L = (2 - s) * b, + S = s * b; + if (L > 0 && L <= 1) { + S /= L; + } else { + S /= 2 - L; + } + L /= 2; + if (S > 1) { + S = 1; + } + return { + h: isNaN(H) ? 0 : H, + s: isNaN(S) ? 0 : S, + l: isNaN(L) ? 0 : L, + a: isNaN(a) ? 0 : a + }; + }, + toAlias: function(r, g, b, a) { + var c, rgb = (arguments.length === 0) ? this.toHex(true) : this.toHex(true, r, g, b, a); + + // support predef. colors in non-hex format too, as defined in the alias itself + var original = this.origFormat === 'alias' ? rgb : this.toString(false, this.origFormat); + + for (var alias in this.colors) { + c = this.colors[alias].toLowerCase().trim(); + if ((c === rgb) || (c === original)) { + return alias; + } + } + return false; + }, + RGBtoHSB: function(r, g, b, a) { + r /= 255; + g /= 255; + b /= 255; + + var H, S, V, C; + V = Math.max(r, g, b); + C = V - Math.min(r, g, b); + H = (C === 0 ? null : + V === r ? (g - b) / C : + V === g ? (b - r) / C + 2 : + (r - g) / C + 4 + ); + H = ((H + 360) % 6) * 60 / 360; + S = C === 0 ? 0 : C / V; + return { + h: this._sanitizeNumber(H), + s: S, + b: V, + a: this._sanitizeNumber(a) + }; + }, + HueToRGB: function(p, q, h) { + if (h < 0) { + h += 1; + } else if (h > 1) { + h -= 1; + } + if ((h * 6) < 1) { + return p + (q - p) * h * 6; + } else if ((h * 2) < 1) { + return q; + } else if ((h * 3) < 2) { + return p + (q - p) * ((2 / 3) - h) * 6; + } else { + return p; + } + }, + HSLtoRGB: function(h, s, l, a) { + if (s < 0) { + s = 0; + } + var q; + if (l <= 0.5) { + q = l * (1 + s); + } else { + q = l + s - (l * s); + } + + var p = 2 * l - q; + + var tr = h + (1 / 3); + var tg = h; + var tb = h - (1 / 3); + + var r = Math.round(this.HueToRGB(p, q, tr) * 255); + var g = Math.round(this.HueToRGB(p, q, tg) * 255); + var b = Math.round(this.HueToRGB(p, q, tb) * 255); + return [r, g, b, this._sanitizeNumber(a)]; + }, + /** + * @param {String} strVal + * @returns {Object} Object containing h,s,b,a,format properties or FALSE if failed to parse + */ + parse: function(strVal) { + if (typeof strVal !== 'string') { + return this.fallbackValue; + } + if (arguments.length === 0) { + return false; + } + + var that = this, + result = false, + isAlias = (typeof this.colors[strVal] !== 'undefined'), + values, format; + + if (isAlias) { + strVal = this.colors[strVal].toLowerCase().trim(); + } + + $.each(this.stringParsers, function(i, parser) { + var match = parser.re.exec(strVal); + values = match && parser.parse.apply(that, [match]); + if (values) { + result = {}; + format = (isAlias ? 'alias' : (parser.format ? parser.format : that.getValidFallbackFormat())); + if (format.match(/hsla?/)) { + result = that.RGBtoHSB.apply(that, that.HSLtoRGB.apply(that, values)); + } else { + result = that.RGBtoHSB.apply(that, values); + } + if (result instanceof Object) { + result.format = format; + } + return false; // stop iterating + } + return true; + }); + return result; + }, + getValidFallbackFormat: function() { + var formats = [ + 'rgba', 'rgb', 'hex', 'hsla', 'hsl' + ]; + if (this.origFormat && (formats.indexOf(this.origFormat) !== -1)) { + return this.origFormat; + } + if (this.fallbackFormat && (formats.indexOf(this.fallbackFormat) !== -1)) { + return this.fallbackFormat; + } + + return 'rgba'; // By default, return a format that will not lose the alpha info + }, + /** + * + * @param {string} [format] (default: rgba) + * @param {boolean} [translateAlias] Return real color for pre-defined (non-standard) aliases (default: false) + * @param {boolean} [forceRawValue] Forces hashtag prefix when getting hex color (default: false) + * @returns {String} + */ + toString: function(forceRawValue, format, translateAlias) { + format = format || this.origFormat || this.fallbackFormat; + translateAlias = translateAlias || false; + + var c = false; + + switch (format) { + case 'rgb': + { + c = this.toRGB(); + if (this.rgbaIsTransparent(c)) { + return 'transparent'; + } + return 'rgb(' + c.r + ',' + c.g + ',' + c.b + ')'; + } + break; + case 'rgba': + { + c = this.toRGB(); + return 'rgba(' + c.r + ',' + c.g + ',' + c.b + ',' + c.a + ')'; + } + break; + case 'hsl': + { + c = this.toHSL(); + return 'hsl(' + Math.round(c.h * 360) + ',' + Math.round(c.s * 100) + '%,' + Math.round(c.l * 100) + '%)'; + } + break; + case 'hsla': + { + c = this.toHSL(); + return 'hsla(' + Math.round(c.h * 360) + ',' + Math.round(c.s * 100) + '%,' + Math.round(c.l * 100) + '%,' + c.a + ')'; + } + break; + case 'hex': + { + return this.toHex(forceRawValue); + } + break; + case 'alias': + { + c = this.toAlias(); + + if (c === false) { + return this.toString(forceRawValue, this.getValidFallbackFormat()); + } + + if (translateAlias && !(c in Color.webColors) && (c in this.predefinedColors)) { + return this.predefinedColors[c]; + } + + return c; + } + default: + { + return c; + } + break; + } + }, + // a set of RE's that can match strings and generate color tuples. + // from John Resig color plugin + // https://github.com/jquery/jquery-color/ + stringParsers: [{ + re: /rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*?\)/, + format: 'rgb', + parse: function(execResult) { + return [ + execResult[1], + execResult[2], + execResult[3], + 1 + ]; + } + }, { + re: /rgb\(\s*(\d*(?:\.\d+)?)\%\s*,\s*(\d*(?:\.\d+)?)\%\s*,\s*(\d*(?:\.\d+)?)\%\s*?\)/, + format: 'rgb', + parse: function(execResult) { + return [ + 2.55 * execResult[1], + 2.55 * execResult[2], + 2.55 * execResult[3], + 1 + ]; + } + }, { + re: /rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d*(?:\.\d+)?)\s*)?\)/, + format: 'rgba', + parse: function(execResult) { + return [ + execResult[1], + execResult[2], + execResult[3], + execResult[4] + ]; + } + }, { + re: /rgba\(\s*(\d*(?:\.\d+)?)\%\s*,\s*(\d*(?:\.\d+)?)\%\s*,\s*(\d*(?:\.\d+)?)\%\s*(?:,\s*(\d*(?:\.\d+)?)\s*)?\)/, + format: 'rgba', + parse: function(execResult) { + return [ + 2.55 * execResult[1], + 2.55 * execResult[2], + 2.55 * execResult[3], + execResult[4] + ]; + } + }, { + re: /hsl\(\s*(\d*(?:\.\d+)?)\s*,\s*(\d*(?:\.\d+)?)\%\s*,\s*(\d*(?:\.\d+)?)\%\s*?\)/, + format: 'hsl', + parse: function(execResult) { + return [ + execResult[1] / 360, + execResult[2] / 100, + execResult[3] / 100, + execResult[4] + ]; + } + }, { + re: /hsla\(\s*(\d*(?:\.\d+)?)\s*,\s*(\d*(?:\.\d+)?)\%\s*,\s*(\d*(?:\.\d+)?)\%\s*(?:,\s*(\d*(?:\.\d+)?)\s*)?\)/, + format: 'hsla', + parse: function(execResult) { + return [ + execResult[1] / 360, + execResult[2] / 100, + execResult[3] / 100, + execResult[4] + ]; + } + }, { + re: /#?([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/, + format: 'hex', + parse: function(execResult) { + return [ + parseInt(execResult[1], 16), + parseInt(execResult[2], 16), + parseInt(execResult[3], 16), + 1 + ]; + } + }, { + re: /#?([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/, + format: 'hex', + parse: function(execResult) { + return [ + parseInt(execResult[1] + execResult[1], 16), + parseInt(execResult[2] + execResult[2], 16), + parseInt(execResult[3] + execResult[3], 16), + 1 + ]; + } + }], + colorNameToHex: function(name) { + if (typeof this.colors[name.toLowerCase()] !== 'undefined') { + return this.colors[name.toLowerCase()]; + } + return false; + } + }; + + /* + * Default plugin options + */ + var defaults = { + horizontal: false, // horizontal mode layout ? + inline: false, //forces to show the colorpicker as an inline element + color: false, //forces a color + format: false, //forces a format + input: 'input', // children input selector + container: false, // container selector + component: '.add-on, .input-group-addon', // children component selector + fallbackColor: false, // fallback color value. null = keeps current color. + fallbackFormat: 'hex', // fallback color format + hexNumberSignPrefix: true, // put a '#' (number sign) before hex strings + sliders: { + saturation: { + maxLeft: 100, + maxTop: 100, + callLeft: 'setSaturation', + callTop: 'setBrightness' + }, + hue: { + maxLeft: 0, + maxTop: 100, + callLeft: false, + callTop: 'setHue' + }, + alpha: { + maxLeft: 0, + maxTop: 100, + callLeft: false, + callTop: 'setAlpha' + } + }, + slidersHorz: { + saturation: { + maxLeft: 100, + maxTop: 100, + callLeft: 'setSaturation', + callTop: 'setBrightness' + }, + hue: { + maxLeft: 100, + maxTop: 0, + callLeft: 'setHue', + callTop: false + }, + alpha: { + maxLeft: 100, + maxTop: 0, + callLeft: 'setAlpha', + callTop: false + } + }, + template: '"); + jQuery("#event_box").append(t), l(t) + }; + $("#external-events div.external-event").each(function() { + l($(this)) + }), $(document).on('click', '#event_add', function () { + var e = $("#event_title").val(); + o(e) + }), $("#event_box").html(""), o("Holiday"), o("Wife Birthday"), o("Meeting"), o("Anniversary"), o("Dinner"), o("Party"), $("#calendar").fullCalendar("destroy"), $("#calendar").fullCalendar({ + header: r, + defaultView: "month", + slotMinutes: 15, + editable: !0, + droppable: !0, + drop: function(e, t) { + var a = $(this).data("eventObject"), + n = $.extend({}, a); + n.start = e, n.allDay = t, n.className = $(this).attr("data-class"), $("#calendar").fullCalendar("renderEvent", n, !0), $("#drop-remove").is(":checked") && $(this).remove() + }, + + /***** events ********/ + events: [{ + title: "All Day Event", + start: new Date('2016-11-01'), + backgroundColor: "#00FFFF" + }, { + title: "Long Event", + start: new Date('2016-11-07'), + end: new Date('2016-11-10'), + backgroundColor: "#F3565D" + }, { + title: "Repeating Event", + start: new Date('2016-11-16'), + allDay: !1, + backgroundColor: "#1bbc9b" + }, { + title: "Repeating Event", + start: new Date(n, a, t +5, 16, 0), + allDay: !1, + backgroundColor: "#1bbc9b" + }, { + title: "Meeting", + start: new Date(n, a, t, 10, 30), + allDay: !1 + }, { + title: "Lunch", + start: new Date(n, a, t, 12, 0), + end: new Date(n, a, t, 14, 0), + backgroundColor: "#F8CB00", + allDay: !1 + }, { + title: "Birthday Party", + start: new Date(n, a, t + 1, 19, 0), + end: new Date(n, a, t + 1, 22, 30), + backgroundColor: "#9b59b6", + allDay: !1 + }, { + title: "Click for Google", + start: new Date(n, a, 29), + end: new Date(n, a, 30), + backgroundColor: "#9b59b6", + url: "http://google.com/" + }] + }) + } + } + } +}(); +jQuery(document).ready(function() { + 'use strict'; + AppCalendar.init() +}); \ No newline at end of file diff --git a/assets/chart-js/Chart.bundle.js b/assets/chart-js/Chart.bundle.js new file mode 100644 index 0000000..8316b52 --- /dev/null +++ b/assets/chart-js/Chart.bundle.js @@ -0,0 +1,1120 @@ +(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Chart=f()}})(function(){var define,module,exports;return(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;olum2){return(lum1+0.05)/(lum2+0.05);} +return(lum2+0.05)/(lum1+0.05);},level:function(color2){var contrastRatio=this.contrast(color2);if(contrastRatio>=7.1){return'AAA';} +return(contrastRatio>=4.5)?'AA':'';},dark:function(){var rgb=this.values.rgb;var yiq=(rgb[0]*299+rgb[1]*587+rgb[2]*114)/1000;return yiq<128;},light:function(){return!this.dark();},negate:function(){var rgb=[];for(var i=0;i<3;i++){rgb[i]=255-this.values.rgb[i];} +this.setValues('rgb',rgb);return this;},lighten:function(ratio){var hsl=this.values.hsl;hsl[2]+=hsl[2]*ratio;this.setValues('hsl',hsl);return this;},darken:function(ratio){var hsl=this.values.hsl;hsl[2]-=hsl[2]*ratio;this.setValues('hsl',hsl);return this;},saturate:function(ratio){var hsl=this.values.hsl;hsl[1]+=hsl[1]*ratio;this.setValues('hsl',hsl);return this;},desaturate:function(ratio){var hsl=this.values.hsl;hsl[1]-=hsl[1]*ratio;this.setValues('hsl',hsl);return this;},whiten:function(ratio){var hwb=this.values.hwb;hwb[1]+=hwb[1]*ratio;this.setValues('hwb',hwb);return this;},blacken:function(ratio){var hwb=this.values.hwb;hwb[2]+=hwb[2]*ratio;this.setValues('hwb',hwb);return this;},greyscale:function(){var rgb=this.values.rgb;var val=rgb[0]*0.3+rgb[1]*0.59+rgb[2]*0.11;this.setValues('rgb',[val,val,val]);return this;},clearer:function(ratio){var alpha=this.values.alpha;this.setValues('alpha',alpha-(alpha*ratio));return this;},opaquer:function(ratio){var alpha=this.values.alpha;this.setValues('alpha',alpha+(alpha*ratio));return this;},rotate:function(degrees){var hsl=this.values.hsl;var hue=(hsl[0]+degrees)%360;hsl[0]=hue<0?360+hue:hue;this.setValues('hsl',hsl);return this;},mix:function(mixinColor,weight){var color1=this;var color2=mixinColor;var p=weight===undefined?0.5:weight;var w=2*p-1;var a=color1.alpha()-color2.alpha();var w1=(((w*a===-1)?w:(w+a)/(1+w*a))+1)/2.0;var w2=1-w1;return this.rgb(w1*color1.red()+w2*color2.red(),w1*color1.green()+w2*color2.green(),w1*color1.blue()+w2*color2.blue()).alpha(color1.alpha()*p+color2.alpha()*(1-p));},toJSON:function(){return this.rgb();},clone:function(){var result=new Color();var source=this.values;var target=result.values;var value,type;for(var prop in source){if(source.hasOwnProperty(prop)){value=source[prop];type=({}).toString.call(value);if(type==='[object Array]'){target[prop]=value.slice(0);}else if(type==='[object Number]'){target[prop]=value;}else{console.error('unexpected color value:',value);}}} +return result;}};Color.prototype.spaces={rgb:['red','green','blue'],hsl:['hue','saturation','lightness'],hsv:['hue','saturation','value'],hwb:['hue','whiteness','blackness'],cmyk:['cyan','magenta','yellow','black']};Color.prototype.maxes={rgb:[255,255,255],hsl:[360,100,100],hsv:[360,100,100],hwb:[360,100,100],cmyk:[100,100,100,100]};Color.prototype.getValues=function(space){var values=this.values;var vals={};for(var i=0;i0.04045?Math.pow(((r+0.055)/1.055),2.4):(r/12.92);g=g>0.04045?Math.pow(((g+0.055)/1.055),2.4):(g/12.92);b=b>0.04045?Math.pow(((b+0.055)/1.055),2.4):(b/12.92);var x=(r*0.4124)+(g*0.3576)+(b*0.1805);var y=(r*0.2126)+(g*0.7152)+(b*0.0722);var z=(r*0.0193)+(g*0.1192)+(b*0.9505);return[x*100,y*100,z*100];} +function rgb2lab(rgb){var xyz=rgb2xyz(rgb),x=xyz[0],y=xyz[1],z=xyz[2],l,a,b;x/=95.047;y/=100;z/=108.883;x=x>0.008856?Math.pow(x,1/3):(7.787*x)+(16/116);y=y>0.008856?Math.pow(y,1/3):(7.787*y)+(16/116);z=z>0.008856?Math.pow(z,1/3):(7.787*z)+(16/116);l=(116*y)-16;a=500*(x-y);b=200*(y-z);return[l,a,b];} +function rgb2lch(args){return lab2lch(rgb2lab(args));} +function hsl2rgb(hsl){var h=hsl[0]/360,s=hsl[1]/100,l=hsl[2]/100,t1,t2,t3,rgb,val;if(s==0){val=l*255;return[val,val,val];} +if(l<0.5) +t2=l*(1+s);else +t2=l+s-l*s;t1=2*l-t2;rgb=[0,0,0];for(var i=0;i<3;i++){t3=h+1/3*-(i-1);t3<0&&t3++;t3>1&&t3--;if(6*t3<1) +val=t1+(t2-t1)*6*t3;else if(2*t3<1) +val=t2;else if(3*t3<2) +val=t1+(t2-t1)*(2/3-t3)*6;else +val=t1;rgb[i]=val*255;} +return rgb;} +function hsl2hsv(hsl){var h=hsl[0],s=hsl[1]/100,l=hsl[2]/100,sv,v;if(l===0){return[0,0,0];} +l*=2;s*=(l<=1)?l:2-l;v=(l+s)/2;sv=(2*s)/(l+s);return[h,sv*100,v*100];} +function hsl2hwb(args){return rgb2hwb(hsl2rgb(args));} +function hsl2cmyk(args){return rgb2cmyk(hsl2rgb(args));} +function hsl2keyword(args){return rgb2keyword(hsl2rgb(args));} +function hsv2rgb(hsv){var h=hsv[0]/60,s=hsv[1]/100,v=hsv[2]/100,hi=Math.floor(h)%6;var f=h-Math.floor(h),p=255*v*(1-s),q=255*v*(1-(s*f)),t=255*v*(1-(s*(1-f))),v=255*v;switch(hi){case 0:return[v,t,p];case 1:return[q,v,p];case 2:return[p,v,t];case 3:return[p,q,v];case 4:return[t,p,v];case 5:return[v,p,q];}} +function hsv2hsl(hsv){var h=hsv[0],s=hsv[1]/100,v=hsv[2]/100,sl,l;l=(2-s)*v;sl=s*v;sl/=(l<=1)?l:2-l;sl=sl||0;l/=2;return[h,sl*100,l*100];} +function hsv2hwb(args){return rgb2hwb(hsv2rgb(args))} +function hsv2cmyk(args){return rgb2cmyk(hsv2rgb(args));} +function hsv2keyword(args){return rgb2keyword(hsv2rgb(args));} +function hwb2rgb(hwb){var h=hwb[0]/360,wh=hwb[1]/100,bl=hwb[2]/100,ratio=wh+bl,i,v,f,n;if(ratio>1){wh/=ratio;bl/=ratio;} +i=Math.floor(6*h);v=1-bl;f=6*h-i;if((i&0x01)!=0){f=1-f;} +n=wh+f*(v-wh);switch(i){default:case 6:case 0:r=v;g=n;b=wh;break;case 1:r=n;g=v;b=wh;break;case 2:r=wh;g=v;b=n;break;case 3:r=wh;g=n;b=v;break;case 4:r=n;g=wh;b=v;break;case 5:r=v;g=wh;b=n;break;} +return[r*255,g*255,b*255];} +function hwb2hsl(args){return rgb2hsl(hwb2rgb(args));} +function hwb2hsv(args){return rgb2hsv(hwb2rgb(args));} +function hwb2cmyk(args){return rgb2cmyk(hwb2rgb(args));} +function hwb2keyword(args){return rgb2keyword(hwb2rgb(args));} +function cmyk2rgb(cmyk){var c=cmyk[0]/100,m=cmyk[1]/100,y=cmyk[2]/100,k=cmyk[3]/100,r,g,b;r=1-Math.min(1,c*(1-k)+k);g=1-Math.min(1,m*(1-k)+k);b=1-Math.min(1,y*(1-k)+k);return[r*255,g*255,b*255];} +function cmyk2hsl(args){return rgb2hsl(cmyk2rgb(args));} +function cmyk2hsv(args){return rgb2hsv(cmyk2rgb(args));} +function cmyk2hwb(args){return rgb2hwb(cmyk2rgb(args));} +function cmyk2keyword(args){return rgb2keyword(cmyk2rgb(args));} +function xyz2rgb(xyz){var x=xyz[0]/100,y=xyz[1]/100,z=xyz[2]/100,r,g,b;r=(x*3.2406)+(y*-1.5372)+(z*-0.4986);g=(x*-0.9689)+(y*1.8758)+(z*0.0415);b=(x*0.0557)+(y*-0.2040)+(z*1.0570);r=r>0.0031308?((1.055*Math.pow(r,1.0/2.4))-0.055):r=(r*12.92);g=g>0.0031308?((1.055*Math.pow(g,1.0/2.4))-0.055):g=(g*12.92);b=b>0.0031308?((1.055*Math.pow(b,1.0/2.4))-0.055):b=(b*12.92);r=Math.min(Math.max(0,r),1);g=Math.min(Math.max(0,g),1);b=Math.min(Math.max(0,b),1);return[r*255,g*255,b*255];} +function xyz2lab(xyz){var x=xyz[0],y=xyz[1],z=xyz[2],l,a,b;x/=95.047;y/=100;z/=108.883;x=x>0.008856?Math.pow(x,1/3):(7.787*x)+(16/116);y=y>0.008856?Math.pow(y,1/3):(7.787*y)+(16/116);z=z>0.008856?Math.pow(z,1/3):(7.787*z)+(16/116);l=(116*y)-16;a=500*(x-y);b=200*(y-z);return[l,a,b];} +function xyz2lch(args){return lab2lch(xyz2lab(args));} +function lab2xyz(lab){var l=lab[0],a=lab[1],b=lab[2],x,y,z,y2;if(l<=8){y=(l*100)/903.3;y2=(7.787*(y/100))+(16/116);}else{y=100*Math.pow((l+16)/116,3);y2=Math.pow(y/100,1/3);} +x=x/95.047<=0.008856?x=(95.047*((a/500)+y2-(16/116)))/7.787:95.047*Math.pow((a/500)+y2,3);z=z/108.883<=0.008859?z=(108.883*(y2-(b/200)-(16/116)))/7.787:108.883*Math.pow(y2-(b/200),3);return[x,y,z];} +function lab2lch(lab){var l=lab[0],a=lab[1],b=lab[2],hr,h,c;hr=Math.atan2(b,a);h=hr*360/2/Math.PI;if(h<0){h+=360;} +c=Math.sqrt(a*a+b*b);return[l,c,h];} +function lab2rgb(args){return xyz2rgb(lab2xyz(args));} +function lch2lab(lch){var l=lch[0],c=lch[1],h=lch[2],a,b,hr;hr=h/360*2*Math.PI;a=c*Math.cos(hr);b=c*Math.sin(hr);return[l,a,b];} +function lch2xyz(args){return lab2xyz(lch2lab(args));} +function lch2rgb(args){return lab2rgb(lch2lab(args));} +function keyword2rgb(keyword){return cssKeywords[keyword];} +function keyword2hsl(args){return rgb2hsl(keyword2rgb(args));} +function keyword2hsv(args){return rgb2hsv(keyword2rgb(args));} +function keyword2hwb(args){return rgb2hwb(keyword2rgb(args));} +function keyword2cmyk(args){return rgb2cmyk(keyword2rgb(args));} +function keyword2lab(args){return rgb2lab(keyword2rgb(args));} +function keyword2xyz(args){return rgb2xyz(keyword2rgb(args));} +var cssKeywords={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};var reverseKeywords={};for(var key in cssKeywords){reverseKeywords[JSON.stringify(cssKeywords[key])]=key;}},{}],4:[function(require,module,exports){var conversions=require(3);var convert=function(){return new Converter();} +for(var func in conversions){convert[func+"Raw"]=(function(func){return function(arg){if(typeof arg=="number") +arg=Array.prototype.slice.call(arguments);return conversions[func](arg);}})(func);var pair=/(\w+)2(\w+)/.exec(func),from=pair[1],to=pair[2];convert[from]=convert[from]||{};convert[from][to]=convert[func]=(function(func){return function(arg){if(typeof arg=="number") +arg=Array.prototype.slice.call(arguments);var val=conversions[func](arg);if(typeof val=="string"||val===undefined) +return val;for(var i=0;i>>0;for(var i=0;i0){for(i=0;i0?'future':'past'];return isFunction(format)?format(output):format.replace(/%s/i,output);} +var aliases={};function addUnitAlias(unit,shorthand){var lowerCase=unit.toLowerCase();aliases[lowerCase]=aliases[lowerCase+'s']=aliases[shorthand]=unit;} +function normalizeUnits(units){return typeof units==='string'?aliases[units]||aliases[units.toLowerCase()]:undefined;} +function normalizeObjectUnits(inputObject){var normalizedInput={},normalizedProp,prop;for(prop in inputObject){if(hasOwnProp(inputObject,prop)){normalizedProp=normalizeUnits(prop);if(normalizedProp){normalizedInput[normalizedProp]=inputObject[prop];}}} +return normalizedInput;} +var priorities={};function addUnitPriority(unit,priority){priorities[unit]=priority;} +function getPrioritizedUnits(unitsObj){var units=[];for(var u in unitsObj){units.push({unit:u,priority:priorities[u]});} +units.sort(function(a,b){return a.priority-b.priority;});return units;} +function makeGetSet(unit,keepTime){return function(value){if(value!=null){set$1(this,unit,value);hooks.updateOffset(this,keepTime);return this;}else{return get(this,unit);}};} +function get(mom,unit){return mom.isValid()?mom._d['get'+(mom._isUTC?'UTC':'')+unit]():NaN;} +function set$1(mom,unit,value){if(mom.isValid()){mom._d['set'+(mom._isUTC?'UTC':'')+unit](value);}} +function stringGet(units){units=normalizeUnits(units);if(isFunction(this[units])){return this[units]();} +return this;} +function stringSet(units,value){if(typeof units==='object'){units=normalizeObjectUnits(units);var prioritized=getPrioritizedUnits(units);for(var i=0;i=0;return(sign?(forceSign?'+':''):'-')+Math.pow(10,Math.max(0,zerosToFill)).toString().substr(1)+absNumber;} +var formattingTokens=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g;var localFormattingTokens=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g;var formatFunctions={};var formatTokenFunctions={};function addFormatToken(token,padded,ordinal,callback){var func=callback;if(typeof callback==='string'){func=function(){return this[callback]();};} +if(token){formatTokenFunctions[token]=func;} +if(padded){formatTokenFunctions[padded[0]]=function(){return zeroFill(func.apply(this,arguments),padded[1],padded[2]);};} +if(ordinal){formatTokenFunctions[ordinal]=function(){return this.localeData().ordinal(func.apply(this,arguments),token);};}} +function removeFormattingTokens(input){if(input.match(/\[[\s\S]/)){return input.replace(/^\[|\]$/g,'');} +return input.replace(/\\/g,'');} +function makeFormatFunction(format){var array=format.match(formattingTokens),i,length;for(i=0,length=array.length;i=0&&localFormattingTokens.test(format)){format=format.replace(localFormattingTokens,replaceLongDateFormatTokens);localFormattingTokens.lastIndex=0;i-=1;} +return format;} +var match1=/\d/;var match2=/\d\d/;var match3=/\d{3}/;var match4=/\d{4}/;var match6=/[+-]?\d{6}/;var match1to2=/\d\d?/;var match3to4=/\d\d\d\d?/;var match5to6=/\d\d\d\d\d\d?/;var match1to3=/\d{1,3}/;var match1to4=/\d{1,4}/;var match1to6=/[+-]?\d{1,6}/;var matchUnsigned=/\d+/;var matchSigned=/[+-]?\d+/;var matchOffset=/Z|[+-]\d\d:?\d\d/gi;var matchShortOffset=/Z|[+-]\d\d(?::?\d\d)?/gi;var matchTimestamp=/[+-]?\d+(\.\d{1,3})?/;var matchWord=/[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i;var regexes={};function addRegexToken(token,regex,strictRegex){regexes[token]=isFunction(regex)?regex:function(isStrict,localeData){return(isStrict&&strictRegex)?strictRegex:regex;};} +function getParseRegexForToken(token,config){if(!hasOwnProp(regexes,token)){return new RegExp(unescapeFormat(token));} +return regexes[token](config._strict,config._locale);} +function unescapeFormat(s){return regexEscape(s.replace('\\','').replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(matched,p1,p2,p3,p4){return p1||p2||p3||p4;}));} +function regexEscape(s){return s.replace(/[-\/\\^$*+?.()|[\]{}]/g,'\\$&');} +var tokens={};function addParseToken(token,callback){var i,func=callback;if(typeof token==='string'){token=[token];} +if(isNumber(callback)){func=function(input,array){array[callback]=toInt(input);};} +for(i=0;i68?1900:2000);};var getSetYear=makeGetSet('FullYear',true);function getIsLeapYear(){return isLeapYear(this.year());} +function createDate(y,m,d,h,M,s,ms){var date=new Date(y,m,d,h,M,s,ms);if(y<100&&y>=0&&isFinite(date.getFullYear())){date.setFullYear(y);} +return date;} +function createUTCDate(y){var date=new Date(Date.UTC.apply(null,arguments));if(y<100&&y>=0&&isFinite(date.getUTCFullYear())){date.setUTCFullYear(y);} +return date;} +function firstWeekOffset(year,dow,doy){var +fwd=7+dow-doy,fwdlw=(7+createUTCDate(year,0,fwd).getUTCDay()-dow)%7;return-fwdlw+fwd-1;} +function dayOfYearFromWeeks(year,week,weekday,dow,doy){var localWeekday=(7+weekday-dow)%7,weekOffset=firstWeekOffset(year,dow,doy),dayOfYear=1+7*(week-1)+localWeekday+weekOffset,resYear,resDayOfYear;if(dayOfYear<=0){resYear=year-1;resDayOfYear=daysInYear(resYear)+dayOfYear;}else if(dayOfYear>daysInYear(year)){resYear=year+1;resDayOfYear=dayOfYear-daysInYear(year);}else{resYear=year;resDayOfYear=dayOfYear;} +return{year:resYear,dayOfYear:resDayOfYear};} +function weekOfYear(mom,dow,doy){var weekOffset=firstWeekOffset(mom.year(),dow,doy),week=Math.floor((mom.dayOfYear()-weekOffset-1)/7)+1,resWeek,resYear;if(week<1){resYear=mom.year()-1;resWeek=week+weeksInYear(resYear,dow,doy);}else if(week>weeksInYear(mom.year(),dow,doy)){resWeek=week-weeksInYear(mom.year(),dow,doy);resYear=mom.year()+1;}else{resYear=mom.year();resWeek=week;} +return{week:resWeek,year:resYear};} +function weeksInYear(year,dow,doy){var weekOffset=firstWeekOffset(year,dow,doy),weekOffsetNext=firstWeekOffset(year+1,dow,doy);return(daysInYear(year)-weekOffset+weekOffsetNext)/7;} +addFormatToken('w',['ww',2],'wo','week');addFormatToken('W',['WW',2],'Wo','isoWeek');addUnitAlias('week','w');addUnitAlias('isoWeek','W');addUnitPriority('week',5);addUnitPriority('isoWeek',5);addRegexToken('w',match1to2);addRegexToken('ww',match1to2,match2);addRegexToken('W',match1to2);addRegexToken('WW',match1to2,match2);addWeekParseToken(['w','ww','W','WW'],function(input,week,config,token){week[token.substr(0,1)]=toInt(input);});function localeWeek(mom){return weekOfYear(mom,this._week.dow,this._week.doy).week;} +var defaultLocaleWeek={dow:0,doy:6};function localeFirstDayOfWeek(){return this._week.dow;} +function localeFirstDayOfYear(){return this._week.doy;} +function getSetWeek(input){var week=this.localeData().week(this);return input==null?week:this.add((input-week)*7,'d');} +function getSetISOWeek(input){var week=weekOfYear(this,1,4).week;return input==null?week:this.add((input-week)*7,'d');} +addFormatToken('d',0,'do','day');addFormatToken('dd',0,0,function(format){return this.localeData().weekdaysMin(this,format);});addFormatToken('ddd',0,0,function(format){return this.localeData().weekdaysShort(this,format);});addFormatToken('dddd',0,0,function(format){return this.localeData().weekdays(this,format);});addFormatToken('e',0,0,'weekday');addFormatToken('E',0,0,'isoWeekday');addUnitAlias('day','d');addUnitAlias('weekday','e');addUnitAlias('isoWeekday','E');addUnitPriority('day',11);addUnitPriority('weekday',11);addUnitPriority('isoWeekday',11);addRegexToken('d',match1to2);addRegexToken('e',match1to2);addRegexToken('E',match1to2);addRegexToken('dd',function(isStrict,locale){return locale.weekdaysMinRegex(isStrict);});addRegexToken('ddd',function(isStrict,locale){return locale.weekdaysShortRegex(isStrict);});addRegexToken('dddd',function(isStrict,locale){return locale.weekdaysRegex(isStrict);});addWeekParseToken(['dd','ddd','dddd'],function(input,week,config,token){var weekday=config._locale.weekdaysParse(input,token,config._strict);if(weekday!=null){week.d=weekday;}else{getParsingFlags(config).invalidWeekday=input;}});addWeekParseToken(['d','e','E'],function(input,week,config,token){week[token]=toInt(input);});function parseWeekday(input,locale){if(typeof input!=='string'){return input;} +if(!isNaN(input)){return parseInt(input,10);} +input=locale.weekdaysParse(input);if(typeof input==='number'){return input;} +return null;} +function parseIsoWeekday(input,locale){if(typeof input==='string'){return locale.weekdaysParse(input)%7||7;} +return isNaN(input)?null:input;} +var defaultLocaleWeekdays='Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_');function localeWeekdays(m,format){if(!m){return isArray(this._weekdays)?this._weekdays:this._weekdays['standalone'];} +return isArray(this._weekdays)?this._weekdays[m.day()]:this._weekdays[this._weekdays.isFormat.test(format)?'format':'standalone'][m.day()];} +var defaultLocaleWeekdaysShort='Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_');function localeWeekdaysShort(m){return(m)?this._weekdaysShort[m.day()]:this._weekdaysShort;} +var defaultLocaleWeekdaysMin='Su_Mo_Tu_We_Th_Fr_Sa'.split('_');function localeWeekdaysMin(m){return(m)?this._weekdaysMin[m.day()]:this._weekdaysMin;} +function handleStrictParse$1(weekdayName,format,strict){var i,ii,mom,llc=weekdayName.toLocaleLowerCase();if(!this._weekdaysParse){this._weekdaysParse=[];this._shortWeekdaysParse=[];this._minWeekdaysParse=[];for(i=0;i<7;++i){mom=createUTC([2000,1]).day(i);this._minWeekdaysParse[i]=this.weekdaysMin(mom,'').toLocaleLowerCase();this._shortWeekdaysParse[i]=this.weekdaysShort(mom,'').toLocaleLowerCase();this._weekdaysParse[i]=this.weekdays(mom,'').toLocaleLowerCase();}} +if(strict){if(format==='dddd'){ii=indexOf$1.call(this._weekdaysParse,llc);return ii!==-1?ii:null;}else if(format==='ddd'){ii=indexOf$1.call(this._shortWeekdaysParse,llc);return ii!==-1?ii:null;}else{ii=indexOf$1.call(this._minWeekdaysParse,llc);return ii!==-1?ii:null;}}else{if(format==='dddd'){ii=indexOf$1.call(this._weekdaysParse,llc);if(ii!==-1){return ii;} +ii=indexOf$1.call(this._shortWeekdaysParse,llc);if(ii!==-1){return ii;} +ii=indexOf$1.call(this._minWeekdaysParse,llc);return ii!==-1?ii:null;}else if(format==='ddd'){ii=indexOf$1.call(this._shortWeekdaysParse,llc);if(ii!==-1){return ii;} +ii=indexOf$1.call(this._weekdaysParse,llc);if(ii!==-1){return ii;} +ii=indexOf$1.call(this._minWeekdaysParse,llc);return ii!==-1?ii:null;}else{ii=indexOf$1.call(this._minWeekdaysParse,llc);if(ii!==-1){return ii;} +ii=indexOf$1.call(this._weekdaysParse,llc);if(ii!==-1){return ii;} +ii=indexOf$1.call(this._shortWeekdaysParse,llc);return ii!==-1?ii:null;}}} +function localeWeekdaysParse(weekdayName,format,strict){var i,mom,regex;if(this._weekdaysParseExact){return handleStrictParse$1.call(this,weekdayName,format,strict);} +if(!this._weekdaysParse){this._weekdaysParse=[];this._minWeekdaysParse=[];this._shortWeekdaysParse=[];this._fullWeekdaysParse=[];} +for(i=0;i<7;i++){mom=createUTC([2000,1]).day(i);if(strict&&!this._fullWeekdaysParse[i]){this._fullWeekdaysParse[i]=new RegExp('^'+this.weekdays(mom,'').replace('.','\.?')+'$','i');this._shortWeekdaysParse[i]=new RegExp('^'+this.weekdaysShort(mom,'').replace('.','\.?')+'$','i');this._minWeekdaysParse[i]=new RegExp('^'+this.weekdaysMin(mom,'').replace('.','\.?')+'$','i');} +if(!this._weekdaysParse[i]){regex='^'+this.weekdays(mom,'')+'|^'+this.weekdaysShort(mom,'')+'|^'+this.weekdaysMin(mom,'');this._weekdaysParse[i]=new RegExp(regex.replace('.',''),'i');} +if(strict&&format==='dddd'&&this._fullWeekdaysParse[i].test(weekdayName)){return i;}else if(strict&&format==='ddd'&&this._shortWeekdaysParse[i].test(weekdayName)){return i;}else if(strict&&format==='dd'&&this._minWeekdaysParse[i].test(weekdayName)){return i;}else if(!strict&&this._weekdaysParse[i].test(weekdayName)){return i;}}} +function getSetDayOfWeek(input){if(!this.isValid()){return input!=null?this:NaN;} +var day=this._isUTC?this._d.getUTCDay():this._d.getDay();if(input!=null){input=parseWeekday(input,this.localeData());return this.add(input-day,'d');}else{return day;}} +function getSetLocaleDayOfWeek(input){if(!this.isValid()){return input!=null?this:NaN;} +var weekday=(this.day()+7-this.localeData()._week.dow)%7;return input==null?weekday:this.add(input-weekday,'d');} +function getSetISODayOfWeek(input){if(!this.isValid()){return input!=null?this:NaN;} +if(input!=null){var weekday=parseIsoWeekday(input,this.localeData());return this.day(this.day()%7?weekday:weekday-7);}else{return this.day()||7;}} +var defaultWeekdaysRegex=matchWord;function weekdaysRegex(isStrict){if(this._weekdaysParseExact){if(!hasOwnProp(this,'_weekdaysRegex')){computeWeekdaysParse.call(this);} +if(isStrict){return this._weekdaysStrictRegex;}else{return this._weekdaysRegex;}}else{if(!hasOwnProp(this,'_weekdaysRegex')){this._weekdaysRegex=defaultWeekdaysRegex;} +return this._weekdaysStrictRegex&&isStrict?this._weekdaysStrictRegex:this._weekdaysRegex;}} +var defaultWeekdaysShortRegex=matchWord;function weekdaysShortRegex(isStrict){if(this._weekdaysParseExact){if(!hasOwnProp(this,'_weekdaysRegex')){computeWeekdaysParse.call(this);} +if(isStrict){return this._weekdaysShortStrictRegex;}else{return this._weekdaysShortRegex;}}else{if(!hasOwnProp(this,'_weekdaysShortRegex')){this._weekdaysShortRegex=defaultWeekdaysShortRegex;} +return this._weekdaysShortStrictRegex&&isStrict?this._weekdaysShortStrictRegex:this._weekdaysShortRegex;}} +var defaultWeekdaysMinRegex=matchWord;function weekdaysMinRegex(isStrict){if(this._weekdaysParseExact){if(!hasOwnProp(this,'_weekdaysRegex')){computeWeekdaysParse.call(this);} +if(isStrict){return this._weekdaysMinStrictRegex;}else{return this._weekdaysMinRegex;}}else{if(!hasOwnProp(this,'_weekdaysMinRegex')){this._weekdaysMinRegex=defaultWeekdaysMinRegex;} +return this._weekdaysMinStrictRegex&&isStrict?this._weekdaysMinStrictRegex:this._weekdaysMinRegex;}} +function computeWeekdaysParse(){function cmpLenRev(a,b){return b.length-a.length;} +var minPieces=[],shortPieces=[],longPieces=[],mixedPieces=[],i,mom,minp,shortp,longp;for(i=0;i<7;i++){mom=createUTC([2000,1]).day(i);minp=this.weekdaysMin(mom,'');shortp=this.weekdaysShort(mom,'');longp=this.weekdays(mom,'');minPieces.push(minp);shortPieces.push(shortp);longPieces.push(longp);mixedPieces.push(minp);mixedPieces.push(shortp);mixedPieces.push(longp);} +minPieces.sort(cmpLenRev);shortPieces.sort(cmpLenRev);longPieces.sort(cmpLenRev);mixedPieces.sort(cmpLenRev);for(i=0;i<7;i++){shortPieces[i]=regexEscape(shortPieces[i]);longPieces[i]=regexEscape(longPieces[i]);mixedPieces[i]=regexEscape(mixedPieces[i]);} +this._weekdaysRegex=new RegExp('^('+mixedPieces.join('|')+')','i');this._weekdaysShortRegex=this._weekdaysRegex;this._weekdaysMinRegex=this._weekdaysRegex;this._weekdaysStrictRegex=new RegExp('^('+longPieces.join('|')+')','i');this._weekdaysShortStrictRegex=new RegExp('^('+shortPieces.join('|')+')','i');this._weekdaysMinStrictRegex=new RegExp('^('+minPieces.join('|')+')','i');} +function hFormat(){return this.hours()%12||12;} +function kFormat(){return this.hours()||24;} +addFormatToken('H',['HH',2],0,'hour');addFormatToken('h',['hh',2],0,hFormat);addFormatToken('k',['kk',2],0,kFormat);addFormatToken('hmm',0,0,function(){return''+hFormat.apply(this)+zeroFill(this.minutes(),2);});addFormatToken('hmmss',0,0,function(){return''+hFormat.apply(this)+zeroFill(this.minutes(),2)+zeroFill(this.seconds(),2);});addFormatToken('Hmm',0,0,function(){return''+this.hours()+zeroFill(this.minutes(),2);});addFormatToken('Hmmss',0,0,function(){return''+this.hours()+zeroFill(this.minutes(),2)+zeroFill(this.seconds(),2);});function meridiem(token,lowercase){addFormatToken(token,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),lowercase);});} +meridiem('a',true);meridiem('A',false);addUnitAlias('hour','h');addUnitPriority('hour',13);function matchMeridiem(isStrict,locale){return locale._meridiemParse;} +addRegexToken('a',matchMeridiem);addRegexToken('A',matchMeridiem);addRegexToken('H',match1to2);addRegexToken('h',match1to2);addRegexToken('k',match1to2);addRegexToken('HH',match1to2,match2);addRegexToken('hh',match1to2,match2);addRegexToken('kk',match1to2,match2);addRegexToken('hmm',match3to4);addRegexToken('hmmss',match5to6);addRegexToken('Hmm',match3to4);addRegexToken('Hmmss',match5to6);addParseToken(['H','HH'],HOUR);addParseToken(['k','kk'],function(input,array,config){var kInput=toInt(input);array[HOUR]=kInput===24?0:kInput;});addParseToken(['a','A'],function(input,array,config){config._isPm=config._locale.isPM(input);config._meridiem=input;});addParseToken(['h','hh'],function(input,array,config){array[HOUR]=toInt(input);getParsingFlags(config).bigHour=true;});addParseToken('hmm',function(input,array,config){var pos=input.length-2;array[HOUR]=toInt(input.substr(0,pos));array[MINUTE]=toInt(input.substr(pos));getParsingFlags(config).bigHour=true;});addParseToken('hmmss',function(input,array,config){var pos1=input.length-4;var pos2=input.length-2;array[HOUR]=toInt(input.substr(0,pos1));array[MINUTE]=toInt(input.substr(pos1,2));array[SECOND]=toInt(input.substr(pos2));getParsingFlags(config).bigHour=true;});addParseToken('Hmm',function(input,array,config){var pos=input.length-2;array[HOUR]=toInt(input.substr(0,pos));array[MINUTE]=toInt(input.substr(pos));});addParseToken('Hmmss',function(input,array,config){var pos1=input.length-4;var pos2=input.length-2;array[HOUR]=toInt(input.substr(0,pos1));array[MINUTE]=toInt(input.substr(pos1,2));array[SECOND]=toInt(input.substr(pos2));});function localeIsPM(input){return((input+'').toLowerCase().charAt(0)==='p');} +var defaultLocaleMeridiemParse=/[ap]\.?m?\.?/i;function localeMeridiem(hours,minutes,isLower){if(hours>11){return isLower?'pm':'PM';}else{return isLower?'am':'AM';}} +var getSetHour=makeGetSet('Hours',true);var baseConfig={calendar:defaultCalendar,longDateFormat:defaultLongDateFormat,invalidDate:defaultInvalidDate,ordinal:defaultOrdinal,dayOfMonthOrdinalParse:defaultDayOfMonthOrdinalParse,relativeTime:defaultRelativeTime,months:defaultLocaleMonths,monthsShort:defaultLocaleMonthsShort,week:defaultLocaleWeek,weekdays:defaultLocaleWeekdays,weekdaysMin:defaultLocaleWeekdaysMin,weekdaysShort:defaultLocaleWeekdaysShort,meridiemParse:defaultLocaleMeridiemParse};var locales={};var localeFamilies={};var globalLocale;function normalizeLocale(key){return key?key.toLowerCase().replace('_','-'):key;} +function chooseLocale(names){var i=0,j,next,locale,split;while(i0){locale=loadLocale(split.slice(0,j).join('-'));if(locale){return locale;} +if(next&&next.length>=j&&compareArrays(split,next,true)>=j-1){break;} +j--;} +i++;} +return null;} +function loadLocale(name){var oldLocale=null;if(!locales[name]&&(typeof module!=='undefined')&&module&&module.exports){try{oldLocale=globalLocale._abbr;require('./locale/'+name);getSetGlobalLocale(oldLocale);}catch(e){}} +return locales[name];} +function getSetGlobalLocale(key,values){var data;if(key){if(isUndefined(values)){data=getLocale(key);} +else{data=defineLocale(key,values);} +if(data){globalLocale=data;}} +return globalLocale._abbr;} +function defineLocale(name,config){if(config!==null){var parentConfig=baseConfig;config.abbr=name;if(locales[name]!=null){deprecateSimple('defineLocaleOverride','use moment.updateLocale(localeName, config) to change '+'an existing locale. moment.defineLocale(localeName, '+'config) should only be used for creating a new locale '+'See http://momentjs.com/guides/#/warnings/define-locale/ for more info.');parentConfig=locales[name]._config;}else if(config.parentLocale!=null){if(locales[config.parentLocale]!=null){parentConfig=locales[config.parentLocale]._config;}else{if(!localeFamilies[config.parentLocale]){localeFamilies[config.parentLocale]=[];} +localeFamilies[config.parentLocale].push({name:name,config:config});return null;}} +locales[name]=new Locale(mergeConfigs(parentConfig,config));if(localeFamilies[name]){localeFamilies[name].forEach(function(x){defineLocale(x.name,x.config);});} +getSetGlobalLocale(name);return locales[name];}else{delete locales[name];return null;}} +function updateLocale(name,config){if(config!=null){var locale,parentConfig=baseConfig;if(locales[name]!=null){parentConfig=locales[name]._config;} +config=mergeConfigs(parentConfig,config);locale=new Locale(config);locale.parentLocale=locales[name];locales[name]=locale;getSetGlobalLocale(name);}else{if(locales[name]!=null){if(locales[name].parentLocale!=null){locales[name]=locales[name].parentLocale;}else if(locales[name]!=null){delete locales[name];}}} +return locales[name];} +function getLocale(key){var locale;if(key&&key._locale&&key._locale._abbr){key=key._locale._abbr;} +if(!key){return globalLocale;} +if(!isArray(key)){locale=loadLocale(key);if(locale){return locale;} +key=[key];} +return chooseLocale(key);} +function listLocales(){return keys$1(locales);} +function checkOverflow(m){var overflow;var a=m._a;if(a&&getParsingFlags(m).overflow===-2){overflow=a[MONTH]<0||a[MONTH]>11?MONTH:a[DATE]<1||a[DATE]>daysInMonth(a[YEAR],a[MONTH])?DATE:a[HOUR]<0||a[HOUR]>24||(a[HOUR]===24&&(a[MINUTE]!==0||a[SECOND]!==0||a[MILLISECOND]!==0))?HOUR:a[MINUTE]<0||a[MINUTE]>59?MINUTE:a[SECOND]<0||a[SECOND]>59?SECOND:a[MILLISECOND]<0||a[MILLISECOND]>999?MILLISECOND:-1;if(getParsingFlags(m)._overflowDayOfYear&&(overflowDATE)){overflow=DATE;} +if(getParsingFlags(m)._overflowWeeks&&overflow===-1){overflow=WEEK;} +if(getParsingFlags(m)._overflowWeekday&&overflow===-1){overflow=WEEKDAY;} +getParsingFlags(m).overflow=overflow;} +return m;} +var extendedIsoRegex=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/;var basicIsoRegex=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/;var tzRegex=/Z|[+-]\d\d(?::?\d\d)?/;var isoDates=[['YYYYYY-MM-DD',/[+-]\d{6}-\d\d-\d\d/],['YYYY-MM-DD',/\d{4}-\d\d-\d\d/],['GGGG-[W]WW-E',/\d{4}-W\d\d-\d/],['GGGG-[W]WW',/\d{4}-W\d\d/,false],['YYYY-DDD',/\d{4}-\d{3}/],['YYYY-MM',/\d{4}-\d\d/,false],['YYYYYYMMDD',/[+-]\d{10}/],['YYYYMMDD',/\d{8}/],['GGGG[W]WWE',/\d{4}W\d{3}/],['GGGG[W]WW',/\d{4}W\d{2}/,false],['YYYYDDD',/\d{7}/]];var isoTimes=[['HH:mm:ss.SSSS',/\d\d:\d\d:\d\d\.\d+/],['HH:mm:ss,SSSS',/\d\d:\d\d:\d\d,\d+/],['HH:mm:ss',/\d\d:\d\d:\d\d/],['HH:mm',/\d\d:\d\d/],['HHmmss.SSSS',/\d\d\d\d\d\d\.\d+/],['HHmmss,SSSS',/\d\d\d\d\d\d,\d+/],['HHmmss',/\d\d\d\d\d\d/],['HHmm',/\d\d\d\d/],['HH',/\d\d/]];var aspNetJsonRegex=/^\/?Date\((\-?\d+)/i;function configFromISO(config){var i,l,string=config._i,match=extendedIsoRegex.exec(string)||basicIsoRegex.exec(string),allowTime,dateFormat,timeFormat,tzFormat;if(match){getParsingFlags(config).iso=true;for(i=0,l=isoDates.length;i10)?'YYYY ':'YY ');timeFormat='HH:mm'+(match[4]?':ss':'');if(match[1]){var momentDate=new Date(match[2]);var momentDay=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'][momentDate.getDay()];if(match[1].substr(0,3)!==momentDay){getParsingFlags(config).weekdayMismatch=true;config._isValid=false;return;}} +switch(match[5].length){case 2:if(timezoneIndex===0){timezone=' +0000';}else{timezoneIndex=military.indexOf(match[5][1].toUpperCase())-12;timezone=((timezoneIndex<0)?' -':' +')+((''+timezoneIndex).replace(/^-?/,'0')).match(/..$/)[0]+'00';} +break;case 4:timezone=timezones[match[5]];break;default:timezone=timezones[' GMT'];} +match[5]=timezone;config._i=match.splice(1).join('');tzFormat=' ZZ';config._f=dayFormat+dateFormat+timeFormat+tzFormat;configFromStringAndFormat(config);getParsingFlags(config).rfc2822=true;}else{config._isValid=false;}} +function configFromString(config){var matched=aspNetJsonRegex.exec(config._i);if(matched!==null){config._d=new Date(+matched[1]);return;} +configFromISO(config);if(config._isValid===false){delete config._isValid;}else{return;} +configFromRFC2822(config);if(config._isValid===false){delete config._isValid;}else{return;} +hooks.createFromInputFallback(config);} +hooks.createFromInputFallback=deprecate('value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), '+'which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are '+'discouraged and will be removed in an upcoming major release. Please refer to '+'http://momentjs.com/guides/#/warnings/js-date/ for more info.',function(config){config._d=new Date(config._i+(config._useUTC?' UTC':''));});function defaults(a,b,c){if(a!=null){return a;} +if(b!=null){return b;} +return c;} +function currentDateArray(config){var nowValue=new Date(hooks.now());if(config._useUTC){return[nowValue.getUTCFullYear(),nowValue.getUTCMonth(),nowValue.getUTCDate()];} +return[nowValue.getFullYear(),nowValue.getMonth(),nowValue.getDate()];} +function configFromArray(config){var i,date,input=[],currentDate,yearToUse;if(config._d){return;} +currentDate=currentDateArray(config);if(config._w&&config._a[DATE]==null&&config._a[MONTH]==null){dayOfYearFromWeekInfo(config);} +if(config._dayOfYear!=null){yearToUse=defaults(config._a[YEAR],currentDate[YEAR]);if(config._dayOfYear>daysInYear(yearToUse)||config._dayOfYear===0){getParsingFlags(config)._overflowDayOfYear=true;} +date=createUTCDate(yearToUse,0,config._dayOfYear);config._a[MONTH]=date.getUTCMonth();config._a[DATE]=date.getUTCDate();} +for(i=0;i<3&&config._a[i]==null;++i){config._a[i]=input[i]=currentDate[i];} +for(;i<7;i++){config._a[i]=input[i]=(config._a[i]==null)?(i===2?1:0):config._a[i];} +if(config._a[HOUR]===24&&config._a[MINUTE]===0&&config._a[SECOND]===0&&config._a[MILLISECOND]===0){config._nextDay=true;config._a[HOUR]=0;} +config._d=(config._useUTC?createUTCDate:createDate).apply(null,input);if(config._tzm!=null){config._d.setUTCMinutes(config._d.getUTCMinutes()-config._tzm);} +if(config._nextDay){config._a[HOUR]=24;}} +function dayOfYearFromWeekInfo(config){var w,weekYear,week,weekday,dow,doy,temp,weekdayOverflow;w=config._w;if(w.GG!=null||w.W!=null||w.E!=null){dow=1;doy=4;weekYear=defaults(w.GG,config._a[YEAR],weekOfYear(createLocal(),1,4).year);week=defaults(w.W,1);weekday=defaults(w.E,1);if(weekday<1||weekday>7){weekdayOverflow=true;}}else{dow=config._locale._week.dow;doy=config._locale._week.doy;var curWeek=weekOfYear(createLocal(),dow,doy);weekYear=defaults(w.gg,config._a[YEAR],curWeek.year);week=defaults(w.w,curWeek.week);if(w.d!=null){weekday=w.d;if(weekday<0||weekday>6){weekdayOverflow=true;}}else if(w.e!=null){weekday=w.e+dow;if(w.e<0||w.e>6){weekdayOverflow=true;}}else{weekday=dow;}} +if(week<1||week>weeksInYear(weekYear,dow,doy)){getParsingFlags(config)._overflowWeeks=true;}else if(weekdayOverflow!=null){getParsingFlags(config)._overflowWeekday=true;}else{temp=dayOfYearFromWeeks(weekYear,week,weekday,dow,doy);config._a[YEAR]=temp.year;config._dayOfYear=temp.dayOfYear;}} +hooks.ISO_8601=function(){};hooks.RFC_2822=function(){};function configFromStringAndFormat(config){if(config._f===hooks.ISO_8601){configFromISO(config);return;} +if(config._f===hooks.RFC_2822){configFromRFC2822(config);return;} +config._a=[];getParsingFlags(config).empty=true;var string=''+config._i,i,parsedInput,tokens,token,skipped,stringLength=string.length,totalParsedInputLength=0;tokens=expandFormat(config._f,config._locale).match(formattingTokens)||[];for(i=0;i0){getParsingFlags(config).unusedInput.push(skipped);} +string=string.slice(string.indexOf(parsedInput)+parsedInput.length);totalParsedInputLength+=parsedInput.length;} +if(formatTokenFunctions[token]){if(parsedInput){getParsingFlags(config).empty=false;} +else{getParsingFlags(config).unusedTokens.push(token);} +addTimeToArrayFromToken(token,parsedInput,config);} +else if(config._strict&&!parsedInput){getParsingFlags(config).unusedTokens.push(token);}} +getParsingFlags(config).charsLeftOver=stringLength-totalParsedInputLength;if(string.length>0){getParsingFlags(config).unusedInput.push(string);} +if(config._a[HOUR]<=12&&getParsingFlags(config).bigHour===true&&config._a[HOUR]>0){getParsingFlags(config).bigHour=undefined;} +getParsingFlags(config).parsedDateParts=config._a.slice(0);getParsingFlags(config).meridiem=config._meridiem;config._a[HOUR]=meridiemFixWrap(config._locale,config._a[HOUR],config._meridiem);configFromArray(config);checkOverflow(config);} +function meridiemFixWrap(locale,hour,meridiem){var isPm;if(meridiem==null){return hour;} +if(locale.meridiemHour!=null){return locale.meridiemHour(hour,meridiem);}else if(locale.isPM!=null){isPm=locale.isPM(meridiem);if(isPm&&hour<12){hour+=12;} +if(!isPm&&hour===12){hour=0;} +return hour;}else{return hour;}} +function configFromStringAndArray(config){var tempConfig,bestMoment,scoreToBeat,i,currentScore;if(config._f.length===0){getParsingFlags(config).invalidFormat=true;config._d=new Date(NaN);return;} +for(i=0;ithis?this:other;}else{return createInvalid();}});function pickBy(fn,moments){var res,i;if(moments.length===1&&isArray(moments[0])){moments=moments[0];} +if(!moments.length){return createLocal();} +res=moments[0];for(i=1;ithis.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset());} +function isDaylightSavingTimeShifted(){if(!isUndefined(this._isDSTShifted)){return this._isDSTShifted;} +var c={};copyConfig(c,this);c=prepareConfig(c);if(c._a){var other=c._isUTC?createUTC(c._a):createLocal(c._a);this._isDSTShifted=this.isValid()&&compareArrays(c._a,other.toArray())>0;}else{this._isDSTShifted=false;} +return this._isDSTShifted;} +function isLocal(){return this.isValid()?!this._isUTC:false;} +function isUtcOffset(){return this.isValid()?this._isUTC:false;} +function isUtc(){return this.isValid()?this._isUTC&&this._offset===0:false;} +var aspNetRegex=/^(\-)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)(\.\d*)?)?$/;var isoRegex=/^(-)?P(?:(-?[0-9,.]*)Y)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)W)?(?:(-?[0-9,.]*)D)?(?:T(?:(-?[0-9,.]*)H)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)S)?)?$/;function createDuration(input,key){var duration=input,match=null,sign,ret,diffRes;if(isDuration(input)){duration={ms:input._milliseconds,d:input._days,M:input._months};}else if(isNumber(input)){duration={};if(key){duration[key]=input;}else{duration.milliseconds=input;}}else if(!!(match=aspNetRegex.exec(input))){sign=(match[1]==='-')?-1:1;duration={y:0,d:toInt(match[DATE])*sign,h:toInt(match[HOUR])*sign,m:toInt(match[MINUTE])*sign,s:toInt(match[SECOND])*sign,ms:toInt(absRound(match[MILLISECOND]*1000))*sign};}else if(!!(match=isoRegex.exec(input))){sign=(match[1]==='-')?-1:1;duration={y:parseIso(match[2],sign),M:parseIso(match[3],sign),w:parseIso(match[4],sign),d:parseIso(match[5],sign),h:parseIso(match[6],sign),m:parseIso(match[7],sign),s:parseIso(match[8],sign)};}else if(duration==null){duration={};}else if(typeof duration==='object'&&('from'in duration||'to'in duration)){diffRes=momentsDifference(createLocal(duration.from),createLocal(duration.to));duration={};duration.ms=diffRes.milliseconds;duration.M=diffRes.months;} +ret=new Duration(duration);if(isDuration(input)&&hasOwnProp(input,'_locale')){ret._locale=input._locale;} +return ret;} +createDuration.fn=Duration.prototype;createDuration.invalid=createInvalid$1;function parseIso(inp,sign){var res=inp&&parseFloat(inp.replace(',','.'));return(isNaN(res)?0:res)*sign;} +function positiveMomentsDifference(base,other){var res={milliseconds:0,months:0};res.months=other.month()-base.month()+(other.year()-base.year())*12;if(base.clone().add(res.months,'M').isAfter(other)){--res.months;} +res.milliseconds=+other-+(base.clone().add(res.months,'M'));return res;} +function momentsDifference(base,other){var res;if(!(base.isValid()&&other.isValid())){return{milliseconds:0,months:0};} +other=cloneWithOffset(other,base);if(base.isBefore(other)){res=positiveMomentsDifference(base,other);}else{res=positiveMomentsDifference(other,base);res.milliseconds=-res.milliseconds;res.months=-res.months;} +return res;} +function createAdder(direction,name){return function(val,period){var dur,tmp;if(period!==null&&!isNaN(+period)){deprecateSimple(name,'moment().'+name+'(period, number) is deprecated. Please use moment().'+name+'(number, period). '+'See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info.');tmp=val;val=period;period=tmp;} +val=typeof val==='string'?+val:val;dur=createDuration(val,period);addSubtract(this,dur,direction);return this;};} +function addSubtract(mom,duration,isAdding,updateOffset){var milliseconds=duration._milliseconds,days=absRound(duration._days),months=absRound(duration._months);if(!mom.isValid()){return;} +updateOffset=updateOffset==null?true:updateOffset;if(milliseconds){mom._d.setTime(mom._d.valueOf()+milliseconds*isAdding);} +if(days){set$1(mom,'Date',get(mom,'Date')+days*isAdding);} +if(months){setMonth(mom,get(mom,'Month')+months*isAdding);} +if(updateOffset){hooks.updateOffset(mom,days||months);}} +var add=createAdder(1,'add');var subtract=createAdder(-1,'subtract');function getCalendarFormat(myMoment,now){var diff=myMoment.diff(now,'days',true);return diff<-6?'sameElse':diff<-1?'lastWeek':diff<0?'lastDay':diff<1?'sameDay':diff<2?'nextDay':diff<7?'nextWeek':'sameElse';} +function calendar$1(time,formats){var now=time||createLocal(),sod=cloneWithOffset(now,this).startOf('day'),format=hooks.calendarFormat(this,sod)||'sameElse';var output=formats&&(isFunction(formats[format])?formats[format].call(this,now):formats[format]);return this.format(output||this.localeData().calendar(format,this,createLocal(now)));} +function clone(){return new Moment(this);} +function isAfter(input,units){var localInput=isMoment(input)?input:createLocal(input);if(!(this.isValid()&&localInput.isValid())){return false;} +units=normalizeUnits(!isUndefined(units)?units:'millisecond');if(units==='millisecond'){return this.valueOf()>localInput.valueOf();}else{return localInput.valueOf()9999){return formatMoment(m,'YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]');} +if(isFunction(Date.prototype.toISOString)){return this.toDate().toISOString();} +return formatMoment(m,'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]');} +function inspect(){if(!this.isValid()){return'moment.invalid(/* '+this._i+' */)';} +var func='moment';var zone='';if(!this.isLocal()){func=this.utcOffset()===0?'moment.utc':'moment.parseZone';zone='Z';} +var prefix='['+func+'("]';var year=(0<=this.year()&&this.year()<=9999)?'YYYY':'YYYYYY';var datetime='-MM-DD[T]HH:mm:ss.SSS';var suffix=zone+'[")]';return this.format(prefix+year+datetime+suffix);} +function format(inputString){if(!inputString){inputString=this.isUtc()?hooks.defaultFormatUtc:hooks.defaultFormat;} +var output=formatMoment(this,inputString);return this.localeData().postformat(output);} +function from(time,withoutSuffix){if(this.isValid()&&((isMoment(time)&&time.isValid())||createLocal(time).isValid())){return createDuration({to:this,from:time}).locale(this.locale()).humanize(!withoutSuffix);}else{return this.localeData().invalidDate();}} +function fromNow(withoutSuffix){return this.from(createLocal(),withoutSuffix);} +function to(time,withoutSuffix){if(this.isValid()&&((isMoment(time)&&time.isValid())||createLocal(time).isValid())){return createDuration({from:this,to:time}).locale(this.locale()).humanize(!withoutSuffix);}else{return this.localeData().invalidDate();}} +function toNow(withoutSuffix){return this.to(createLocal(),withoutSuffix);} +function locale(key){var newLocaleData;if(key===undefined){return this._locale._abbr;}else{newLocaleData=getLocale(key);if(newLocaleData!=null){this._locale=newLocaleData;} +return this;}} +var lang=deprecate('moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.',function(key){if(key===undefined){return this.localeData();}else{return this.locale(key);}});function localeData(){return this._locale;} +function startOf(units){units=normalizeUnits(units);switch(units){case'year':this.month(0);case'quarter':case'month':this.date(1);case'week':case'isoWeek':case'day':case'date':this.hours(0);case'hour':this.minutes(0);case'minute':this.seconds(0);case'second':this.milliseconds(0);} +if(units==='week'){this.weekday(0);} +if(units==='isoWeek'){this.isoWeekday(1);} +if(units==='quarter'){this.month(Math.floor(this.month()/3)*3);} +return this;} +function endOf(units){units=normalizeUnits(units);if(units===undefined||units==='millisecond'){return this;} +if(units==='date'){units='day';} +return this.startOf(units).add(1,(units==='isoWeek'?'week':units)).subtract(1,'ms');} +function valueOf(){return this._d.valueOf()-((this._offset||0)*60000);} +function unix(){return Math.floor(this.valueOf()/1000);} +function toDate(){return new Date(this.valueOf());} +function toArray(){var m=this;return[m.year(),m.month(),m.date(),m.hour(),m.minute(),m.second(),m.millisecond()];} +function toObject(){var m=this;return{years:m.year(),months:m.month(),date:m.date(),hours:m.hours(),minutes:m.minutes(),seconds:m.seconds(),milliseconds:m.milliseconds()};} +function toJSON(){return this.isValid()?this.toISOString():null;} +function isValid$2(){return isValid(this);} +function parsingFlags(){return extend({},getParsingFlags(this));} +function invalidAt(){return getParsingFlags(this).overflow;} +function creationData(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict};} +addFormatToken(0,['gg',2],0,function(){return this.weekYear()%100;});addFormatToken(0,['GG',2],0,function(){return this.isoWeekYear()%100;});function addWeekYearFormatToken(token,getter){addFormatToken(0,[token,token.length],0,getter);} +addWeekYearFormatToken('gggg','weekYear');addWeekYearFormatToken('ggggg','weekYear');addWeekYearFormatToken('GGGG','isoWeekYear');addWeekYearFormatToken('GGGGG','isoWeekYear');addUnitAlias('weekYear','gg');addUnitAlias('isoWeekYear','GG');addUnitPriority('weekYear',1);addUnitPriority('isoWeekYear',1);addRegexToken('G',matchSigned);addRegexToken('g',matchSigned);addRegexToken('GG',match1to2,match2);addRegexToken('gg',match1to2,match2);addRegexToken('GGGG',match1to4,match4);addRegexToken('gggg',match1to4,match4);addRegexToken('GGGGG',match1to6,match6);addRegexToken('ggggg',match1to6,match6);addWeekParseToken(['gggg','ggggg','GGGG','GGGGG'],function(input,week,config,token){week[token.substr(0,2)]=toInt(input);});addWeekParseToken(['gg','GG'],function(input,week,config,token){week[token]=hooks.parseTwoDigitYear(input);});function getSetWeekYear(input){return getSetWeekYearHelper.call(this,input,this.week(),this.weekday(),this.localeData()._week.dow,this.localeData()._week.doy);} +function getSetISOWeekYear(input){return getSetWeekYearHelper.call(this,input,this.isoWeek(),this.isoWeekday(),1,4);} +function getISOWeeksInYear(){return weeksInYear(this.year(),1,4);} +function getWeeksInYear(){var weekInfo=this.localeData()._week;return weeksInYear(this.year(),weekInfo.dow,weekInfo.doy);} +function getSetWeekYearHelper(input,week,weekday,dow,doy){var weeksTarget;if(input==null){return weekOfYear(this,dow,doy).year;}else{weeksTarget=weeksInYear(input,dow,doy);if(week>weeksTarget){week=weeksTarget;} +return setWeekAll.call(this,input,week,weekday,dow,doy);}} +function setWeekAll(weekYear,week,weekday,dow,doy){var dayOfYearData=dayOfYearFromWeeks(weekYear,week,weekday,dow,doy),date=createUTCDate(dayOfYearData.year,0,dayOfYearData.dayOfYear);this.year(date.getUTCFullYear());this.month(date.getUTCMonth());this.date(date.getUTCDate());return this;} +addFormatToken('Q',0,'Qo','quarter');addUnitAlias('quarter','Q');addUnitPriority('quarter',7);addRegexToken('Q',match1);addParseToken('Q',function(input,array){array[MONTH]=(toInt(input)-1)*3;});function getSetQuarter(input){return input==null?Math.ceil((this.month()+1)/3):this.month((input-1)*3+this.month()%3);} +addFormatToken('D',['DD',2],'Do','date');addUnitAlias('date','D');addUnitPriority('date',9);addRegexToken('D',match1to2);addRegexToken('DD',match1to2,match2);addRegexToken('Do',function(isStrict,locale){return isStrict?(locale._dayOfMonthOrdinalParse||locale._ordinalParse):locale._dayOfMonthOrdinalParseLenient;});addParseToken(['D','DD'],DATE);addParseToken('Do',function(input,array){array[DATE]=toInt(input.match(match1to2)[0],10);});var getSetDayOfMonth=makeGetSet('Date',true);addFormatToken('DDD',['DDDD',3],'DDDo','dayOfYear');addUnitAlias('dayOfYear','DDD');addUnitPriority('dayOfYear',4);addRegexToken('DDD',match1to3);addRegexToken('DDDD',match3);addParseToken(['DDD','DDDD'],function(input,array,config){config._dayOfYear=toInt(input);});function getSetDayOfYear(input){var dayOfYear=Math.round((this.clone().startOf('day')-this.clone().startOf('year'))/864e5)+1;return input==null?dayOfYear:this.add((input-dayOfYear),'d');} +addFormatToken('m',['mm',2],0,'minute');addUnitAlias('minute','m');addUnitPriority('minute',14);addRegexToken('m',match1to2);addRegexToken('mm',match1to2,match2);addParseToken(['m','mm'],MINUTE);var getSetMinute=makeGetSet('Minutes',false);addFormatToken('s',['ss',2],0,'second');addUnitAlias('second','s');addUnitPriority('second',15);addRegexToken('s',match1to2);addRegexToken('ss',match1to2,match2);addParseToken(['s','ss'],SECOND);var getSetSecond=makeGetSet('Seconds',false);addFormatToken('S',0,0,function(){return~~(this.millisecond()/100);});addFormatToken(0,['SS',2],0,function(){return~~(this.millisecond()/10);});addFormatToken(0,['SSS',3],0,'millisecond');addFormatToken(0,['SSSS',4],0,function(){return this.millisecond()*10;});addFormatToken(0,['SSSSS',5],0,function(){return this.millisecond()*100;});addFormatToken(0,['SSSSSS',6],0,function(){return this.millisecond()*1000;});addFormatToken(0,['SSSSSSS',7],0,function(){return this.millisecond()*10000;});addFormatToken(0,['SSSSSSSS',8],0,function(){return this.millisecond()*100000;});addFormatToken(0,['SSSSSSSSS',9],0,function(){return this.millisecond()*1000000;});addUnitAlias('millisecond','ms');addUnitPriority('millisecond',16);addRegexToken('S',match1to3,match1);addRegexToken('SS',match1to3,match2);addRegexToken('SSS',match1to3,match3);var token;for(token='SSSS';token.length<=9;token+='S'){addRegexToken(token,matchUnsigned);} +function parseMs(input,array){array[MILLISECOND]=toInt(('0.'+input)*1000);} +for(token='S';token.length<=9;token+='S'){addParseToken(token,parseMs);} +var getSetMillisecond=makeGetSet('Milliseconds',false);addFormatToken('z',0,0,'zoneAbbr');addFormatToken('zz',0,0,'zoneName');function getZoneAbbr(){return this._isUTC?'UTC':'';} +function getZoneName(){return this._isUTC?'Coordinated Universal Time':'';} +var proto=Moment.prototype;proto.add=add;proto.calendar=calendar$1;proto.clone=clone;proto.diff=diff;proto.endOf=endOf;proto.format=format;proto.from=from;proto.fromNow=fromNow;proto.to=to;proto.toNow=toNow;proto.get=stringGet;proto.invalidAt=invalidAt;proto.isAfter=isAfter;proto.isBefore=isBefore;proto.isBetween=isBetween;proto.isSame=isSame;proto.isSameOrAfter=isSameOrAfter;proto.isSameOrBefore=isSameOrBefore;proto.isValid=isValid$2;proto.lang=lang;proto.locale=locale;proto.localeData=localeData;proto.max=prototypeMax;proto.min=prototypeMin;proto.parsingFlags=parsingFlags;proto.set=stringSet;proto.startOf=startOf;proto.subtract=subtract;proto.toArray=toArray;proto.toObject=toObject;proto.toDate=toDate;proto.toISOString=toISOString;proto.inspect=inspect;proto.toJSON=toJSON;proto.toString=toString;proto.unix=unix;proto.valueOf=valueOf;proto.creationData=creationData;proto.year=getSetYear;proto.isLeapYear=getIsLeapYear;proto.weekYear=getSetWeekYear;proto.isoWeekYear=getSetISOWeekYear;proto.quarter=proto.quarters=getSetQuarter;proto.month=getSetMonth;proto.daysInMonth=getDaysInMonth;proto.week=proto.weeks=getSetWeek;proto.isoWeek=proto.isoWeeks=getSetISOWeek;proto.weeksInYear=getWeeksInYear;proto.isoWeeksInYear=getISOWeeksInYear;proto.date=getSetDayOfMonth;proto.day=proto.days=getSetDayOfWeek;proto.weekday=getSetLocaleDayOfWeek;proto.isoWeekday=getSetISODayOfWeek;proto.dayOfYear=getSetDayOfYear;proto.hour=proto.hours=getSetHour;proto.minute=proto.minutes=getSetMinute;proto.second=proto.seconds=getSetSecond;proto.millisecond=proto.milliseconds=getSetMillisecond;proto.utcOffset=getSetOffset;proto.utc=setOffsetToUTC;proto.local=setOffsetToLocal;proto.parseZone=setOffsetToParsedOffset;proto.hasAlignedHourOffset=hasAlignedHourOffset;proto.isDST=isDaylightSavingTime;proto.isLocal=isLocal;proto.isUtcOffset=isUtcOffset;proto.isUtc=isUtc;proto.isUTC=isUtc;proto.zoneAbbr=getZoneAbbr;proto.zoneName=getZoneName;proto.dates=deprecate('dates accessor is deprecated. Use date instead.',getSetDayOfMonth);proto.months=deprecate('months accessor is deprecated. Use month instead',getSetMonth);proto.years=deprecate('years accessor is deprecated. Use year instead',getSetYear);proto.zone=deprecate('moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/',getSetZone);proto.isDSTShifted=deprecate('isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information',isDaylightSavingTimeShifted);function createUnix(input){return createLocal(input*1000);} +function createInZone(){return createLocal.apply(null,arguments).parseZone();} +function preParsePostFormat(string){return string;} +var proto$1=Locale.prototype;proto$1.calendar=calendar;proto$1.longDateFormat=longDateFormat;proto$1.invalidDate=invalidDate;proto$1.ordinal=ordinal;proto$1.preparse=preParsePostFormat;proto$1.postformat=preParsePostFormat;proto$1.relativeTime=relativeTime;proto$1.pastFuture=pastFuture;proto$1.set=set;proto$1.months=localeMonths;proto$1.monthsShort=localeMonthsShort;proto$1.monthsParse=localeMonthsParse;proto$1.monthsRegex=monthsRegex;proto$1.monthsShortRegex=monthsShortRegex;proto$1.week=localeWeek;proto$1.firstDayOfYear=localeFirstDayOfYear;proto$1.firstDayOfWeek=localeFirstDayOfWeek;proto$1.weekdays=localeWeekdays;proto$1.weekdaysMin=localeWeekdaysMin;proto$1.weekdaysShort=localeWeekdaysShort;proto$1.weekdaysParse=localeWeekdaysParse;proto$1.weekdaysRegex=weekdaysRegex;proto$1.weekdaysShortRegex=weekdaysShortRegex;proto$1.weekdaysMinRegex=weekdaysMinRegex;proto$1.isPM=localeIsPM;proto$1.meridiem=localeMeridiem;function get$1(format,index,field,setter){var locale=getLocale();var utc=createUTC().set(setter,index);return locale[field](utc,format);} +function listMonthsImpl(format,index,field){if(isNumber(format)){index=format;format=undefined;} +format=format||'';if(index!=null){return get$1(format,index,field,'month');} +var i;var out=[];for(i=0;i<12;i++){out[i]=get$1(format,i,field,'month');} +return out;} +function listWeekdaysImpl(localeSorted,format,index,field){if(typeof localeSorted==='boolean'){if(isNumber(format)){index=format;format=undefined;} +format=format||'';}else{format=localeSorted;index=format;localeSorted=false;if(isNumber(format)){index=format;format=undefined;} +format=format||'';} +var locale=getLocale(),shift=localeSorted?locale._week.dow:0;if(index!=null){return get$1(format,(index+shift)%7,field,'day');} +var i;var out=[];for(i=0;i<7;i++){out[i]=get$1(format,(i+shift)%7,field,'day');} +return out;} +function listMonths(format,index){return listMonthsImpl(format,index,'months');} +function listMonthsShort(format,index){return listMonthsImpl(format,index,'monthsShort');} +function listWeekdays(localeSorted,format,index){return listWeekdaysImpl(localeSorted,format,index,'weekdays');} +function listWeekdaysShort(localeSorted,format,index){return listWeekdaysImpl(localeSorted,format,index,'weekdaysShort');} +function listWeekdaysMin(localeSorted,format,index){return listWeekdaysImpl(localeSorted,format,index,'weekdaysMin');} +getSetGlobalLocale('en',{dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(number){var b=number%10,output=(toInt(number%100/10)===1)?'th':(b===1)?'st':(b===2)?'nd':(b===3)?'rd':'th';return number+output;}});hooks.lang=deprecate('moment.lang is deprecated. Use moment.locale instead.',getSetGlobalLocale);hooks.langData=deprecate('moment.langData is deprecated. Use moment.localeData instead.',getLocale);var mathAbs=Math.abs;function abs(){var data=this._data;this._milliseconds=mathAbs(this._milliseconds);this._days=mathAbs(this._days);this._months=mathAbs(this._months);data.milliseconds=mathAbs(data.milliseconds);data.seconds=mathAbs(data.seconds);data.minutes=mathAbs(data.minutes);data.hours=mathAbs(data.hours);data.months=mathAbs(data.months);data.years=mathAbs(data.years);return this;} +function addSubtract$1(duration,input,value,direction){var other=createDuration(input,value);duration._milliseconds+=direction*other._milliseconds;duration._days+=direction*other._days;duration._months+=direction*other._months;return duration._bubble();} +function add$1(input,value){return addSubtract$1(this,input,value,1);} +function subtract$1(input,value){return addSubtract$1(this,input,value,-1);} +function absCeil(number){if(number<0){return Math.floor(number);}else{return Math.ceil(number);}} +function bubble(){var milliseconds=this._milliseconds;var days=this._days;var months=this._months;var data=this._data;var seconds,minutes,hours,years,monthsFromDays;if(!((milliseconds>=0&&days>=0&&months>=0)||(milliseconds<=0&&days<=0&&months<=0))){milliseconds+=absCeil(monthsToDays(months)+days)*864e5;days=0;months=0;} +data.milliseconds=milliseconds%1000;seconds=absFloor(milliseconds/1000);data.seconds=seconds%60;minutes=absFloor(seconds/60);data.minutes=minutes%60;hours=absFloor(minutes/60);data.hours=hours%24;days+=absFloor(hours/24);monthsFromDays=absFloor(daysToMonths(days));months+=monthsFromDays;days-=absCeil(monthsToDays(monthsFromDays));years=absFloor(months/12);months%=12;data.days=days;data.months=months;data.years=years;return this;} +function daysToMonths(days){return days*4800/146097;} +function monthsToDays(months){return months*146097/4800;} +function as(units){if(!this.isValid()){return NaN;} +var days;var months;var milliseconds=this._milliseconds;units=normalizeUnits(units);if(units==='month'||units==='year'){days=this._days+milliseconds/864e5;months=this._months+daysToMonths(days);return units==='month'?months:months/12;}else{days=this._days+Math.round(monthsToDays(this._months));switch(units){case'week':return days/7+milliseconds/6048e5;case'day':return days+milliseconds/864e5;case'hour':return days*24+milliseconds/36e5;case'minute':return days*1440+milliseconds/6e4;case'second':return days*86400+milliseconds/1000;case'millisecond':return Math.floor(days*864e5)+milliseconds;default:throw new Error('Unknown unit '+units);}}} +function valueOf$1(){if(!this.isValid()){return NaN;} +return(this._milliseconds+this._days*864e5+(this._months%12)*2592e6+toInt(this._months/12)*31536e6);} +function makeAs(alias){return function(){return this.as(alias);};} +var asMilliseconds=makeAs('ms');var asSeconds=makeAs('s');var asMinutes=makeAs('m');var asHours=makeAs('h');var asDays=makeAs('d');var asWeeks=makeAs('w');var asMonths=makeAs('M');var asYears=makeAs('y');function get$2(units){units=normalizeUnits(units);return this.isValid()?this[units+'s']():NaN;} +function makeGetter(name){return function(){return this.isValid()?this._data[name]:NaN;};} +var milliseconds=makeGetter('milliseconds');var seconds=makeGetter('seconds');var minutes=makeGetter('minutes');var hours=makeGetter('hours');var days=makeGetter('days');var months=makeGetter('months');var years=makeGetter('years');function weeks(){return absFloor(this.days()/7);} +var round=Math.round;var thresholds={ss:44,s:45,m:45,h:22,d:26,M:11};function substituteTimeAgo(string,number,withoutSuffix,isFuture,locale){return locale.relativeTime(number||1,!!withoutSuffix,string,isFuture);} +function relativeTime$1(posNegDuration,withoutSuffix,locale){var duration=createDuration(posNegDuration).abs();var seconds=round(duration.as('s'));var minutes=round(duration.as('m'));var hours=round(duration.as('h'));var days=round(duration.as('d'));var months=round(duration.as('M'));var years=round(duration.as('y'));var a=seconds<=thresholds.ss&&['s',seconds]||seconds0;a[4]=locale;return substituteTimeAgo.apply(null,a);} +function getSetRelativeTimeRounding(roundingFunction){if(roundingFunction===undefined){return round;} +if(typeof(roundingFunction)==='function'){round=roundingFunction;return true;} +return false;} +function getSetRelativeTimeThreshold(threshold,limit){if(thresholds[threshold]===undefined){return false;} +if(limit===undefined){return thresholds[threshold];} +thresholds[threshold]=limit;if(threshold==='s'){thresholds.ss=limit-1;} +return true;} +function humanize(withSuffix){if(!this.isValid()){return this.localeData().invalidDate();} +var locale=this.localeData();var output=relativeTime$1(this,!withSuffix,locale);if(withSuffix){output=locale.pastFuture(+this,output);} +return locale.postformat(output);} +var abs$1=Math.abs;function toISOString$1(){if(!this.isValid()){return this.localeData().invalidDate();} +var seconds=abs$1(this._milliseconds)/1000;var days=abs$1(this._days);var months=abs$1(this._months);var minutes,hours,years;minutes=absFloor(seconds/60);hours=absFloor(minutes/60);seconds%=60;minutes%=60;years=absFloor(months/12);months%=12;var Y=years;var M=months;var D=days;var h=hours;var m=minutes;var s=seconds;var total=this.asSeconds();if(!total){return'P0D';} +return(total<0?'-':'')+'P'+(Y?Y+'Y':'')+(M?M+'M':'')+(D?D+'D':'')+((h||m||s)?'T':'')+(h?h+'H':'')+(m?m+'M':'')+(s?s+'S':'');} +var proto$2=Duration.prototype;proto$2.isValid=isValid$1;proto$2.abs=abs;proto$2.add=add$1;proto$2.subtract=subtract$1;proto$2.as=as;proto$2.asMilliseconds=asMilliseconds;proto$2.asSeconds=asSeconds;proto$2.asMinutes=asMinutes;proto$2.asHours=asHours;proto$2.asDays=asDays;proto$2.asWeeks=asWeeks;proto$2.asMonths=asMonths;proto$2.asYears=asYears;proto$2.valueOf=valueOf$1;proto$2._bubble=bubble;proto$2.get=get$2;proto$2.milliseconds=milliseconds;proto$2.seconds=seconds;proto$2.minutes=minutes;proto$2.hours=hours;proto$2.days=days;proto$2.weeks=weeks;proto$2.months=months;proto$2.years=years;proto$2.humanize=humanize;proto$2.toISOString=toISOString$1;proto$2.toString=toISOString$1;proto$2.toJSON=toISOString$1;proto$2.locale=locale;proto$2.localeData=localeData;proto$2.toIsoString=deprecate('toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)',toISOString$1);proto$2.lang=lang;addFormatToken('X',0,0,'unix');addFormatToken('x',0,0,'valueOf');addRegexToken('x',matchSigned);addRegexToken('X',matchTimestamp);addParseToken('X',function(input,array,config){config._d=new Date(parseFloat(input,10)*1000);});addParseToken('x',function(input,array,config){config._d=new Date(toInt(input));});hooks.version='2.18.1';setHookCallback(createLocal);hooks.fn=proto;hooks.min=min;hooks.max=max;hooks.now=now;hooks.utc=createUTC;hooks.unix=createUnix;hooks.months=listMonths;hooks.isDate=isDate;hooks.locale=getSetGlobalLocale;hooks.invalid=createInvalid;hooks.duration=createDuration;hooks.isMoment=isMoment;hooks.weekdays=listWeekdays;hooks.parseZone=createInZone;hooks.localeData=getLocale;hooks.isDuration=isDuration;hooks.monthsShort=listMonthsShort;hooks.weekdaysMin=listWeekdaysMin;hooks.defineLocale=defineLocale;hooks.updateLocale=updateLocale;hooks.locales=listLocales;hooks.weekdaysShort=listWeekdaysShort;hooks.normalizeUnits=normalizeUnits;hooks.relativeTimeRounding=getSetRelativeTimeRounding;hooks.relativeTimeThreshold=getSetRelativeTimeThreshold;hooks.calendarFormat=getCalendarFormat;hooks.prototype=proto;return hooks;})));},{}],7:[function(require,module,exports){var Chart=require(28)();require(26)(Chart);require(40)(Chart);require(22)(Chart);require(25)(Chart);require(30)(Chart);require(21)(Chart);require(23)(Chart);require(24)(Chart);require(29)(Chart);require(32)(Chart);require(33)(Chart);require(31)(Chart);require(27)(Chart);require(34)(Chart);require(35)(Chart);require(36)(Chart);require(37)(Chart);require(38)(Chart);require(46)(Chart);require(44)(Chart);require(45)(Chart);require(47)(Chart);require(48)(Chart);require(49)(Chart);require(15)(Chart);require(16)(Chart);require(17)(Chart);require(18)(Chart);require(19)(Chart);require(20)(Chart);require(8)(Chart);require(9)(Chart);require(10)(Chart);require(11)(Chart);require(12)(Chart);require(13)(Chart);require(14)(Chart);var plugins=[];plugins.push(require(41)(Chart),require(42)(Chart),require(43)(Chart));Chart.plugins.register(plugins);module.exports=Chart;if(typeof window!=='undefined'){window.Chart=Chart;}},{"10":10,"11":11,"12":12,"13":13,"14":14,"15":15,"16":16,"17":17,"18":18,"19":19,"20":20,"21":21,"22":22,"23":23,"24":24,"25":25,"26":26,"27":27,"28":28,"29":29,"30":30,"31":31,"32":32,"33":33,"34":34,"35":35,"36":36,"37":37,"38":38,"40":40,"41":41,"42":42,"43":43,"44":44,"45":45,"46":46,"47":47,"48":48,"49":49,"8":8,"9":9}],8:[function(require,module,exports){'use strict';module.exports=function(Chart){Chart.Bar=function(context,config){config.type='bar';return new Chart(context,config);};};},{}],9:[function(require,module,exports){'use strict';module.exports=function(Chart){Chart.Bubble=function(context,config){config.type='bubble';return new Chart(context,config);};};},{}],10:[function(require,module,exports){'use strict';module.exports=function(Chart){Chart.Doughnut=function(context,config){config.type='doughnut';return new Chart(context,config);};};},{}],11:[function(require,module,exports){'use strict';module.exports=function(Chart){Chart.Line=function(context,config){config.type='line';return new Chart(context,config);};};},{}],12:[function(require,module,exports){'use strict';module.exports=function(Chart){Chart.PolarArea=function(context,config){config.type='polarArea';return new Chart(context,config);};};},{}],13:[function(require,module,exports){'use strict';module.exports=function(Chart){Chart.Radar=function(context,config){config.type='radar';return new Chart(context,config);};};},{}],14:[function(require,module,exports){'use strict';module.exports=function(Chart){var defaultConfig={hover:{mode:'single'},scales:{xAxes:[{type:'linear',position:'bottom',id:'x-axis-1'}],yAxes:[{type:'linear',position:'left',id:'y-axis-1'}]},tooltips:{callbacks:{title:function(){return'';},label:function(tooltipItem){return'('+tooltipItem.xLabel+', '+tooltipItem.yLabel+')';}}}};Chart.defaults.scatter=defaultConfig;Chart.controllers.scatter=Chart.controllers.line;Chart.Scatter=function(context,config){config.type='scatter';return new Chart(context,config);};};},{}],15:[function(require,module,exports){'use strict';module.exports=function(Chart){var helpers=Chart.helpers;Chart.defaults.bar={hover:{mode:'label'},scales:{xAxes:[{type:'category',categoryPercentage:0.8,barPercentage:0.9,gridLines:{offsetGridLines:true}}],yAxes:[{type:'linear'}]}};Chart.controllers.bar=Chart.DatasetController.extend({dataElementType:Chart.elements.Rectangle,initialize:function(){var me=this;var meta;Chart.DatasetController.prototype.initialize.apply(me,arguments);meta=me.getMeta();meta.stack=me.getDataset().stack;meta.bar=true;},update:function(reset){var me=this;var elements=me.getMeta().data;var i,ilen;me._ruler=me.getRuler();for(i=0,ilen=elements.length;i=0&&ivalue>0)){start+=ivalue;}}}} +base=scale.getPixelForValue(start);head=scale.getPixelForValue(start+value);size=(head-base)/2;return{size:size,base:base,head:head,center:head+size/2};},calculateBarIndexPixels:function(datasetIndex,index,ruler){var me=this;var scale=ruler.scale;var isCombo=me.chart.isCombo;var stackIndex=me.getStackIndex(datasetIndex);var base=scale.getPixelForValue(null,index,datasetIndex,isCombo);var size=ruler.barSize;base-=isCombo?ruler.tickSize/2:0;base+=ruler.fullBarSize*stackIndex;base+=ruler.categorySpacing/2;base+=ruler.barSpacing/2;return{size:size,base:base,head:base+size,center:base+size/2};},draw:function(){var me=this;var chart=me.chart;var elements=me.getMeta().data;var dataset=me.getDataset();var ilen=elements.length;var i=0;var d;helpers.canvas.clipArea(chart.ctx,chart.chartArea);for(;i0){if(tooltipItems[0].yLabel){title=tooltipItems[0].yLabel;}else if(data.labels.length>0&&tooltipItems[0].index');var data=chart.data;var datasets=data.datasets;var labels=data.labels;if(datasets.length){for(var i=0;i');if(labels[i]){text.push(labels[i]);} +text.push('');}} +text.push('');return text.join('');},legend:{labels:{generateLabels:function(chart){var data=chart.data;if(data.labels.length&&data.datasets.length){return data.labels.map(function(label,i){var meta=chart.getDatasetMeta(0);var ds=data.datasets[0];var arc=meta.data[i];var custom=arc&&arc.custom||{};var getValueAtIndexOrDefault=helpers.getValueAtIndexOrDefault;var arcOpts=chart.options.elements.arc;var fill=custom.backgroundColor?custom.backgroundColor:getValueAtIndexOrDefault(ds.backgroundColor,i,arcOpts.backgroundColor);var stroke=custom.borderColor?custom.borderColor:getValueAtIndexOrDefault(ds.borderColor,i,arcOpts.borderColor);var bw=custom.borderWidth?custom.borderWidth:getValueAtIndexOrDefault(ds.borderWidth,i,arcOpts.borderWidth);return{text:label,fillStyle:fill,strokeStyle:stroke,lineWidth:bw,hidden:isNaN(ds.data[i])||meta.data[i].hidden,index:i};});} +return[];}},onClick:function(e,legendItem){var index=legendItem.index;var chart=this.chart;var i,ilen,meta;for(i=0,ilen=(chart.data.datasets||[]).length;i=Math.PI?-1:startAngle<-Math.PI?1:0);var endAngle=startAngle+circumference;var start={x:Math.cos(startAngle),y:Math.sin(startAngle)};var end={x:Math.cos(endAngle),y:Math.sin(endAngle)};var contains0=(startAngle<=0&&0<=endAngle)||(startAngle<=Math.PI*2.0&&Math.PI*2.0<=endAngle);var contains90=(startAngle<=Math.PI*0.5&&Math.PI*0.5<=endAngle)||(startAngle<=Math.PI*2.5&&Math.PI*2.5<=endAngle);var contains180=(startAngle<=-Math.PI&&-Math.PI<=endAngle)||(startAngle<=Math.PI&&Math.PI<=endAngle);var contains270=(startAngle<=-Math.PI*0.5&&-Math.PI*0.5<=endAngle)||(startAngle<=Math.PI*1.5&&Math.PI*1.5<=endAngle);var cutout=cutoutPercentage/100.0;var min={x:contains180?-1:Math.min(start.x*(start.x<0?1:cutout),end.x*(end.x<0?1:cutout)),y:contains270?-1:Math.min(start.y*(start.y<0?1:cutout),end.y*(end.y<0?1:cutout))};var max={x:contains0?1:Math.max(start.x*(start.x>0?1:cutout),end.x*(end.x>0?1:cutout)),y:contains90?1:Math.max(start.y*(start.y>0?1:cutout),end.y*(end.y>0?1:cutout))};var size={width:(max.x-min.x)*0.5,height:(max.y-min.y)*0.5};minSize=Math.min(availableWidth/size.width,availableHeight/size.height);offset={x:(max.x+min.x)*-0.5,y:(max.y+min.y)*-0.5};} +chart.borderWidth=me.getMaxBorderWidth(meta.data);chart.outerRadius=Math.max((minSize-chart.borderWidth)/2,0);chart.innerRadius=Math.max(cutoutPercentage?(chart.outerRadius/100)*(cutoutPercentage):0,0);chart.radiusLength=(chart.outerRadius-chart.innerRadius)/chart.getVisibleDatasetCount();chart.offsetX=offset.x*chart.outerRadius;chart.offsetY=offset.y*chart.outerRadius;meta.total=me.calculateTotal();me.outerRadius=chart.outerRadius-(chart.radiusLength*me.getRingIndex(me.index));me.innerRadius=Math.max(me.outerRadius-chart.radiusLength,0);helpers.each(meta.data,function(arc,index){me.updateElement(arc,index,reset);});},updateElement:function(arc,index,reset){var me=this;var chart=me.chart,chartArea=chart.chartArea,opts=chart.options,animationOpts=opts.animation,centerX=(chartArea.left+chartArea.right)/2,centerY=(chartArea.top+chartArea.bottom)/2,startAngle=opts.rotation,endAngle=opts.rotation,dataset=me.getDataset(),circumference=reset&&animationOpts.animateRotate?0:arc.hidden?0:me.calculateCircumference(dataset.data[index])*(opts.circumference/(2.0*Math.PI)),innerRadius=reset&&animationOpts.animateScale?0:me.innerRadius,outerRadius=reset&&animationOpts.animateScale?0:me.outerRadius,valueAtIndexOrDefault=helpers.getValueAtIndexOrDefault;helpers.extend(arc,{_datasetIndex:me.index,_index:index,_model:{x:centerX+chart.offsetX,y:centerY+chart.offsetY,startAngle:startAngle,endAngle:endAngle,circumference:circumference,outerRadius:outerRadius,innerRadius:innerRadius,label:valueAtIndexOrDefault(dataset.label,index,chart.data.labels[index])}});var model=arc._model;this.removeHoverStyle(arc);if(!reset||!animationOpts.animateRotate){if(index===0){model.startAngle=opts.rotation;}else{model.startAngle=me.getMeta().data[index-1]._model.endAngle;} +model.endAngle=model.startAngle+model.circumference;} +arc.pivot();},removeHoverStyle:function(arc){Chart.DatasetController.prototype.removeHoverStyle.call(this,arc,this.chart.options.elements.arc);},calculateTotal:function(){var dataset=this.getDataset();var meta=this.getMeta();var total=0;var value;helpers.each(meta.data,function(element,index){value=dataset.data[index];if(!isNaN(value)&&!element.hidden){total+=Math.abs(value);}});return total;},calculateCircumference:function(value){var total=this.getMeta().total;if(total>0&&!isNaN(value)){return(Math.PI*2.0)*(value/total);} +return 0;},getMaxBorderWidth:function(elements){var max=0,index=this.index,length=elements.length,borderWidth,hoverWidth;for(var i=0;imax?borderWidth:max;max=hoverWidth>max?hoverWidth:max;} +return max;}});};},{}],18:[function(require,module,exports){'use strict';module.exports=function(Chart){var helpers=Chart.helpers;Chart.defaults.line={showLines:true,spanGaps:false,hover:{mode:'label'},scales:{xAxes:[{type:'category',id:'x-axis-0'}],yAxes:[{type:'linear',id:'y-axis-0'}]}};function lineEnabled(dataset,options){return helpers.getValueOrDefault(dataset.showLine,options.showLines);} +Chart.controllers.line=Chart.DatasetController.extend({datasetElementType:Chart.elements.Line,dataElementType:Chart.elements.Point,update:function(reset){var me=this;var meta=me.getMeta();var line=meta.dataset;var points=meta.data||[];var options=me.chart.options;var lineElementOptions=options.elements.line;var scale=me.getScaleForId(meta.yAxisID);var i,ilen,custom;var dataset=me.getDataset();var showLine=lineEnabled(dataset,options);if(showLine){custom=line.custom||{};if((dataset.tension!==undefined)&&(dataset.lineTension===undefined)){dataset.lineTension=dataset.tension;} +line._scale=scale;line._datasetIndex=me.index;line._children=points;line._model={spanGaps:dataset.spanGaps?dataset.spanGaps:options.spanGaps,tension:custom.tension?custom.tension:helpers.getValueOrDefault(dataset.lineTension,lineElementOptions.tension),backgroundColor:custom.backgroundColor?custom.backgroundColor:(dataset.backgroundColor||lineElementOptions.backgroundColor),borderWidth:custom.borderWidth?custom.borderWidth:(dataset.borderWidth||lineElementOptions.borderWidth),borderColor:custom.borderColor?custom.borderColor:(dataset.borderColor||lineElementOptions.borderColor),borderCapStyle:custom.borderCapStyle?custom.borderCapStyle:(dataset.borderCapStyle||lineElementOptions.borderCapStyle),borderDash:custom.borderDash?custom.borderDash:(dataset.borderDash||lineElementOptions.borderDash),borderDashOffset:custom.borderDashOffset?custom.borderDashOffset:(dataset.borderDashOffset||lineElementOptions.borderDashOffset),borderJoinStyle:custom.borderJoinStyle?custom.borderJoinStyle:(dataset.borderJoinStyle||lineElementOptions.borderJoinStyle),fill:custom.fill?custom.fill:(dataset.fill!==undefined?dataset.fill:lineElementOptions.fill),steppedLine:custom.steppedLine?custom.steppedLine:helpers.getValueOrDefault(dataset.steppedLine,lineElementOptions.stepped),cubicInterpolationMode:custom.cubicInterpolationMode?custom.cubicInterpolationMode:helpers.getValueOrDefault(dataset.cubicInterpolationMode,lineElementOptions.cubicInterpolationMode),};line.pivot();} +for(i=0,ilen=points.length;i');var data=chart.data;var datasets=data.datasets;var labels=data.labels;if(datasets.length){for(var i=0;i');if(labels[i]){text.push(labels[i]);} +text.push('');}} +text.push('');return text.join('');},legend:{labels:{generateLabels:function(chart){var data=chart.data;if(data.labels.length&&data.datasets.length){return data.labels.map(function(label,i){var meta=chart.getDatasetMeta(0);var ds=data.datasets[0];var arc=meta.data[i];var custom=arc.custom||{};var getValueAtIndexOrDefault=helpers.getValueAtIndexOrDefault;var arcOpts=chart.options.elements.arc;var fill=custom.backgroundColor?custom.backgroundColor:getValueAtIndexOrDefault(ds.backgroundColor,i,arcOpts.backgroundColor);var stroke=custom.borderColor?custom.borderColor:getValueAtIndexOrDefault(ds.borderColor,i,arcOpts.borderColor);var bw=custom.borderWidth?custom.borderWidth:getValueAtIndexOrDefault(ds.borderWidth,i,arcOpts.borderWidth);return{text:label,fillStyle:fill,strokeStyle:stroke,lineWidth:bw,hidden:isNaN(ds.data[i])||meta.data[i].hidden,index:i};});} +return[];}},onClick:function(e,legendItem){var index=legendItem.index;var chart=this.chart;var i,ilen,meta;for(i=0,ilen=(chart.data.datasets||[]).length;i0&&!isNaN(value)){return(2*Math.PI)/count;} +return 0;}});};},{}],20:[function(require,module,exports){'use strict';module.exports=function(Chart){var helpers=Chart.helpers;Chart.defaults.radar={aspectRatio:1,scale:{type:'radialLinear'},elements:{line:{tension:0}}};Chart.controllers.radar=Chart.DatasetController.extend({datasetElementType:Chart.elements.Line,dataElementType:Chart.elements.Point,linkScales:helpers.noop,update:function(reset){var me=this;var meta=me.getMeta();var line=meta.dataset;var points=meta.data;var custom=line.custom||{};var dataset=me.getDataset();var lineElementOptions=me.chart.options.elements.line;var scale=me.chart.scale;if((dataset.tension!==undefined)&&(dataset.lineTension===undefined)){dataset.lineTension=dataset.tension;} +helpers.extend(meta.dataset,{_datasetIndex:me.index,_scale:scale,_children:points,_loop:true,_model:{tension:custom.tension?custom.tension:helpers.getValueOrDefault(dataset.lineTension,lineElementOptions.tension),backgroundColor:custom.backgroundColor?custom.backgroundColor:(dataset.backgroundColor||lineElementOptions.backgroundColor),borderWidth:custom.borderWidth?custom.borderWidth:(dataset.borderWidth||lineElementOptions.borderWidth),borderColor:custom.borderColor?custom.borderColor:(dataset.borderColor||lineElementOptions.borderColor),fill:custom.fill?custom.fill:(dataset.fill!==undefined?dataset.fill:lineElementOptions.fill),borderCapStyle:custom.borderCapStyle?custom.borderCapStyle:(dataset.borderCapStyle||lineElementOptions.borderCapStyle),borderDash:custom.borderDash?custom.borderDash:(dataset.borderDash||lineElementOptions.borderDash),borderDashOffset:custom.borderDashOffset?custom.borderDashOffset:(dataset.borderDashOffset||lineElementOptions.borderDashOffset),borderJoinStyle:custom.borderJoinStyle?custom.borderJoinStyle:(dataset.borderJoinStyle||lineElementOptions.borderJoinStyle),}});meta.dataset.pivot();helpers.each(points,function(point,index){me.updateElement(point,index,reset);},me);me.updateBezierControlPoints();},updateElement:function(point,index,reset){var me=this;var custom=point.custom||{};var dataset=me.getDataset();var scale=me.chart.scale;var pointElementOptions=me.chart.options.elements.point;var pointPosition=scale.getPointPositionForValue(index,dataset.data[index]);if((dataset.radius!==undefined)&&(dataset.pointRadius===undefined)){dataset.pointRadius=dataset.radius;} +if((dataset.hitRadius!==undefined)&&(dataset.pointHitRadius===undefined)){dataset.pointHitRadius=dataset.hitRadius;} +helpers.extend(point,{_datasetIndex:me.index,_index:index,_scale:scale,_model:{x:reset?scale.xCenter:pointPosition.x,y:reset?scale.yCenter:pointPosition.y,tension:custom.tension?custom.tension:helpers.getValueOrDefault(dataset.lineTension,me.chart.options.elements.line.tension),radius:custom.radius?custom.radius:helpers.getValueAtIndexOrDefault(dataset.pointRadius,index,pointElementOptions.radius),backgroundColor:custom.backgroundColor?custom.backgroundColor:helpers.getValueAtIndexOrDefault(dataset.pointBackgroundColor,index,pointElementOptions.backgroundColor),borderColor:custom.borderColor?custom.borderColor:helpers.getValueAtIndexOrDefault(dataset.pointBorderColor,index,pointElementOptions.borderColor),borderWidth:custom.borderWidth?custom.borderWidth:helpers.getValueAtIndexOrDefault(dataset.pointBorderWidth,index,pointElementOptions.borderWidth),pointStyle:custom.pointStyle?custom.pointStyle:helpers.getValueAtIndexOrDefault(dataset.pointStyle,index,pointElementOptions.pointStyle),hitRadius:custom.hitRadius?custom.hitRadius:helpers.getValueAtIndexOrDefault(dataset.pointHitRadius,index,pointElementOptions.hitRadius)}});point._model.skip=custom.skip?custom.skip:(isNaN(point._model.x)||isNaN(point._model.y));},updateBezierControlPoints:function(){var chartArea=this.chart.chartArea;var meta=this.getMeta();helpers.each(meta.data,function(point,index){var model=point._model;var controlPoints=helpers.splineCurve(helpers.previousItem(meta.data,index,true)._model,model,helpers.nextItem(meta.data,index,true)._model,model.tension);model.controlPointPreviousX=Math.max(Math.min(controlPoints.previous.x,chartArea.right),chartArea.left);model.controlPointPreviousY=Math.max(Math.min(controlPoints.previous.y,chartArea.bottom),chartArea.top);model.controlPointNextX=Math.max(Math.min(controlPoints.next.x,chartArea.right),chartArea.left);model.controlPointNextY=Math.max(Math.min(controlPoints.next.y,chartArea.bottom),chartArea.top);point.pivot();});},setHoverStyle:function(point){var dataset=this.chart.data.datasets[point._datasetIndex];var custom=point.custom||{};var index=point._index;var model=point._model;model.radius=custom.hoverRadius?custom.hoverRadius:helpers.getValueAtIndexOrDefault(dataset.pointHoverRadius,index,this.chart.options.elements.point.hoverRadius);model.backgroundColor=custom.hoverBackgroundColor?custom.hoverBackgroundColor:helpers.getValueAtIndexOrDefault(dataset.pointHoverBackgroundColor,index,helpers.getHoverColor(model.backgroundColor));model.borderColor=custom.hoverBorderColor?custom.hoverBorderColor:helpers.getValueAtIndexOrDefault(dataset.pointHoverBorderColor,index,helpers.getHoverColor(model.borderColor));model.borderWidth=custom.hoverBorderWidth?custom.hoverBorderWidth:helpers.getValueAtIndexOrDefault(dataset.pointHoverBorderWidth,index,model.borderWidth);},removeHoverStyle:function(point){var dataset=this.chart.data.datasets[point._datasetIndex];var custom=point.custom||{};var index=point._index;var model=point._model;var pointElementOptions=this.chart.options.elements.point;model.radius=custom.radius?custom.radius:helpers.getValueAtIndexOrDefault(dataset.pointRadius,index,pointElementOptions.radius);model.backgroundColor=custom.backgroundColor?custom.backgroundColor:helpers.getValueAtIndexOrDefault(dataset.pointBackgroundColor,index,pointElementOptions.backgroundColor);model.borderColor=custom.borderColor?custom.borderColor:helpers.getValueAtIndexOrDefault(dataset.pointBorderColor,index,pointElementOptions.borderColor);model.borderWidth=custom.borderWidth?custom.borderWidth:helpers.getValueAtIndexOrDefault(dataset.pointBorderWidth,index,pointElementOptions.borderWidth);}});};},{}],21:[function(require,module,exports){'use strict';module.exports=function(Chart){var helpers=Chart.helpers;Chart.defaults.global.animation={duration:1000,easing:'easeOutQuart',onProgress:helpers.noop,onComplete:helpers.noop};Chart.Animation=Chart.Element.extend({chart:null,currentStep:0,numSteps:60,easing:'',render:null,onAnimationProgress:null,onAnimationComplete:null,});Chart.animationService={frameDuration:17,animations:[],dropFrames:0,request:null,addAnimation:function(chart,animation,duration,lazy){var animations=this.animations;var i,ilen;animation.chart=chart;if(!lazy){chart.animating=true;} +for(i=0,ilen=animations.length;i1){framesToDrop=Math.floor(me.dropFrames);me.dropFrames=me.dropFrames%1;} +me.advance(1+framesToDrop);var endTime=Date.now();me.dropFrames+=(endTime-startTime)/me.frameDuration;if(me.animations.length>0){me.requestAnimationFrame();}},advance:function(count){var animations=this.animations;var animation,chart;var i=0;while(i=animation.numSteps){helpers.callback(animation.onAnimationComplete,[animation],chart);chart.animating=false;animations.splice(i,1);}else{++i;}}}};Object.defineProperty(Chart.Animation.prototype,'animationObject',{get:function(){return this;}});Object.defineProperty(Chart.Animation.prototype,'chartInstance',{get:function(){return this.chart;},set:function(value){this.chart=value;}});};},{}],22:[function(require,module,exports){'use strict';module.exports=function(Chart){var helpers=Chart.canvasHelpers={};helpers.drawPoint=function(ctx,pointStyle,radius,x,y){var type,edgeLength,xOffset,yOffset,height,size;if(typeof pointStyle==='object'){type=pointStyle.toString();if(type==='[object HTMLImageElement]'||type==='[object HTMLCanvasElement]'){ctx.drawImage(pointStyle,x-pointStyle.width/2,y-pointStyle.height/2,pointStyle.width,pointStyle.height);return;}} +if(isNaN(radius)||radius<=0){return;} +switch(pointStyle){default:ctx.beginPath();ctx.arc(x,y,radius,0,Math.PI*2);ctx.closePath();ctx.fill();break;case'triangle':ctx.beginPath();edgeLength=3*radius/Math.sqrt(3);height=edgeLength*Math.sqrt(3)/2;ctx.moveTo(x-edgeLength/2,y+height/3);ctx.lineTo(x+edgeLength/2,y+height/3);ctx.lineTo(x,y-2*height/3);ctx.closePath();ctx.fill();break;case'rect':size=1/Math.SQRT2*radius;ctx.beginPath();ctx.fillRect(x-size,y-size,2*size,2*size);ctx.strokeRect(x-size,y-size,2*size,2*size);break;case'rectRounded':var offset=radius/Math.SQRT2;var leftX=x-offset;var topY=y-offset;var sideSize=Math.SQRT2*radius;Chart.helpers.drawRoundedRectangle(ctx,leftX,topY,sideSize,sideSize,radius/2);ctx.fill();break;case'rectRot':size=1/Math.SQRT2*radius;ctx.beginPath();ctx.moveTo(x-size,y);ctx.lineTo(x,y+size);ctx.lineTo(x+size,y);ctx.lineTo(x,y-size);ctx.closePath();ctx.fill();break;case'cross':ctx.beginPath();ctx.moveTo(x,y+radius);ctx.lineTo(x,y-radius);ctx.moveTo(x-radius,y);ctx.lineTo(x+radius,y);ctx.closePath();break;case'crossRot':ctx.beginPath();xOffset=Math.cos(Math.PI/4)*radius;yOffset=Math.sin(Math.PI/4)*radius;ctx.moveTo(x-xOffset,y-yOffset);ctx.lineTo(x+xOffset,y+yOffset);ctx.moveTo(x-xOffset,y+yOffset);ctx.lineTo(x+xOffset,y-yOffset);ctx.closePath();break;case'star':ctx.beginPath();ctx.moveTo(x,y+radius);ctx.lineTo(x,y-radius);ctx.moveTo(x-radius,y);ctx.lineTo(x+radius,y);xOffset=Math.cos(Math.PI/4)*radius;yOffset=Math.sin(Math.PI/4)*radius;ctx.moveTo(x-xOffset,y-yOffset);ctx.lineTo(x+xOffset,y+yOffset);ctx.moveTo(x-xOffset,y+yOffset);ctx.lineTo(x+xOffset,y-yOffset);ctx.closePath();break;case'line':ctx.beginPath();ctx.moveTo(x-radius,y);ctx.lineTo(x+radius,y);ctx.closePath();break;case'dash':ctx.beginPath();ctx.moveTo(x,y);ctx.lineTo(x+radius,y);ctx.closePath();break;} +ctx.stroke();};helpers.clipArea=function(ctx,clipArea){ctx.save();ctx.beginPath();ctx.rect(clipArea.left,clipArea.top,clipArea.right-clipArea.left,clipArea.bottom-clipArea.top);ctx.clip();};helpers.unclipArea=function(ctx){ctx.restore();};helpers.lineTo=function(ctx,previous,target,flip){if(target.steppedLine){if(target.steppedLine==='after'){ctx.lineTo(previous.x,target.y);}else{ctx.lineTo(target.x,previous.y);} +ctx.lineTo(target.x,target.y);return;} +if(!target.tension){ctx.lineTo(target.x,target.y);return;} +ctx.bezierCurveTo(flip?previous.controlPointPreviousX:previous.controlPointNextX,flip?previous.controlPointPreviousY:previous.controlPointNextY,flip?target.controlPointNextX:target.controlPointPreviousX,flip?target.controlPointNextY:target.controlPointPreviousY,target.x,target.y);};Chart.helpers.canvas=helpers;};},{}],23:[function(require,module,exports){'use strict';module.exports=function(Chart){var helpers=Chart.helpers;var plugins=Chart.plugins;var platform=Chart.platform;Chart.types={};Chart.instances={};Chart.controllers={};function initConfig(config){config=config||{};var data=config.data=config.data||{};data.datasets=data.datasets||[];data.labels=data.labels||[];config.options=helpers.configMerge(Chart.defaults.global,Chart.defaults[config.type],config.options||{});return config;} +function updateConfig(chart){var newOptions=chart.options;if(newOptions.scale){chart.scale.options=newOptions.scale;}else if(newOptions.scales){newOptions.scales.xAxes.concat(newOptions.scales.yAxes).forEach(function(scaleOptions){chart.scales[scaleOptions.id].options=scaleOptions;});} +chart.tooltip._options=newOptions.tooltips;} +function positionIsHorizontal(position){return position==='top'||position==='bottom';} +helpers.extend(Chart.prototype,{construct:function(item,config){var me=this;config=initConfig(config);var context=platform.acquireContext(item,config);var canvas=context&&context.canvas;var height=canvas&&canvas.height;var width=canvas&&canvas.width;me.id=helpers.uid();me.ctx=context;me.canvas=canvas;me.config=config;me.width=width;me.height=height;me.aspectRatio=height?width/height:null;me.options=config.options;me._bufferedRender=false;me.chart=me;me.controller=me;Chart.instances[me.id]=me;Object.defineProperty(me,'data',{get:function(){return me.config.data;},set:function(value){me.config.data=value;}});if(!context||!canvas){console.error("Failed to create chart: can't acquire context from the given item");return;} +me.initialize();me.update();},initialize:function(){var me=this;plugins.notify(me,'beforeInit');helpers.retinaScale(me);me.bindEvents();if(me.options.responsive){me.resize(true);} +me.ensureScalesHaveIDs();me.buildScales();me.initToolTip();plugins.notify(me,'afterInit');return me;},clear:function(){helpers.clear(this);return this;},stop:function(){Chart.animationService.cancelAnimation(this);return this;},resize:function(silent){var me=this;var options=me.options;var canvas=me.canvas;var aspectRatio=(options.maintainAspectRatio&&me.aspectRatio)||null;var newWidth=Math.floor(helpers.getMaximumWidth(canvas));var newHeight=Math.floor(aspectRatio?newWidth/aspectRatio:helpers.getMaximumHeight(canvas));if(me.width===newWidth&&me.height===newHeight){return;} +canvas.width=me.width=newWidth;canvas.height=me.height=newHeight;canvas.style.width=newWidth+'px';canvas.style.height=newHeight+'px';helpers.retinaScale(me);if(!silent){var newSize={width:newWidth,height:newHeight};plugins.notify(me,'resize',[newSize]);if(me.options.onResize){me.options.onResize(me,newSize);} +me.stop();me.update(me.options.responsiveAnimationDuration);}},ensureScalesHaveIDs:function(){var options=this.options;var scalesOptions=options.scales||{};var scaleOptions=options.scale;helpers.each(scalesOptions.xAxes,function(xAxisOptions,index){xAxisOptions.id=xAxisOptions.id||('x-axis-'+index);});helpers.each(scalesOptions.yAxes,function(yAxisOptions,index){yAxisOptions.id=yAxisOptions.id||('y-axis-'+index);});if(scaleOptions){scaleOptions.id=scaleOptions.id||'scale';}},buildScales:function(){var me=this;var options=me.options;var scales=me.scales={};var items=[];if(options.scales){items=items.concat((options.scales.xAxes||[]).map(function(xAxisOptions){return{options:xAxisOptions,dtype:'category',dposition:'bottom'};}),(options.scales.yAxes||[]).map(function(yAxisOptions){return{options:yAxisOptions,dtype:'linear',dposition:'left'};}));} +if(options.scale){items.push({options:options.scale,dtype:'radialLinear',isDefault:true,dposition:'chartArea'});} +helpers.each(items,function(item){var scaleOptions=item.options;var scaleType=helpers.getValueOrDefault(scaleOptions.type,item.dtype);var scaleClass=Chart.scaleService.getScaleConstructor(scaleType);if(!scaleClass){return;} +if(positionIsHorizontal(scaleOptions.position)!==positionIsHorizontal(item.dposition)){scaleOptions.position=item.dposition;} +var scale=new scaleClass({id:scaleOptions.id,options:scaleOptions,ctx:me.ctx,chart:me});scales[scale.id]=scale;if(item.isDefault){me.scale=scale;}});Chart.scaleService.addScalesToLayout(this);},buildOrUpdateControllers:function(){var me=this;var types=[];var newControllers=[];helpers.each(me.data.datasets,function(dataset,datasetIndex){var meta=me.getDatasetMeta(datasetIndex);if(!meta.type){meta.type=dataset.type||me.config.type;} +types.push(meta.type);if(meta.controller){meta.controller.updateIndex(datasetIndex);}else{var ControllerClass=Chart.controllers[meta.type];if(ControllerClass===undefined){throw new Error('"'+meta.type+'" is not a chart type.');} +meta.controller=new ControllerClass(me,datasetIndex);newControllers.push(meta.controller);}},me);if(types.length>1){for(var i=1;i=0;--i){if(me.isDatasetVisible(i)){me.drawDataset(i,easingValue);}} +plugins.notify(me,'afterDatasetsDraw',[easingValue]);},drawDataset:function(index,easingValue){var me=this;var meta=me.getDatasetMeta(index);var args={meta:meta,index:index,easingValue:easingValue};if(plugins.notify(me,'beforeDatasetDraw',[args])===false){return;} +meta.controller.draw(easingValue);plugins.notify(me,'afterDatasetDraw',[args]);},getElementAtEvent:function(e){return Chart.Interaction.modes.single(this,e);},getElementsAtEvent:function(e){return Chart.Interaction.modes.label(this,e,{intersect:true});},getElementsAtXAxis:function(e){return Chart.Interaction.modes['x-axis'](this,e,{intersect:true});},getElementsAtEventForMode:function(e,mode,options){var method=Chart.Interaction.modes[mode];if(typeof method==='function'){return method(this,e,options);} +return[];},getDatasetAtEvent:function(e){return Chart.Interaction.modes.dataset(this,e,{intersect:true});},getDatasetMeta:function(datasetIndex){var me=this;var dataset=me.data.datasets[datasetIndex];if(!dataset._meta){dataset._meta={};} +var meta=dataset._meta[me.id];if(!meta){meta=dataset._meta[me.id]={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null};} +return meta;},getVisibleDatasetCount:function(){var count=0;for(var i=0,ilen=this.data.datasets.length;i0){return;} +arrayEvents.forEach(function(key){delete array[key];});delete array._chartjs;} +Chart.DatasetController=function(chart,datasetIndex){this.initialize(chart,datasetIndex);};helpers.extend(Chart.DatasetController.prototype,{datasetElementType:null,dataElementType:null,initialize:function(chart,datasetIndex){var me=this;me.chart=chart;me.index=datasetIndex;me.linkScales();me.addElements();},updateIndex:function(datasetIndex){this.index=datasetIndex;},linkScales:function(){var me=this;var meta=me.getMeta();var dataset=me.getDataset();if(meta.xAxisID===null){meta.xAxisID=dataset.xAxisID||me.chart.options.scales.xAxes[0].id;} +if(meta.yAxisID===null){meta.yAxisID=dataset.yAxisID||me.chart.options.scales.yAxes[0].id;}},getDataset:function(){return this.chart.data.datasets[this.index];},getMeta:function(){return this.chart.getDatasetMeta(this.index);},getScaleForId:function(scaleID){return this.chart.scales[scaleID];},reset:function(){this.update(true);},destroy:function(){if(this._data){unlistenArrayEvents(this._data,this);}},createMetaDataset:function(){var me=this;var type=me.datasetElementType;return type&&new type({_chart:me.chart,_datasetIndex:me.index});},createMetaData:function(index){var me=this;var type=me.dataElementType;return type&&new type({_chart:me.chart,_datasetIndex:me.index,_index:index});},addElements:function(){var me=this;var meta=me.getMeta();var data=me.getDataset().data||[];var metaData=meta.data;var i,ilen;for(i=0,ilen=data.length;inumMeta){me.insertElements(numMeta,numData-numMeta);}},insertElements:function(start,count){for(var i=0;i=0;i--){callback.call(self,loopable[i],i);}}else{for(i=0;i=base[key].length||!base[key][index].type){base[key].push(helpers.configMerge(axisDefaults,valueObj));}else if(valueObj.type&&valueObj.type!==base[key][index].type){base[key][index]=helpers.configMerge(base[key][index],axisDefaults,valueObj);}else{base[key][index]=helpers.configMerge(base[key][index],valueObj);}});}else{base[key]=[];helpers.each(value,function(valueObj){var axisType=helpers.getValueOrDefault(valueObj.type,key==='xAxes'?'category':'linear');base[key].push(helpers.configMerge(Chart.scaleService.getScaleDefaults(axisType),valueObj));});}}else if(base.hasOwnProperty(key)&&typeof base[key]==='object'&&base[key]!==null&&typeof value==='object'){base[key]=helpers.configMerge(base[key],value);}else{base[key]=value;}});return base;};helpers.getValueAtIndexOrDefault=function(value,index,defaultValue){if(value===undefined||value===null){return defaultValue;} +if(helpers.isArray(value)){return index=0;i--){var currentItem=arrayToSearch[i];if(filterCallback(currentItem)){return currentItem;}}};helpers.inherits=function(extensions){var me=this;var ChartElement=(extensions&&extensions.hasOwnProperty('constructor'))?extensions.constructor:function(){return me.apply(this,arguments);};var Surrogate=function(){this.constructor=ChartElement;};Surrogate.prototype=me.prototype;ChartElement.prototype=new Surrogate();ChartElement.extend=helpers.inherits;if(extensions){helpers.extend(ChartElement.prototype,extensions);} +ChartElement.__super__=me.prototype;return ChartElement;};helpers.noop=function(){};helpers.uid=(function(){var id=0;return function(){return id++;};}());helpers.isNumber=function(n){return!isNaN(parseFloat(n))&&isFinite(n);};helpers.almostEquals=function(x,y,epsilon){return Math.abs(x-y)x));};helpers.max=function(array){return array.reduce(function(max,value){if(!isNaN(value)){return Math.max(max,value);} +return max;},Number.NEGATIVE_INFINITY);};helpers.min=function(array){return array.reduce(function(min,value){if(!isNaN(value)){return Math.min(min,value);} +return min;},Number.POSITIVE_INFINITY);};helpers.sign=Math.sign?function(x){return Math.sign(x);}:function(x){x=+x;if(x===0||isNaN(x)){return x;} +return x>0?1:-1;};helpers.log10=Math.log10?function(x){return Math.log10(x);}:function(x){return Math.log(x)/Math.LN10;};helpers.toRadians=function(degrees){return degrees*(Math.PI/180);};helpers.toDegrees=function(radians){return radians*(180/Math.PI);};helpers.getAngleFromPoint=function(centrePoint,anglePoint){var distanceFromXCenter=anglePoint.x-centrePoint.x,distanceFromYCenter=anglePoint.y-centrePoint.y,radialDistanceFromCenter=Math.sqrt(distanceFromXCenter*distanceFromXCenter+distanceFromYCenter*distanceFromYCenter);var angle=Math.atan2(distanceFromYCenter,distanceFromXCenter);if(angle<(-0.5*Math.PI)){angle+=2.0*Math.PI;} +return{angle:angle,distance:radialDistanceFromCenter};};helpers.distanceBetweenPoints=function(pt1,pt2){return Math.sqrt(Math.pow(pt2.x-pt1.x,2)+Math.pow(pt2.y-pt1.y,2));};helpers.aliasPixel=function(pixelWidth){return(pixelWidth%2===0)?0:0.5;};helpers.splineCurve=function(firstPoint,middlePoint,afterPoint,t){var previous=firstPoint.skip?middlePoint:firstPoint,current=middlePoint,next=afterPoint.skip?middlePoint:afterPoint;var d01=Math.sqrt(Math.pow(current.x-previous.x,2)+Math.pow(current.y-previous.y,2));var d12=Math.sqrt(Math.pow(next.x-current.x,2)+Math.pow(next.y-current.y,2));var s01=d01/(d01+d12);var s12=d12/(d01+d12);s01=isNaN(s01)?0:s01;s12=isNaN(s12)?0:s12;var fa=t*s01;var fb=t*s12;return{previous:{x:current.x-fa*(next.x-previous.x),y:current.y-fa*(next.y-previous.y)},next:{x:current.x+fb*(next.x-previous.x),y:current.y+fb*(next.y-previous.y)}};};helpers.EPSILON=Number.EPSILON||1e-14;helpers.splineCurveMonotone=function(points){var pointsWithTangents=(points||[]).map(function(point){return{model:point._model,deltaK:0,mK:0};});var pointsLen=pointsWithTangents.length;var i,pointBefore,pointCurrent,pointAfter;for(i=0;i0?pointsWithTangents[i-1]:null;pointAfter=i0?pointsWithTangents[i-1]:null;pointAfter=i=collection.length-1?collection[0]:collection[index+1];} +return index>=collection.length-1?collection[collection.length-1]:collection[index+1];};helpers.previousItem=function(collection,index,loop){if(loop){return index<=0?collection[collection.length-1]:collection[index-1];} +return index<=0?collection[0]:collection[index-1];};helpers.niceNum=function(range,round){var exponent=Math.floor(helpers.log10(range));var fraction=range/Math.pow(10,exponent);var niceFraction;if(round){if(fraction<1.5){niceFraction=1;}else if(fraction<3){niceFraction=2;}else if(fraction<7){niceFraction=5;}else{niceFraction=10;}}else if(fraction<=1.0){niceFraction=1;}else if(fraction<=2){niceFraction=2;}else if(fraction<=5){niceFraction=5;}else{niceFraction=10;} +return niceFraction*Math.pow(10,exponent);};var easingEffects=helpers.easingEffects={linear:function(t){return t;},easeInQuad:function(t){return t*t;},easeOutQuad:function(t){return-1*t*(t-2);},easeInOutQuad:function(t){if((t/=1/2)<1){return 1/2*t*t;} +return-1/2*((--t)*(t-2)-1);},easeInCubic:function(t){return t*t*t;},easeOutCubic:function(t){return 1*((t=t/1-1)*t*t+1);},easeInOutCubic:function(t){if((t/=1/2)<1){return 1/2*t*t*t;} +return 1/2*((t-=2)*t*t+2);},easeInQuart:function(t){return t*t*t*t;},easeOutQuart:function(t){return-1*((t=t/1-1)*t*t*t-1);},easeInOutQuart:function(t){if((t/=1/2)<1){return 1/2*t*t*t*t;} +return-1/2*((t-=2)*t*t*t-2);},easeInQuint:function(t){return 1*(t/=1)*t*t*t*t;},easeOutQuint:function(t){return 1*((t=t/1-1)*t*t*t*t+1);},easeInOutQuint:function(t){if((t/=1/2)<1){return 1/2*t*t*t*t*t;} +return 1/2*((t-=2)*t*t*t*t+2);},easeInSine:function(t){return-1*Math.cos(t/1*(Math.PI/2))+1;},easeOutSine:function(t){return 1*Math.sin(t/1*(Math.PI/2));},easeInOutSine:function(t){return-1/2*(Math.cos(Math.PI*t/1)-1);},easeInExpo:function(t){return(t===0)?1:1*Math.pow(2,10*(t/1-1));},easeOutExpo:function(t){return(t===1)?1:1*(-Math.pow(2,-10*t/1)+1);},easeInOutExpo:function(t){if(t===0){return 0;} +if(t===1){return 1;} +if((t/=1/2)<1){return 1/2*Math.pow(2,10*(t-1));} +return 1/2*(-Math.pow(2,-10*--t)+2);},easeInCirc:function(t){if(t>=1){return t;} +return-1*(Math.sqrt(1-(t/=1)*t)-1);},easeOutCirc:function(t){return 1*Math.sqrt(1-(t=t/1-1)*t);},easeInOutCirc:function(t){if((t/=1/2)<1){return-1/2*(Math.sqrt(1-t*t)-1);} +return 1/2*(Math.sqrt(1-(t-=2)*t)+1);},easeInElastic:function(t){var s=1.70158;var p=0;var a=1;if(t===0){return 0;} +if((t/=1)===1){return 1;} +if(!p){p=1*0.3;} +if(a0){mouseX=touches[0].clientX;mouseY=touches[0].clientY;}else{mouseX=e.clientX;mouseY=e.clientY;} +var paddingLeft=parseFloat(helpers.getStyle(canvas,'padding-left'));var paddingTop=parseFloat(helpers.getStyle(canvas,'padding-top'));var paddingRight=parseFloat(helpers.getStyle(canvas,'padding-right'));var paddingBottom=parseFloat(helpers.getStyle(canvas,'padding-bottom'));var width=boundingRect.right-boundingRect.left-paddingLeft-paddingRight;var height=boundingRect.bottom-boundingRect.top-paddingTop-paddingBottom;mouseX=Math.round((mouseX-boundingRect.left-paddingLeft)/(width)*canvas.width/chart.currentDevicePixelRatio);mouseY=Math.round((mouseY-boundingRect.top-paddingTop)/(height)*canvas.height/chart.currentDevicePixelRatio);return{x:mouseX,y:mouseY};};helpers.addEvent=function(node,eventType,method){if(node.addEventListener){node.addEventListener(eventType,method);}else if(node.attachEvent){node.attachEvent('on'+eventType,method);}else{node['on'+eventType]=method;}};helpers.removeEvent=function(node,eventType,handler){if(node.removeEventListener){node.removeEventListener(eventType,handler,false);}else if(node.detachEvent){node.detachEvent('on'+eventType,handler);}else{node['on'+eventType]=helpers.noop;}};function parseMaxStyle(styleValue,node,parentProperty){var valueInPixels;if(typeof(styleValue)==='string'){valueInPixels=parseInt(styleValue,10);if(styleValue.indexOf('%')!==-1){valueInPixels=valueInPixels/100*node.parentNode[parentProperty];}}else{valueInPixels=styleValue;} +return valueInPixels;} +function isConstrainedValue(value){return value!==undefined&&value!==null&&value!=='none';} +function getConstraintDimension(domNode,maxStyle,percentageProperty){var view=document.defaultView;var parentNode=domNode.parentNode;var constrainedNode=view.getComputedStyle(domNode)[maxStyle];var constrainedContainer=view.getComputedStyle(parentNode)[maxStyle];var hasCNode=isConstrainedValue(constrainedNode);var hasCContainer=isConstrainedValue(constrainedContainer);var infinity=Number.POSITIVE_INFINITY;if(hasCNode||hasCContainer){return Math.min(hasCNode?parseMaxStyle(constrainedNode,domNode,percentageProperty):infinity,hasCContainer?parseMaxStyle(constrainedContainer,parentNode,percentageProperty):infinity);} +return'none';} +helpers.getConstraintWidth=function(domNode){return getConstraintDimension(domNode,'max-width','clientWidth');};helpers.getConstraintHeight=function(domNode){return getConstraintDimension(domNode,'max-height','clientHeight');};helpers.getMaximumWidth=function(domNode){var container=domNode.parentNode;var paddingLeft=parseInt(helpers.getStyle(container,'padding-left'),10);var paddingRight=parseInt(helpers.getStyle(container,'padding-right'),10);var w=container.clientWidth-paddingLeft-paddingRight;var cw=helpers.getConstraintWidth(domNode);return isNaN(cw)?w:Math.min(w,cw);};helpers.getMaximumHeight=function(domNode){var container=domNode.parentNode;var paddingTop=parseInt(helpers.getStyle(container,'padding-top'),10);var paddingBottom=parseInt(helpers.getStyle(container,'padding-bottom'),10);var h=container.clientHeight-paddingTop-paddingBottom;var ch=helpers.getConstraintHeight(domNode);return isNaN(ch)?h:Math.min(h,ch);};helpers.getStyle=function(el,property){return el.currentStyle?el.currentStyle[property]:document.defaultView.getComputedStyle(el,null).getPropertyValue(property);};helpers.retinaScale=function(chart){var pixelRatio=chart.currentDevicePixelRatio=window.devicePixelRatio||1;if(pixelRatio===1){return;} +var canvas=chart.canvas;var height=chart.height;var width=chart.width;canvas.height=height*pixelRatio;canvas.width=width*pixelRatio;chart.ctx.scale(pixelRatio,pixelRatio);canvas.style.height=height+'px';canvas.style.width=width+'px';};helpers.clear=function(chart){chart.ctx.clearRect(0,0,chart.width,chart.height);};helpers.fontString=function(pixelSize,fontStyle,fontFamily){return fontStyle+' '+pixelSize+'px '+fontFamily;};helpers.longestText=function(ctx,font,arrayOfThings,cache){cache=cache||{};var data=cache.data=cache.data||{};var gc=cache.garbageCollect=cache.garbageCollect||[];if(cache.font!==font){data=cache.data={};gc=cache.garbageCollect=[];cache.font=font;} +ctx.font=font;var longest=0;helpers.each(arrayOfThings,function(thing){if(thing!==undefined&&thing!==null&&helpers.isArray(thing)!==true){longest=helpers.measureText(ctx,data,gc,longest,thing);}else if(helpers.isArray(thing)){helpers.each(thing,function(nestedThing){if(nestedThing!==undefined&&nestedThing!==null&&!helpers.isArray(nestedThing)){longest=helpers.measureText(ctx,data,gc,longest,nestedThing);}});}});var gcLen=gc.length/2;if(gcLen>arrayOfThings.length){for(var i=0;ilongest){longest=textWidth;} +return longest;};helpers.numberOfLabelLines=function(arrayOfThings){var numberOfLines=1;helpers.each(arrayOfThings,function(thing){if(helpers.isArray(thing)){if(thing.length>numberOfLines){numberOfLines=thing.length;}}});return numberOfLines;};helpers.drawRoundedRectangle=function(ctx,x,y,width,height,radius){ctx.beginPath();ctx.moveTo(x+radius,y);ctx.lineTo(x+width-radius,y);ctx.quadraticCurveTo(x+width,y,x+width,y+radius);ctx.lineTo(x+width,y+height-radius);ctx.quadraticCurveTo(x+width,y+height,x+width-radius,y+height);ctx.lineTo(x+radius,y+height);ctx.quadraticCurveTo(x,y+height,x,y+height-radius);ctx.lineTo(x,y+radius);ctx.quadraticCurveTo(x,y,x+radius,y);ctx.closePath();};helpers.color=!color?function(value){console.error('Color.js not found!');return value;}:function(value){if(value instanceof CanvasGradient){value=Chart.defaults.global.defaultColor;} +return color(value);};helpers.isArray=Array.isArray?function(obj){return Array.isArray(obj);}:function(obj){return Object.prototype.toString.call(obj)==='[object Array]';};helpers.arrayEquals=function(a0,a1){var i,ilen,v0,v1;if(!a0||!a1||a0.length!==a1.length){return false;} +for(i=0,ilen=a0.length;i0){items=chart.getDatasetMeta(items[0]._datasetIndex).data;} +return items;},'x-axis':function(chart,e){return indexMode(chart,e,true);},point:function(chart,e){var position=getRelativePosition(e,chart);return getIntersectItems(chart,position);},nearest:function(chart,e,options){var position=getRelativePosition(e,chart);var nearestItems=getNearestItems(chart,position,options.intersect);if(nearestItems.length>1){nearestItems.sort(function(a,b){var sizeA=a.getArea();var sizeB=b.getArea();var ret=sizeA-sizeB;if(ret===0){ret=a._datasetIndex-b._datasetIndex;} +return ret;});} +return nearestItems.slice(0,1);},x:function(chart,e,options){var position=getRelativePosition(e,chart);var items=[];var intersectsItem=false;parseVisibleItems(chart,function(element){if(element.inXRange(position.x)){items.push(element);} +if(element.inRange(position.x,position.y)){intersectsItem=true;}});if(options.intersect&&!intersectsItem){items=[];} +return items;},y:function(chart,e,options){var position=getRelativePosition(e,chart);var items=[];var intersectsItem=false;parseVisibleItems(chart,function(element){if(element.inYRange(position.y)){items.push(element);} +if(element.inRange(position.x,position.y)){intersectsItem=true;}});if(options.intersect&&!intersectsItem){items=[];} +return items;}}};};},{}],28:[function(require,module,exports){'use strict';module.exports=function(){var Chart=function(item,config){this.construct(item,config);return this;};Chart.defaults={global:{responsive:true,responsiveAnimationDuration:0,maintainAspectRatio:true,events:['mousemove','mouseout','click','touchstart','touchmove'],hover:{onHover:null,mode:'nearest',intersect:true,animationDuration:400},onClick:null,defaultColor:'rgba(0,0,0,0.1)',defaultFontColor:'#666',defaultFontFamily:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",defaultFontSize:12,defaultFontStyle:'normal',showLines:true,elements:{},legendCallback:function(chart){var text=[];text.push('
    ');for(var i=0;i');if(chart.data.datasets[i].label){text.push(chart.data.datasets[i].label);} +text.push('');} +text.push('
');return text.join('');}}};Chart.Chart=Chart;return Chart;};},{}],29:[function(require,module,exports){'use strict';module.exports=function(Chart){var helpers=Chart.helpers;function filterByPosition(array,position){return helpers.where(array,function(v){return v.position===position;});} +function sortByWeight(array,reverse){array.forEach(function(v,i){v._tmpIndex_=i;return v;});array.sort(function(a,b){var v0=reverse?b:a;var v1=reverse?a:b;return v0.weight===v1.weight?v0._tmpIndex_-v1._tmpIndex_:v0.weight-v1.weight;});array.forEach(function(v){delete v._tmpIndex_;});} +Chart.layoutService={defaults:{},addBox:function(chart,item){if(!chart.boxes){chart.boxes=[];} +item.fullWidth=item.fullWidth||false;item.position=item.position||'top';item.weight=item.weight||0;chart.boxes.push(item);},removeBox:function(chart,layoutItem){var index=chart.boxes?chart.boxes.indexOf(layoutItem):-1;if(index!==-1){chart.boxes.splice(index,1);}},configure:function(chart,item,options){var props=['fullWidth','position','weight'];var ilen=props.length;var i=0;var prop;for(;itickWidth&&labelRotationme.maxHeight){labelRotation--;break;} +labelRotation++;labelWidth=cosRotation*originalLabelWidth;}} +me.labelRotation=labelRotation;},afterCalculateTickRotation:function(){helpers.callback(this.options.afterCalculateTickRotation,[this]);},beforeFit:function(){helpers.callback(this.options.beforeFit,[this]);},fit:function(){var me=this;var minSize=me.minSize={width:0,height:0};var opts=me.options;var tickOpts=opts.ticks;var scaleLabelOpts=opts.scaleLabel;var gridLineOpts=opts.gridLines;var display=opts.display;var isHorizontal=me.isHorizontal();var tickFont=parseFontOptions(tickOpts);var scaleLabelFontSize=parseFontOptions(scaleLabelOpts).size*1.5;var tickMarkLength=opts.gridLines.tickMarkLength;if(isHorizontal){minSize.width=me.isFullWidth()?me.maxWidth-me.margins.left-me.margins.right:me.maxWidth;}else{minSize.width=display&&gridLineOpts.drawTicks?tickMarkLength:0;} +if(isHorizontal){minSize.height=display&&gridLineOpts.drawTicks?tickMarkLength:0;}else{minSize.height=me.maxHeight;} +if(scaleLabelOpts.display&&display){if(isHorizontal){minSize.height+=scaleLabelFontSize;}else{minSize.width+=scaleLabelFontSize;}} +if(tickOpts.display&&display){var largestTextWidth=helpers.longestText(me.ctx,tickFont.font,me.ticks,me.longestTextCache);var tallestLabelHeightInLines=helpers.numberOfLabelLines(me.ticks);var lineSpace=tickFont.size*0.5;if(isHorizontal){me.longestLabelWidth=largestTextWidth;var angleRadians=helpers.toRadians(me.labelRotation);var cosRotation=Math.cos(angleRadians);var sinRotation=Math.sin(angleRadians);var labelHeight=(sinRotation*largestTextWidth)+(tickFont.size*tallestLabelHeightInLines)+(lineSpace*tallestLabelHeightInLines);minSize.height=Math.min(me.maxHeight,minSize.height+labelHeight);me.ctx.font=tickFont.font;var firstTick=me.ticks[0];var firstLabelWidth=computeTextSize(me.ctx,firstTick,tickFont.font);var lastTick=me.ticks[me.ticks.length-1];var lastLabelWidth=computeTextSize(me.ctx,lastTick,tickFont.font);if(me.labelRotation!==0){me.paddingLeft=opts.position==='bottom'?(cosRotation*firstLabelWidth)+3:(cosRotation*lineSpace)+3;me.paddingRight=opts.position==='bottom'?(cosRotation*lineSpace)+3:(cosRotation*lastLabelWidth)+3;}else{me.paddingLeft=firstLabelWidth/2+3;me.paddingRight=lastLabelWidth/2+3;}}else{if(tickOpts.mirror){largestTextWidth=0;}else{largestTextWidth+=me.options.ticks.padding;} +minSize.width=Math.min(me.maxWidth,minSize.width+largestTextWidth);me.paddingTop=tickFont.size/2;me.paddingBottom=tickFont.size/2;}} +me.handleMargins();me.width=minSize.width;me.height=minSize.height;},handleMargins:function(){var me=this;if(me.margins){me.paddingLeft=Math.max(me.paddingLeft-me.margins.left,0);me.paddingTop=Math.max(me.paddingTop-me.margins.top,0);me.paddingRight=Math.max(me.paddingRight-me.margins.right,0);me.paddingBottom=Math.max(me.paddingBottom-me.margins.bottom,0);}},afterFit:function(){helpers.callback(this.options.afterFit,[this]);},isHorizontal:function(){return this.options.position==='top'||this.options.position==='bottom';},isFullWidth:function(){return(this.options.fullWidth);},getRightValue:function(rawValue){if(rawValue===null||typeof(rawValue)==='undefined'){return NaN;} +if(typeof(rawValue)==='number'&&!isFinite(rawValue)){return NaN;} +if(typeof(rawValue)==='object'){if((rawValue instanceof Date)||(rawValue.isValid)){return rawValue;} +return this.getRightValue(this.isHorizontal()?rawValue.x:rawValue.y);} +return rawValue;},getLabelForIndex:helpers.noop,getPixelForValue:helpers.noop,getValueForPixel:helpers.noop,getPixelForTick:function(index,includeOffset){var me=this;if(me.isHorizontal()){var innerWidth=me.width-(me.paddingLeft+me.paddingRight);var tickWidth=innerWidth/Math.max((me.ticks.length-((me.options.gridLines.offsetGridLines)?0:1)),1);var pixel=(tickWidth*index)+me.paddingLeft;if(includeOffset){pixel+=tickWidth/2;} +var finalVal=me.left+Math.round(pixel);finalVal+=me.isFullWidth()?me.margins.left:0;return finalVal;} +var innerHeight=me.height-(me.paddingTop+me.paddingBottom);return me.top+(index*(innerHeight/(me.ticks.length-1)));},getPixelForDecimal:function(decimal){var me=this;if(me.isHorizontal()){var innerWidth=me.width-(me.paddingLeft+me.paddingRight);var valueOffset=(innerWidth*decimal)+me.paddingLeft;var finalVal=me.left+Math.round(valueOffset);finalVal+=me.isFullWidth()?me.margins.left:0;return finalVal;} +return me.top+(decimal*me.height);},getBasePixel:function(){return this.getPixelForValue(this.getBaseValue());},getBaseValue:function(){var me=this;var min=me.min;var max=me.max;return me.beginAtZero?0:min<0&&max<0?max:min>0&&max>0?min:0;},draw:function(chartArea){var me=this;var options=me.options;if(!options.display){return;} +var context=me.ctx;var globalDefaults=Chart.defaults.global;var optionTicks=options.ticks;var gridLines=options.gridLines;var scaleLabel=options.scaleLabel;var isRotated=me.labelRotation!==0;var skipRatio;var useAutoskipper=optionTicks.autoSkip;var isHorizontal=me.isHorizontal();var maxTicks;if(optionTicks.maxTicksLimit){maxTicks=optionTicks.maxTicksLimit;} +var tickFontColor=helpers.getValueOrDefault(optionTicks.fontColor,globalDefaults.defaultFontColor);var tickFont=parseFontOptions(optionTicks);var tl=gridLines.drawTicks?gridLines.tickMarkLength:0;var scaleLabelFontColor=helpers.getValueOrDefault(scaleLabel.fontColor,globalDefaults.defaultFontColor);var scaleLabelFont=parseFontOptions(scaleLabel);var labelRotationRadians=helpers.toRadians(me.labelRotation);var cosRotation=Math.cos(labelRotationRadians);var longestRotatedLabel=me.longestLabelWidth*cosRotation;context.fillStyle=tickFontColor;var itemsToDraw=[];if(isHorizontal){skipRatio=false;if((longestRotatedLabel+optionTicks.autoSkipPadding)*me.ticks.length>(me.width-(me.paddingLeft+me.paddingRight))){skipRatio=1+Math.floor(((longestRotatedLabel+optionTicks.autoSkipPadding)*me.ticks.length)/(me.width-(me.paddingLeft+me.paddingRight)));} +if(maxTicks&&me.ticks.length>maxTicks){while(!skipRatio||me.ticks.length/(skipRatio||1)>maxTicks){if(!skipRatio){skipRatio=1;} +skipRatio+=1;}} +if(!useAutoskipper){skipRatio=false;}} +var xTickStart=options.position==='right'?me.left:me.right-tl;var xTickEnd=options.position==='right'?me.left+tl:me.right;var yTickStart=options.position==='bottom'?me.top:me.bottom-tl;var yTickEnd=options.position==='bottom'?me.top+tl:me.bottom;helpers.each(me.ticks,function(label,index){if(label===undefined||label===null){return;} +var isLastTick=me.ticks.length===index+1;var shouldSkip=(skipRatio>1&&index%skipRatio>0)||(index%skipRatio===0&&index+skipRatio>=me.ticks.length);if(shouldSkip&&!isLastTick||(label===undefined||label===null)){return;} +var lineWidth,lineColor,borderDash,borderDashOffset;if(index===(typeof me.zeroLineIndex!=='undefined'?me.zeroLineIndex:0)){lineWidth=gridLines.zeroLineWidth;lineColor=gridLines.zeroLineColor;borderDash=gridLines.zeroLineBorderDash;borderDashOffset=gridLines.zeroLineBorderDashOffset;}else{lineWidth=helpers.getValueAtIndexOrDefault(gridLines.lineWidth,index);lineColor=helpers.getValueAtIndexOrDefault(gridLines.color,index);borderDash=helpers.getValueOrDefault(gridLines.borderDash,globalDefaults.borderDash);borderDashOffset=helpers.getValueOrDefault(gridLines.borderDashOffset,globalDefaults.borderDashOffset);} +var tx1,ty1,tx2,ty2,x1,y1,x2,y2,labelX,labelY;var textAlign='middle';var textBaseline='middle';if(isHorizontal){if(options.position==='bottom'){textBaseline=!isRotated?'top':'middle';textAlign=!isRotated?'center':'right';labelY=me.top+tl;}else{textBaseline=!isRotated?'bottom':'middle';textAlign=!isRotated?'center':'left';labelY=me.bottom-tl;} +var xLineValue=me.getPixelForTick(index)+helpers.aliasPixel(lineWidth);labelX=me.getPixelForTick(index,gridLines.offsetGridLines)+optionTicks.labelOffset;tx1=tx2=x1=x2=xLineValue;ty1=yTickStart;ty2=yTickEnd;y1=chartArea.top;y2=chartArea.bottom;}else{var isLeft=options.position==='left';var tickPadding=optionTicks.padding;var labelXOffset;if(optionTicks.mirror){textAlign=isLeft?'left':'right';labelXOffset=tickPadding;}else{textAlign=isLeft?'right':'left';labelXOffset=tl+tickPadding;} +labelX=isLeft?me.right-labelXOffset:me.left+labelXOffset;var yLineValue=me.getPixelForTick(index);yLineValue+=helpers.aliasPixel(lineWidth);labelY=me.getPixelForTick(index,gridLines.offsetGridLines);tx1=xTickStart;tx2=xTickEnd;x1=chartArea.left;x2=chartArea.right;ty1=ty2=y1=y2=yLineValue;} +itemsToDraw.push({tx1:tx1,ty1:ty1,tx2:tx2,ty2:ty2,x1:x1,y1:y1,x2:x2,y2:y2,labelX:labelX,labelY:labelY,glWidth:lineWidth,glColor:lineColor,glBorderDash:borderDash,glBorderDashOffset:borderDashOffset,rotation:-1*labelRotationRadians,label:label,textBaseline:textBaseline,textAlign:textAlign});});helpers.each(itemsToDraw,function(itemToDraw){if(gridLines.display){context.save();context.lineWidth=itemToDraw.glWidth;context.strokeStyle=itemToDraw.glColor;if(context.setLineDash){context.setLineDash(itemToDraw.glBorderDash);context.lineDashOffset=itemToDraw.glBorderDashOffset;} +context.beginPath();if(gridLines.drawTicks){context.moveTo(itemToDraw.tx1,itemToDraw.ty1);context.lineTo(itemToDraw.tx2,itemToDraw.ty2);} +if(gridLines.drawOnChartArea){context.moveTo(itemToDraw.x1,itemToDraw.y1);context.lineTo(itemToDraw.x2,itemToDraw.y2);} +context.stroke();context.restore();} +if(optionTicks.display){context.save();context.translate(itemToDraw.labelX,itemToDraw.labelY);context.rotate(itemToDraw.rotation);context.font=tickFont.font;context.textBaseline=itemToDraw.textBaseline;context.textAlign=itemToDraw.textAlign;var label=itemToDraw.label;if(helpers.isArray(label)){for(var i=0,y=0;i0){spacing=generationOptions.stepSize;}else{var niceRange=helpers.niceNum(dataRange.max-dataRange.min,false);spacing=helpers.niceNum(niceRange/(generationOptions.maxTicks-1),true);} +var niceMin=Math.floor(dataRange.min/spacing)*spacing;var niceMax=Math.ceil(dataRange.max/spacing)*spacing;if(generationOptions.min&&generationOptions.max&&generationOptions.stepSize){if(helpers.almostWhole((generationOptions.max-generationOptions.min)/generationOptions.stepSize,spacing/1000)){niceMin=generationOptions.min;niceMax=generationOptions.max;}} +var numSpaces=(niceMax-niceMin)/spacing;if(helpers.almostEquals(numSpaces,Math.round(numSpaces),spacing/1000)){numSpaces=Math.round(numSpaces);}else{numSpaces=Math.ceil(numSpaces);} +ticks.push(generationOptions.min!==undefined?generationOptions.min:niceMin);for(var j=1;j3?ticks[2]-ticks[1]:ticks[1]-ticks[0];if(Math.abs(delta)>1){if(tickValue!==Math.floor(tickValue)){delta=tickValue-Math.floor(tickValue);}} +var logDelta=helpers.log10(Math.abs(delta));var tickString='';if(tickValue!==0){var numDecimal=-1*Math.floor(logDelta);numDecimal=Math.max(Math.min(numDecimal,20),0);tickString=tickValue.toFixed(numDecimal);}else{tickString='0';} +return tickString;},logarithmic:function(tickValue,index,ticks){var remain=tickValue/(Math.pow(10,Math.floor(helpers.log10(tickValue))));if(tickValue===0){return'0';}else if(remain===1||remain===2||remain===5||index===0||index===ticks.length-1){return tickValue.toExponential();} +return'';}}};};},{}],34:[function(require,module,exports){'use strict';module.exports=function(Chart){var helpers=Chart.helpers;function mergeOpacity(colorString,opacity){var color=helpers.color(colorString);return color.alpha(opacity*color.alpha()).rgbaString();} +Chart.defaults.global.tooltips={enabled:true,custom:null,mode:'nearest',position:'average',intersect:true,backgroundColor:'rgba(0,0,0,0.8)',titleFontStyle:'bold',titleSpacing:2,titleMarginBottom:6,titleFontColor:'#fff',titleAlign:'left',bodySpacing:2,bodyFontColor:'#fff',bodyAlign:'left',footerFontStyle:'bold',footerSpacing:2,footerMarginTop:6,footerFontColor:'#fff',footerAlign:'left',yPadding:6,xPadding:6,caretPadding:2,caretSize:5,cornerRadius:6,multiKeyBackground:'#fff',displayColors:true,borderColor:'rgba(0,0,0,0)',borderWidth:0,callbacks:{beforeTitle:helpers.noop,title:function(tooltipItems,data){var title='';var labels=data.labels;var labelCount=labels?labels.length:0;if(tooltipItems.length>0){var item=tooltipItems[0];if(item.xLabel){title=item.xLabel;}else if(labelCount>0&&item.index(chart.height-size.height)){yAlign='bottom';} +var lf,rf;var olf,orf;var yf;var midX=(chartArea.left+chartArea.right)/2;var midY=(chartArea.top+chartArea.bottom)/2;if(yAlign==='center'){lf=function(x){return x<=midX;};rf=function(x){return x>midX;};}else{lf=function(x){return x<=(size.width/2);};rf=function(x){return x>=(chart.width-(size.width/2));};} +olf=function(x){return x+size.width>chart.width;};orf=function(x){return x-size.width<0;};yf=function(y){return y<=midY?'top':'bottom';};if(lf(model.x)){xAlign='left';if(olf(model.x)){xAlign='center';yAlign=yf(model.y);}}else if(rf(model.x)){xAlign='right';if(orf(model.x)){xAlign='center';yAlign=yf(model.y);}} +var opts=tooltip._options;return{xAlign:opts.xAlign?opts.xAlign:xAlign,yAlign:opts.yAlign?opts.yAlign:yAlign};} +function getBackgroundPoint(vm,size,alignment){var x=vm.x;var y=vm.y;var caretSize=vm.caretSize,caretPadding=vm.caretPadding,cornerRadius=vm.cornerRadius,xAlign=alignment.xAlign,yAlign=alignment.yAlign,paddingAndSize=caretSize+caretPadding,radiusAndPadding=cornerRadius+caretPadding;if(xAlign==='right'){x-=size.width;}else if(xAlign==='center'){x-=(size.width/2);} +if(yAlign==='top'){y+=paddingAndSize;}else if(yAlign==='bottom'){y-=size.height+paddingAndSize;}else{y-=(size.height/2);} +if(yAlign==='center'){if(xAlign==='left'){x+=paddingAndSize;}else if(xAlign==='right'){x-=paddingAndSize;}}else if(xAlign==='left'){x-=radiusAndPadding;}else if(xAlign==='right'){x+=radiusAndPadding;} +return{x:x,y:y};} +Chart.Tooltip=Chart.Element.extend({initialize:function(){this._model=getBaseModel(this._options);},getTitle:function(){var me=this;var opts=me._options;var callbacks=opts.callbacks;var beforeTitle=callbacks.beforeTitle.apply(me,arguments),title=callbacks.title.apply(me,arguments),afterTitle=callbacks.afterTitle.apply(me,arguments);var lines=[];lines=pushOrConcat(lines,beforeTitle);lines=pushOrConcat(lines,title);lines=pushOrConcat(lines,afterTitle);return lines;},getBeforeBody:function(){var lines=this._options.callbacks.beforeBody.apply(this,arguments);return helpers.isArray(lines)?lines:lines!==undefined?[lines]:[];},getBody:function(tooltipItems,data){var me=this;var callbacks=me._options.callbacks;var bodyItems=[];helpers.each(tooltipItems,function(tooltipItem){var bodyItem={before:[],lines:[],after:[]};pushOrConcat(bodyItem.before,callbacks.beforeLabel.call(me,tooltipItem,data));pushOrConcat(bodyItem.lines,callbacks.label.call(me,tooltipItem,data));pushOrConcat(bodyItem.after,callbacks.afterLabel.call(me,tooltipItem,data));bodyItems.push(bodyItem);});return bodyItems;},getAfterBody:function(){var lines=this._options.callbacks.afterBody.apply(this,arguments);return helpers.isArray(lines)?lines:lines!==undefined?[lines]:[];},getFooter:function(){var me=this;var callbacks=me._options.callbacks;var beforeFooter=callbacks.beforeFooter.apply(me,arguments);var footer=callbacks.footer.apply(me,arguments);var afterFooter=callbacks.afterFooter.apply(me,arguments);var lines=[];lines=pushOrConcat(lines,beforeFooter);lines=pushOrConcat(lines,footer);lines=pushOrConcat(lines,afterFooter);return lines;},update:function(changed){var me=this;var opts=me._options;var existingModel=me._model;var model=me._model=getBaseModel(opts);var active=me._active;var data=me._data;var alignment={xAlign:existingModel.xAlign,yAlign:existingModel.yAlign};var backgroundPoint={x:existingModel.x,y:existingModel.y};var tooltipSize={width:existingModel.width,height:existingModel.height};var tooltipPosition={x:existingModel.caretX,y:existingModel.caretY};var i,len;if(active.length){model.opacity=1;var labelColors=[];tooltipPosition=Chart.Tooltip.positioners[opts.position](active,me._eventPosition);var tooltipItems=[];for(i=0,len=active.length;i0){ctx.stroke();}},draw:function(){var ctx=this._chart.ctx;var vm=this._view;if(vm.opacity===0){return;} +var tooltipSize={width:vm.width,height:vm.height};var pt={x:vm.x,y:vm.y};var opacity=Math.abs(vm.opacity<1e-3)?0:vm.opacity;var hasTooltipContent=vm.title.length||vm.beforeBody.length||vm.body.length||vm.afterBody.length||vm.footer.length;if(this._options.enabled&&hasTooltipContent){this.drawBackground(pt,vm,ctx,tooltipSize,opacity);pt.x+=vm.xPadding;pt.y+=vm.yPadding;this.drawTitle(pt,vm,ctx,opacity);this.drawBody(pt,vm,ctx,opacity);this.drawFooter(pt,vm,ctx,opacity);}},handleEvent:function(e){var me=this;var options=me._options;var changed=false;me._lastActive=me._lastActive||[];if(e.type==='mouseout'){me._active=[];}else{me._active=me._chart.getElementsAtEventForMode(e,options.mode,options);} +changed=!helpers.arrayEquals(me._active,me._lastActive);if(!changed){return false;} +me._lastActive=me._active;if(options.enabled||options.custom){me._eventPosition={x:e.x,y:e.y};var model=me._model;me.update(true);me.pivot();changed|=(model.x!==me._model.x)||(model.y!==me._model.y);} +return changed;}});Chart.Tooltip.positioners={average:function(elements){if(!elements.length){return false;} +var i,len;var x=0;var y=0;var count=0;for(i=0,len=elements.length;iendAngle){angle-=2.0*Math.PI;} +while(angle=startAngle&&angle<=endAngle),withinRadius=(distance>=vm.innerRadius&&distance<=vm.outerRadius);return(betweenAngles&&withinRadius);} +return false;},getCenterPoint:function(){var vm=this._view;var halfAngle=(vm.startAngle+vm.endAngle)/2;var halfRadius=(vm.innerRadius+vm.outerRadius)/2;return{x:vm.x+Math.cos(halfAngle)*halfRadius,y:vm.y+Math.sin(halfAngle)*halfRadius};},getArea:function(){var vm=this._view;return Math.PI*((vm.endAngle-vm.startAngle)/(2*Math.PI))*(Math.pow(vm.outerRadius,2)-Math.pow(vm.innerRadius,2));},tooltipPosition:function(){var vm=this._view;var centreAngle=vm.startAngle+((vm.endAngle-vm.startAngle)/2),rangeFromCentre=(vm.outerRadius-vm.innerRadius)/2+vm.innerRadius;return{x:vm.x+(Math.cos(centreAngle)*rangeFromCentre),y:vm.y+(Math.sin(centreAngle)*rangeFromCentre)};},draw:function(){var ctx=this._chart.ctx,vm=this._view,sA=vm.startAngle,eA=vm.endAngle;ctx.beginPath();ctx.arc(vm.x,vm.y,vm.outerRadius,sA,eA);ctx.arc(vm.x,vm.y,vm.innerRadius,eA,sA,true);ctx.closePath();ctx.strokeStyle=vm.borderColor;ctx.lineWidth=vm.borderWidth;ctx.fillStyle=vm.backgroundColor;ctx.fill();ctx.lineJoin='bevel';if(vm.borderWidth){ctx.stroke();}}});};},{}],36:[function(require,module,exports){'use strict';module.exports=function(Chart){var helpers=Chart.helpers;var globalDefaults=Chart.defaults.global;Chart.defaults.global.elements.line={tension:0.4,backgroundColor:globalDefaults.defaultColor,borderWidth:3,borderColor:globalDefaults.defaultColor,borderCapStyle:'butt',borderDash:[],borderDashOffset:0.0,borderJoinStyle:'miter',capBezierPoints:true,fill:true,};Chart.elements.Line=Chart.Element.extend({draw:function(){var me=this;var vm=me._view;var ctx=me._chart.ctx;var spanGaps=vm.spanGaps;var points=me._children.slice();var globalOptionLineElements=globalDefaults.elements.line;var lastDrawnIndex=-1;var index,current,previous,currentVM;if(me._loop&&points.length){points.push(points[0]);} +ctx.save();ctx.lineCap=vm.borderCapStyle||globalOptionLineElements.borderCapStyle;if(ctx.setLineDash){ctx.setLineDash(vm.borderDash||globalOptionLineElements.borderDash);} +ctx.lineDashOffset=vm.borderDashOffset||globalOptionLineElements.borderDashOffset;ctx.lineJoin=vm.borderJoinStyle||globalOptionLineElements.borderJoinStyle;ctx.lineWidth=vm.borderWidth||globalOptionLineElements.borderWidth;ctx.strokeStyle=vm.borderColor||globalDefaults.defaultColor;ctx.beginPath();lastDrawnIndex=-1;for(index=0;indextop?1:-1;borderSkipped=vm.borderSkipped||'bottom';}else{left=vm.base;right=vm.x;top=vm.y-vm.height/2;bottom=vm.y+vm.height/2;signX=right>left?1:-1;signY=1;borderSkipped=vm.borderSkipped||'left';} +if(borderWidth){var barSize=Math.min(Math.abs(left-right),Math.abs(top-bottom));borderWidth=borderWidth>barSize?barSize:borderWidth;var halfStroke=borderWidth/2;var borderLeft=left+(borderSkipped!=='left'?halfStroke*signX:0);var borderRight=right+(borderSkipped!=='right'?-halfStroke*signX:0);var borderTop=top+(borderSkipped!=='top'?halfStroke*signY:0);var borderBottom=bottom+(borderSkipped!=='bottom'?-halfStroke*signY:0);if(borderLeft!==borderRight){top=borderTop;bottom=borderBottom;} +if(borderTop!==borderBottom){left=borderLeft;right=borderRight;}} +ctx.beginPath();ctx.fillStyle=vm.backgroundColor;ctx.strokeStyle=vm.borderColor;ctx.lineWidth=borderWidth;var corners=[[left,bottom],[left,top],[right,top],[right,bottom]];var borders=['bottom','left','top','right'];var startCorner=borders.indexOf(borderSkipped,0);if(startCorner===-1){startCorner=0;} +function cornerAt(index){return corners[(startCorner+index)%4];} +var corner=cornerAt(0);ctx.moveTo(corner[0],corner[1]);for(var i=1;i<4;i++){corner=cornerAt(i);ctx.lineTo(corner[0],corner[1]);} +ctx.fill();if(borderWidth){ctx.stroke();}},height:function(){var vm=this._view;return vm.base-vm.y;},inRange:function(mouseX,mouseY){var inRange=false;if(this._view){var bounds=getBarBounds(this);inRange=mouseX>=bounds.left&&mouseX<=bounds.right&&mouseY>=bounds.top&&mouseY<=bounds.bottom;} +return inRange;},inLabelRange:function(mouseX,mouseY){var me=this;if(!me._view){return false;} +var inRange=false;var bounds=getBarBounds(me);if(isVertical(me)){inRange=mouseX>=bounds.left&&mouseX<=bounds.right;}else{inRange=mouseY>=bounds.top&&mouseY<=bounds.bottom;} +return inRange;},inXRange:function(mouseX){var bounds=getBarBounds(this);return mouseX>=bounds.left&&mouseX<=bounds.right;},inYRange:function(mouseY){var bounds=getBarBounds(this);return mouseY>=bounds.top&&mouseY<=bounds.bottom;},getCenterPoint:function(){var vm=this._view;var x,y;if(isVertical(this)){x=vm.x;y=(vm.y+vm.base)/2;}else{x=(vm.x+vm.base)/2;y=vm.y;} +return{x:x,y:y};},getArea:function(){var vm=this._view;return vm.width*Math.abs(vm.y-vm.base);},tooltipPosition:function(){var vm=this._view;return{x:vm.x,y:vm.y};}});};},{}],39:[function(require,module,exports){'use strict';module.exports=function(Chart){var helpers=Chart.helpers;var eventTypeMap={touchstart:'mousedown',touchmove:'mousemove',touchend:'mouseup',pointerenter:'mouseenter',pointerdown:'mousedown',pointermove:'mousemove',pointerup:'mouseup',pointerleave:'mouseout',pointerout:'mouseout'};function readUsedSize(element,property){var value=helpers.getStyle(element,property);var matches=value&&value.match(/^(\d+)(\.\d+)?px$/);return matches?Number(matches[1]):undefined;} +function initCanvas(canvas,config){var style=canvas.style;var renderHeight=canvas.getAttribute('height');var renderWidth=canvas.getAttribute('width');canvas._chartjs={initial:{height:renderHeight,width:renderWidth,style:{display:style.display,height:style.height,width:style.width}}};style.display=style.display||'block';if(renderWidth===null||renderWidth===''){var displayWidth=readUsedSize(canvas,'width');if(displayWidth!==undefined){canvas.width=displayWidth;}} +if(renderHeight===null||renderHeight===''){if(canvas.style.height===''){canvas.height=canvas.width/(config.options.aspectRatio||2);}else{var displayHeight=readUsedSize(canvas,'height');if(displayWidth!==undefined){canvas.height=displayHeight;}}} +return canvas;} +function createEvent(type,chart,x,y,nativeEvent){return{type:type,chart:chart,native:nativeEvent||null,x:x!==undefined?x:null,y:y!==undefined?y:null,};} +function fromNativeEvent(event,chart){var type=eventTypeMap[event.type]||event.type;var pos=helpers.getRelativePosition(event,chart);return createEvent(type,chart,pos.x,pos.y,event);} +function createResizer(handler){var iframe=document.createElement('iframe');iframe.className='chartjs-hidden-iframe';iframe.style.cssText='display:block;'+'overflow:hidden;'+'border:0;'+'margin:0;'+'top:0;'+'left:0;'+'bottom:0;'+'right:0;'+'height:100%;'+'width:100%;'+'position:absolute;'+'pointer-events:none;'+'z-index:-1;';iframe.tabIndex=-1;helpers.addEvent(iframe,'load',function(){helpers.addEvent(iframe.contentWindow||iframe,'resize',handler);handler();});return iframe;} +function addResizeListener(node,listener,chart){var stub=node._chartjs={ticking:false};var notify=function(){if(!stub.ticking){stub.ticking=true;helpers.requestAnimFrame.call(window,function(){if(stub.resizer){stub.ticking=false;return listener(createEvent('resize',chart));}});}};stub.resizer=createResizer(notify);node.insertBefore(stub.resizer,node.firstChild);} +function removeResizeListener(node){if(!node||!node._chartjs){return;} +var resizer=node._chartjs.resizer;if(resizer){resizer.parentNode.removeChild(resizer);node._chartjs.resizer=null;} +delete node._chartjs;} +return{acquireContext:function(item,config){if(typeof item==='string'){item=document.getElementById(item);}else if(item.length){item=item[0];} +if(item&&item.canvas){item=item.canvas;} +var context=item&&item.getContext&&item.getContext('2d');if(context&&context.canvas===item){initCanvas(item,config);return context;} +return null;},releaseContext:function(context){var canvas=context.canvas;if(!canvas._chartjs){return;} +var initial=canvas._chartjs.initial;['height','width'].forEach(function(prop){var value=initial[prop];if(value===undefined||value===null){canvas.removeAttribute(prop);}else{canvas.setAttribute(prop,value);}});helpers.each(initial.style||{},function(value,key){canvas.style[key]=value;});canvas.width=canvas.width;delete canvas._chartjs;},addEventListener:function(chart,type,listener){var canvas=chart.canvas;if(type==='resize'){addResizeListener(canvas.parentNode,listener,chart);return;} +var stub=listener._chartjs||(listener._chartjs={});var proxies=stub.proxies||(stub.proxies={});var proxy=proxies[chart.id+'_'+type]=function(event){listener(fromNativeEvent(event,chart));};helpers.addEvent(canvas,type,proxy);},removeEventListener:function(chart,type,listener){var canvas=chart.canvas;if(type==='resize'){removeResizeListener(canvas.parentNode,listener);return;} +var stub=listener._chartjs||{};var proxies=stub.proxies||{};var proxy=proxies[chart.id+'_'+type];if(!proxy){return;} +helpers.removeEvent(canvas,type,proxy);}};};},{}],40:[function(require,module,exports){'use strict';var implementation=require(39);module.exports=function(Chart){Chart.platform={acquireContext:function(){},releaseContext:function(){},addEventListener:function(){},removeEventListener:function(){}};Chart.helpers.extend(Chart.platform,implementation(Chart));};},{"39":39}],41:[function(require,module,exports){'use strict';module.exports=function(Chart){Chart.defaults.global.plugins.filler={propagate:true};var defaults=Chart.defaults;var helpers=Chart.helpers;var mappers={dataset:function(source){var index=source.fill;var chart=source.chart;var meta=chart.getDatasetMeta(index);var visible=meta&&chart.isDatasetVisible(index);var points=(visible&&meta.dataset._children)||[];return!points.length?null:function(point,i){return points[i]._view||null;};},boundary:function(source){var boundary=source.boundary;var x=boundary?boundary.x:null;var y=boundary?boundary.y:null;return function(point){return{x:x===null?point.x:x,y:y===null?point.y:y,};};}};function decodeFill(el,index,count){var model=el._model||{};var fill=model.fill;var target;if(fill===undefined){fill=!!model.backgroundColor;} +if(fill===false||fill===null){return false;} +if(fill===true){return'origin';} +target=parseFloat(fill,10);if(isFinite(target)&&Math.floor(target)===target){if(fill[0]==='-'||fill[0]==='+'){target=index+target;} +if(target===index||target<0||target>=count){return false;} +return target;} +switch(fill){case'bottom':return'start';case'top':return'end';case'zero':return'origin';case'origin':case'start':case'end':return fill;default:return false;}} +function computeBoundary(source){var model=source.el._model||{};var scale=source.el._scale||{};var fill=source.fill;var target=null;var horizontal;if(isFinite(fill)){return null;} +if(fill==='start'){target=model.scaleBottom===undefined?scale.bottom:model.scaleBottom;}else if(fill==='end'){target=model.scaleTop===undefined?scale.top:model.scaleTop;}else if(model.scaleZero!==undefined){target=model.scaleZero;}else if(scale.getBasePosition){target=scale.getBasePosition();}else if(scale.getBasePixel){target=scale.getBasePixel();} +if(target!==undefined&&target!==null){if(target.x!==undefined&&target.y!==undefined){return target;} +if(typeof target==='number'&&isFinite(target)){horizontal=scale.isHorizontal();return{x:horizontal?target:null,y:horizontal?null:target};}} +return null;} +function resolveTarget(sources,index,propagate){var source=sources[index];var fill=source.fill;var visited=[index];var target;if(!propagate){return fill;} +while(fill!==false&&visited.indexOf(fill)===-1){if(!isFinite(fill)){return fill;} +target=sources[fill];if(!target){return false;} +if(target.visible){return fill;} +visited.push(fill);fill=target.fill;} +return false;} +function createMapper(source){var fill=source.fill;var type='dataset';if(fill===false){return null;} +if(!isFinite(fill)){type='boundary';} +return mappers[type](source);} +function isDrawable(point){return point&&!point.skip;} +function drawArea(ctx,curve0,curve1,len0,len1){var i;if(!len0||!len1){return;} +ctx.moveTo(curve0[0].x,curve0[0].y);for(i=1;i0;--i){helpers.canvas.lineTo(ctx,curve1[i],curve1[i-1],true);}} +function doFill(ctx,points,mapper,view,color,loop){var count=points.length;var span=view.spanGaps;var curve0=[];var curve1=[];var len0=0;var len1=0;var i,ilen,index,p0,p1,d0,d1;ctx.beginPath();for(i=0,ilen=(count+!!loop);i=me.width){totalHeight+=fontSize+(labelOpts.padding);lineWidths[lineWidths.length]=me.left;} +hitboxes[i]={left:0,top:0,width:width,height:fontSize};lineWidths[lineWidths.length-1]+=width+labelOpts.padding;});minSize.height+=totalHeight;}else{var vPadding=labelOpts.padding;var columnWidths=me.columnWidths=[];var totalWidth=labelOpts.padding;var currentColWidth=0;var currentColHeight=0;var itemHeight=fontSize+vPadding;helpers.each(me.legendItems,function(legendItem,i){var boxWidth=getBoxWidth(labelOpts,fontSize);var itemWidth=boxWidth+(fontSize/2)+ctx.measureText(legendItem.text).width;if(currentColHeight+itemHeight>minSize.height){totalWidth+=currentColWidth+labelOpts.padding;columnWidths.push(currentColWidth);currentColWidth=0;currentColHeight=0;} +currentColWidth=Math.max(currentColWidth,itemWidth);currentColHeight+=itemHeight;hitboxes[i]={left:0,top:0,width:itemWidth,height:fontSize};});totalWidth+=currentColWidth;columnWidths.push(currentColWidth);minSize.width+=totalWidth;}} +me.width=minSize.width;me.height=minSize.height;},afterFit:noop,isHorizontal:function(){return this.options.position==='top'||this.options.position==='bottom';},draw:function(){var me=this;var opts=me.options;var labelOpts=opts.labels;var globalDefault=Chart.defaults.global,lineDefault=globalDefault.elements.line,legendWidth=me.width,lineWidths=me.lineWidths;if(opts.display){var ctx=me.ctx,cursor,itemOrDefault=helpers.getValueOrDefault,fontColor=itemOrDefault(labelOpts.fontColor,globalDefault.defaultFontColor),fontSize=itemOrDefault(labelOpts.fontSize,globalDefault.defaultFontSize),fontStyle=itemOrDefault(labelOpts.fontStyle,globalDefault.defaultFontStyle),fontFamily=itemOrDefault(labelOpts.fontFamily,globalDefault.defaultFontFamily),labelFont=helpers.fontString(fontSize,fontStyle,fontFamily);ctx.textAlign='left';ctx.textBaseline='top';ctx.lineWidth=0.5;ctx.strokeStyle=fontColor;ctx.fillStyle=fontColor;ctx.font=labelFont;var boxWidth=getBoxWidth(labelOpts,fontSize),hitboxes=me.legendHitBoxes;var drawLegendBox=function(x,y,legendItem){if(isNaN(boxWidth)||boxWidth<=0){return;} +ctx.save();ctx.fillStyle=itemOrDefault(legendItem.fillStyle,globalDefault.defaultColor);ctx.lineCap=itemOrDefault(legendItem.lineCap,lineDefault.borderCapStyle);ctx.lineDashOffset=itemOrDefault(legendItem.lineDashOffset,lineDefault.borderDashOffset);ctx.lineJoin=itemOrDefault(legendItem.lineJoin,lineDefault.borderJoinStyle);ctx.lineWidth=itemOrDefault(legendItem.lineWidth,lineDefault.borderWidth);ctx.strokeStyle=itemOrDefault(legendItem.strokeStyle,globalDefault.defaultColor);var isLineWidthZero=(itemOrDefault(legendItem.lineWidth,lineDefault.borderWidth)===0);if(ctx.setLineDash){ctx.setLineDash(itemOrDefault(legendItem.lineDash,lineDefault.borderDash));} +if(opts.labels&&opts.labels.usePointStyle){var radius=fontSize*Math.SQRT2/2;var offSet=radius/Math.SQRT2;var centerX=x+offSet;var centerY=y+offSet;Chart.canvasHelpers.drawPoint(ctx,legendItem.pointStyle,radius,centerX,centerY);}else{if(!isLineWidthZero){ctx.strokeRect(x,y,boxWidth,fontSize);} +ctx.fillRect(x,y,boxWidth,fontSize);} +ctx.restore();};var fillText=function(x,y,legendItem,textWidth){ctx.fillText(legendItem.text,boxWidth+(fontSize/2)+x,y);if(legendItem.hidden){ctx.beginPath();ctx.lineWidth=2;ctx.moveTo(boxWidth+(fontSize/2)+x,y+(fontSize/2));ctx.lineTo(boxWidth+(fontSize/2)+x+textWidth,y+(fontSize/2));ctx.stroke();}};var isHorizontal=me.isHorizontal();if(isHorizontal){cursor={x:me.left+((legendWidth-lineWidths[0])/2),y:me.top+labelOpts.padding,line:0};}else{cursor={x:me.left+labelOpts.padding,y:me.top+labelOpts.padding,line:0};} +var itemHeight=fontSize+labelOpts.padding;helpers.each(me.legendItems,function(legendItem,i){var textWidth=ctx.measureText(legendItem.text).width,width=boxWidth+(fontSize/2)+textWidth,x=cursor.x,y=cursor.y;if(isHorizontal){if(x+width>=legendWidth){y=cursor.y+=itemHeight;cursor.line++;x=cursor.x=me.left+((legendWidth-lineWidths[cursor.line])/2);}}else if(y+itemHeight>me.bottom){x=cursor.x=x+me.columnWidths[cursor.line]+labelOpts.padding;y=cursor.y=me.top+labelOpts.padding;cursor.line++;} +drawLegendBox(x,y,legendItem);hitboxes[i].left=x;hitboxes[i].top=y;fillText(x,y,legendItem,textWidth);if(isHorizontal){cursor.x+=width+(labelOpts.padding);}else{cursor.y+=itemHeight;}});}},handleEvent:function(e){var me=this;var opts=me.options;var type=e.type==='mouseup'?'click':e.type;var changed=false;if(type==='mousemove'){if(!opts.onHover){return;}}else if(type==='click'){if(!opts.onClick){return;}}else{return;} +var x=e.x,y=e.y;if(x>=me.left&&x<=me.right&&y>=me.top&&y<=me.bottom){var lh=me.legendHitBoxes;for(var i=0;i=hitBox.left&&x<=hitBox.left+hitBox.width&&y>=hitBox.top&&y<=hitBox.top+hitBox.height){if(type==='click'){opts.onClick.call(me,e.native,me.legendItems[i]);changed=true;break;}else if(type==='mousemove'){opts.onHover.call(me,e.native,me.legendItems[i]);changed=true;break;}}}} +return changed;}});function createNewLegendAndAttach(chart,legendOpts){var legend=new Chart.Legend({ctx:chart.ctx,options:legendOpts,chart:chart});layout.configure(chart,legend,legendOpts);layout.addBox(chart,legend);chart.legend=legend;} +return{id:'legend',beforeInit:function(chart){var legendOpts=chart.options.legend;if(legendOpts){createNewLegendAndAttach(chart,legendOpts);}},beforeUpdate:function(chart){var legendOpts=chart.options.legend;var legend=chart.legend;if(legendOpts){legendOpts=helpers.configMerge(Chart.defaults.global.legend,legendOpts);if(legend){layout.configure(chart,legend,legendOpts);legend.options=legendOpts;}else{createNewLegendAndAttach(chart,legendOpts);}}else if(legend){layout.removeBox(chart,legend);delete chart.legend;}},afterEvent:function(chart,e){var legend=chart.legend;if(legend){legend.handleEvent(e);}}};};},{}],43:[function(require,module,exports){'use strict';module.exports=function(Chart){var helpers=Chart.helpers;var layout=Chart.layoutService;var noop=helpers.noop;Chart.defaults.global.title={display:false,position:'top',fullWidth:true,weight:2000,fontStyle:'bold',padding:10,text:''};Chart.Title=Chart.Element.extend({initialize:function(config){var me=this;helpers.extend(me,config);me.legendHitBoxes=[];},beforeUpdate:noop,update:function(maxWidth,maxHeight,margins){var me=this;me.beforeUpdate();me.maxWidth=maxWidth;me.maxHeight=maxHeight;me.margins=margins;me.beforeSetDimensions();me.setDimensions();me.afterSetDimensions();me.beforeBuildLabels();me.buildLabels();me.afterBuildLabels();me.beforeFit();me.fit();me.afterFit();me.afterUpdate();return me.minSize;},afterUpdate:noop,beforeSetDimensions:noop,setDimensions:function(){var me=this;if(me.isHorizontal()){me.width=me.maxWidth;me.left=0;me.right=me.width;}else{me.height=me.maxHeight;me.top=0;me.bottom=me.height;} +me.paddingLeft=0;me.paddingTop=0;me.paddingRight=0;me.paddingBottom=0;me.minSize={width:0,height:0};},afterSetDimensions:noop,beforeBuildLabels:noop,buildLabels:noop,afterBuildLabels:noop,beforeFit:noop,fit:function(){var me=this,valueOrDefault=helpers.getValueOrDefault,opts=me.options,globalDefaults=Chart.defaults.global,display=opts.display,fontSize=valueOrDefault(opts.fontSize,globalDefaults.defaultFontSize),minSize=me.minSize;if(me.isHorizontal()){minSize.width=me.maxWidth;minSize.height=display?fontSize+(opts.padding*2):0;}else{minSize.width=display?fontSize+(opts.padding*2):0;minSize.height=me.maxHeight;} +me.width=minSize.width;me.height=minSize.height;},afterFit:noop,isHorizontal:function(){var pos=this.options.position;return pos==='top'||pos==='bottom';},draw:function(){var me=this,ctx=me.ctx,valueOrDefault=helpers.getValueOrDefault,opts=me.options,globalDefaults=Chart.defaults.global;if(opts.display){var fontSize=valueOrDefault(opts.fontSize,globalDefaults.defaultFontSize),fontStyle=valueOrDefault(opts.fontStyle,globalDefaults.defaultFontStyle),fontFamily=valueOrDefault(opts.fontFamily,globalDefaults.defaultFontFamily),titleFont=helpers.fontString(fontSize,fontStyle,fontFamily),rotation=0,titleX,titleY,top=me.top,left=me.left,bottom=me.bottom,right=me.right,maxWidth;ctx.fillStyle=valueOrDefault(opts.fontColor,globalDefaults.defaultFontColor);ctx.font=titleFont;if(me.isHorizontal()){titleX=left+((right-left)/2);titleY=top+((bottom-top)/2);maxWidth=right-left;}else{titleX=opts.position==='left'?left+(fontSize/2):right-(fontSize/2);titleY=top+((bottom-top)/2);maxWidth=bottom-top;rotation=Math.PI*(opts.position==='left'?-0.5:0.5);} +ctx.save();ctx.translate(titleX,titleY);ctx.rotate(rotation);ctx.textAlign='center';ctx.textBaseline='middle';ctx.fillText(opts.text,0,0,maxWidth);ctx.restore();}}});function createNewTitleBlockAndAttach(chart,titleOpts){var title=new Chart.Title({ctx:chart.ctx,options:titleOpts,chart:chart});layout.configure(chart,title,titleOpts);layout.addBox(chart,title);chart.titleBlock=title;} +return{id:'title',beforeInit:function(chart){var titleOpts=chart.options.title;if(titleOpts){createNewTitleBlockAndAttach(chart,titleOpts);}},beforeUpdate:function(chart){var titleOpts=chart.options.title;var titleBlock=chart.titleBlock;if(titleOpts){titleOpts=helpers.configMerge(Chart.defaults.global.title,titleOpts);if(titleBlock){layout.configure(chart,titleBlock,titleOpts);titleBlock.options=titleOpts;}else{createNewTitleBlockAndAttach(chart,titleOpts);}}else if(titleBlock){Chart.layoutService.removeBox(chart,titleBlock);delete chart.titleBlock;}}};};},{}],44:[function(require,module,exports){'use strict';module.exports=function(Chart){var helpers=Chart.helpers;var defaultConfig={position:'bottom'};var DatasetScale=Chart.Scale.extend({getLabels:function(){var data=this.chart.data;return(this.isHorizontal()?data.xLabels:data.yLabels)||data.labels;},determineDataLimits:function(){var me=this;var labels=me.getLabels();me.minIndex=0;me.maxIndex=labels.length-1;var findIndex;if(me.options.ticks.min!==undefined){findIndex=helpers.indexOf(labels,me.options.ticks.min);me.minIndex=findIndex!==-1?findIndex:me.minIndex;} +if(me.options.ticks.max!==undefined){findIndex=helpers.indexOf(labels,me.options.ticks.max);me.maxIndex=findIndex!==-1?findIndex:me.maxIndex;} +me.min=labels[me.minIndex];me.max=labels[me.maxIndex];},buildTicks:function(){var me=this;var labels=me.getLabels();me.ticks=(me.minIndex===0&&me.maxIndex===labels.length-1)?labels:labels.slice(me.minIndex,me.maxIndex+1);},getLabelForIndex:function(index,datasetIndex){var me=this;var data=me.chart.data;var isHorizontal=me.isHorizontal();if(data.yLabels&&!isHorizontal){return me.getRightValue(data.datasets[datasetIndex].data[index]);} +return me.ticks[index-me.minIndex];},getPixelForValue:function(value,index,datasetIndex,includeOffset){var me=this;var offsetAmt=Math.max((me.maxIndex+1-me.minIndex-((me.options.gridLines.offsetGridLines)?0:1)),1);var valueCategory;if(value!==undefined&&value!==null){valueCategory=me.isHorizontal()?value.x:value.y;} +if(valueCategory!==undefined||(value!==undefined&&isNaN(index))){var labels=me.getLabels();value=valueCategory||value;var idx=labels.indexOf(value);index=idx!==-1?idx:index;} +if(me.isHorizontal()){var valueWidth=me.width/offsetAmt;var widthOffset=(valueWidth*(index-me.minIndex));if(me.options.gridLines.offsetGridLines&&includeOffset||me.maxIndex===me.minIndex&&includeOffset){widthOffset+=(valueWidth/2);} +return me.left+Math.round(widthOffset);} +var valueHeight=me.height/offsetAmt;var heightOffset=(valueHeight*(index-me.minIndex));if(me.options.gridLines.offsetGridLines&&includeOffset){heightOffset+=(valueHeight/2);} +return me.top+Math.round(heightOffset);},getPixelForTick:function(index,includeOffset){return this.getPixelForValue(this.ticks[index],index+this.minIndex,null,includeOffset);},getValueForPixel:function(pixel){var me=this;var value;var offsetAmt=Math.max((me.ticks.length-((me.options.gridLines.offsetGridLines)?0:1)),1);var horz=me.isHorizontal();var valueDimension=(horz?me.width:me.height)/offsetAmt;pixel-=horz?me.left:me.top;if(me.options.gridLines.offsetGridLines){pixel-=(valueDimension/2);} +if(pixel<=0){value=0;}else{value=Math.round(pixel/valueDimension);} +return value;},getBasePixel:function(){return this.bottom;}});Chart.scaleService.registerScaleType('category',DatasetScale,defaultConfig);};},{}],45:[function(require,module,exports){'use strict';module.exports=function(Chart){var helpers=Chart.helpers;var defaultConfig={position:'left',ticks:{callback:Chart.Ticks.formatters.linear}};var LinearScale=Chart.LinearScaleBase.extend({determineDataLimits:function(){var me=this;var opts=me.options;var chart=me.chart;var data=chart.data;var datasets=data.datasets;var isHorizontal=me.isHorizontal();var DEFAULT_MIN=0;var DEFAULT_MAX=1;function IDMatches(meta){return isHorizontal?meta.xAxisID===me.id:meta.yAxisID===me.id;} +me.min=null;me.max=null;var hasStacks=opts.stacked;if(hasStacks===undefined){helpers.each(datasets,function(dataset,datasetIndex){if(hasStacks){return;} +var meta=chart.getDatasetMeta(datasetIndex);if(chart.isDatasetVisible(datasetIndex)&&IDMatches(meta)&&meta.stack!==undefined){hasStacks=true;}});} +if(opts.stacked||hasStacks){var valuesPerStack={};helpers.each(datasets,function(dataset,datasetIndex){var meta=chart.getDatasetMeta(datasetIndex);var key=[meta.type,((opts.stacked===undefined&&meta.stack===undefined)?datasetIndex:''),meta.stack].join('.');if(valuesPerStack[key]===undefined){valuesPerStack[key]={positiveValues:[],negativeValues:[]};} +var positiveValues=valuesPerStack[key].positiveValues;var negativeValues=valuesPerStack[key].negativeValues;if(chart.isDatasetVisible(datasetIndex)&&IDMatches(meta)){helpers.each(dataset.data,function(rawValue,index){var value=+me.getRightValue(rawValue);if(isNaN(value)||meta.data[index].hidden){return;} +positiveValues[index]=positiveValues[index]||0;negativeValues[index]=negativeValues[index]||0;if(opts.relativePoints){positiveValues[index]=100;}else if(value<0){negativeValues[index]+=value;}else{positiveValues[index]+=value;}});}});helpers.each(valuesPerStack,function(valuesForType){var values=valuesForType.positiveValues.concat(valuesForType.negativeValues);var minVal=helpers.min(values);var maxVal=helpers.max(values);me.min=me.min===null?minVal:Math.min(me.min,minVal);me.max=me.max===null?maxVal:Math.max(me.max,maxVal);});}else{helpers.each(datasets,function(dataset,datasetIndex){var meta=chart.getDatasetMeta(datasetIndex);if(chart.isDatasetVisible(datasetIndex)&&IDMatches(meta)){helpers.each(dataset.data,function(rawValue,index){var value=+me.getRightValue(rawValue);if(isNaN(value)||meta.data[index].hidden){return;} +if(me.min===null){me.min=value;}else if(valueme.max){me.max=value;}});}});} +me.min=isFinite(me.min)?me.min:DEFAULT_MIN;me.max=isFinite(me.max)?me.max:DEFAULT_MAX;this.handleTickRangeOptions();},getTickLimit:function(){var maxTicks;var me=this;var tickOpts=me.options.ticks;if(me.isHorizontal()){maxTicks=Math.min(tickOpts.maxTicksLimit?tickOpts.maxTicksLimit:11,Math.ceil(me.width/50));}else{var tickFontSize=helpers.getValueOrDefault(tickOpts.fontSize,Chart.defaults.global.defaultFontSize);maxTicks=Math.min(tickOpts.maxTicksLimit?tickOpts.maxTicksLimit:11,Math.ceil(me.height/(2*tickFontSize)));} +return maxTicks;},handleDirectionalChanges:function(){if(!this.isHorizontal()){this.ticks.reverse();}},getLabelForIndex:function(index,datasetIndex){return+this.getRightValue(this.chart.data.datasets[datasetIndex].data[index]);},getPixelForValue:function(value){var me=this;var start=me.start;var rightValue=+me.getRightValue(value);var pixel;var range=me.end-start;if(me.isHorizontal()){pixel=me.left+(me.width/range*(rightValue-start));return Math.round(pixel);} +pixel=me.bottom-(me.height/range*(rightValue-start));return Math.round(pixel);},getValueForPixel:function(pixel){var me=this;var isHorizontal=me.isHorizontal();var innerDimension=isHorizontal?me.width:me.height;var offset=(isHorizontal?pixel-me.left:me.bottom-pixel)/innerDimension;return me.start+((me.end-me.start)*offset);},getPixelForTick:function(index){return this.getPixelForValue(this.ticksAsNumbers[index]);}});Chart.scaleService.registerScaleType('linear',LinearScale,defaultConfig);};},{}],46:[function(require,module,exports){'use strict';module.exports=function(Chart){var helpers=Chart.helpers,noop=helpers.noop;Chart.LinearScaleBase=Chart.Scale.extend({handleTickRangeOptions:function(){var me=this;var opts=me.options;var tickOpts=opts.ticks;if(tickOpts.beginAtZero){var minSign=helpers.sign(me.min);var maxSign=helpers.sign(me.max);if(minSign<0&&maxSign<0){me.max=0;}else if(minSign>0&&maxSign>0){me.min=0;}} +if(tickOpts.min!==undefined){me.min=tickOpts.min;}else if(tickOpts.suggestedMin!==undefined){if(me.min===null){me.min=tickOpts.suggestedMin;}else{me.min=Math.min(me.min,tickOpts.suggestedMin);}} +if(tickOpts.max!==undefined){me.max=tickOpts.max;}else if(tickOpts.suggestedMax!==undefined){if(me.max===null){me.max=tickOpts.suggestedMax;}else{me.max=Math.max(me.max,tickOpts.suggestedMax);}} +if(me.min===me.max){me.max++;if(!tickOpts.beginAtZero){me.min--;}}},getTickLimit:noop,handleDirectionalChanges:noop,buildTicks:function(){var me=this;var opts=me.options;var tickOpts=opts.ticks;var maxTicks=me.getTickLimit();maxTicks=Math.max(2,maxTicks);var numericGeneratorOptions={maxTicks:maxTicks,min:tickOpts.min,max:tickOpts.max,stepSize:helpers.getValueOrDefault(tickOpts.fixedStepSize,tickOpts.stepSize)};var ticks=me.ticks=Chart.Ticks.generators.linear(numericGeneratorOptions,me);me.handleDirectionalChanges();me.max=helpers.max(ticks);me.min=helpers.min(ticks);if(tickOpts.reverse){ticks.reverse();me.start=me.max;me.end=me.min;}else{me.start=me.min;me.end=me.max;}},convertTicksToLabels:function(){var me=this;me.ticksAsNumbers=me.ticks.slice();me.zeroLineIndex=me.ticks.indexOf(0);Chart.Scale.prototype.convertTicksToLabels.call(me);}});};},{}],47:[function(require,module,exports){'use strict';module.exports=function(Chart){var helpers=Chart.helpers;var defaultConfig={position:'left',ticks:{callback:Chart.Ticks.formatters.logarithmic}};var LogarithmicScale=Chart.Scale.extend({determineDataLimits:function(){var me=this;var opts=me.options;var tickOpts=opts.ticks;var chart=me.chart;var data=chart.data;var datasets=data.datasets;var getValueOrDefault=helpers.getValueOrDefault;var isHorizontal=me.isHorizontal();function IDMatches(meta){return isHorizontal?meta.xAxisID===me.id:meta.yAxisID===me.id;} +me.min=null;me.max=null;me.minNotZero=null;var hasStacks=opts.stacked;if(hasStacks===undefined){helpers.each(datasets,function(dataset,datasetIndex){if(hasStacks){return;} +var meta=chart.getDatasetMeta(datasetIndex);if(chart.isDatasetVisible(datasetIndex)&&IDMatches(meta)&&meta.stack!==undefined){hasStacks=true;}});} +if(opts.stacked||hasStacks){var valuesPerStack={};helpers.each(datasets,function(dataset,datasetIndex){var meta=chart.getDatasetMeta(datasetIndex);var key=[meta.type,((opts.stacked===undefined&&meta.stack===undefined)?datasetIndex:''),meta.stack].join('.');if(chart.isDatasetVisible(datasetIndex)&&IDMatches(meta)){if(valuesPerStack[key]===undefined){valuesPerStack[key]=[];} +helpers.each(dataset.data,function(rawValue,index){var values=valuesPerStack[key];var value=+me.getRightValue(rawValue);if(isNaN(value)||meta.data[index].hidden){return;} +values[index]=values[index]||0;if(opts.relativePoints){values[index]=100;}else{values[index]+=value;}});}});helpers.each(valuesPerStack,function(valuesForType){var minVal=helpers.min(valuesForType);var maxVal=helpers.max(valuesForType);me.min=me.min===null?minVal:Math.min(me.min,minVal);me.max=me.max===null?maxVal:Math.max(me.max,maxVal);});}else{helpers.each(datasets,function(dataset,datasetIndex){var meta=chart.getDatasetMeta(datasetIndex);if(chart.isDatasetVisible(datasetIndex)&&IDMatches(meta)){helpers.each(dataset.data,function(rawValue,index){var value=+me.getRightValue(rawValue);if(isNaN(value)||meta.data[index].hidden){return;} +if(me.min===null){me.min=value;}else if(valueme.max){me.max=value;} +if(value!==0&&(me.minNotZero===null||valuemax){return{start:pos-size-5,end:pos};} +return{start:pos,end:pos+size+5};} +function fitWithPointLabels(scale){var plFont=getPointLabelFontOptions(scale);var largestPossibleRadius=Math.min(scale.height/2,scale.width/2);var furthestLimits={r:scale.width,l:0,t:scale.height,b:0};var furthestAngles={};var i;var textSize;var pointPosition;scale.ctx.font=plFont.font;scale._pointLabelSizes=[];var valueCount=getValueCount(scale);for(i=0;ifurthestLimits.r){furthestLimits.r=hLimits.end;furthestAngles.r=angleRadians;} +if(vLimits.startfurthestLimits.b){furthestLimits.b=vLimits.end;furthestAngles.b=angleRadians;}} +scale.setReductions(largestPossibleRadius,furthestLimits,furthestAngles);} +function fit(scale){var largestPossibleRadius=Math.min(scale.height/2,scale.width/2);scale.drawingArea=Math.round(largestPossibleRadius);scale.setCenterPoint(0,0,0,0);} +function getTextAlignForAngle(angle){if(angle===0||angle===180){return'center';}else if(angle<180){return'left';} +return'right';} +function fillText(ctx,text,position,fontSize){if(helpers.isArray(text)){var y=position.y;var spacing=1.5*fontSize;for(var i=0;i270||angle<90){position.y-=textSize.h;}} +function drawPointLabels(scale){var ctx=scale.ctx;var getValueOrDefault=helpers.getValueOrDefault;var opts=scale.options;var angleLineOpts=opts.angleLines;var pointLabelOpts=opts.pointLabels;ctx.lineWidth=angleLineOpts.lineWidth;ctx.strokeStyle=angleLineOpts.color;var outerDistance=scale.getDistanceFromCenterForValue(opts.reverse?scale.min:scale.max);var plFont=getPointLabelFontOptions(scale);ctx.textBaseline='top';for(var i=getValueCount(scale)-1;i>=0;i--){if(angleLineOpts.display){var outerPosition=scale.getPointPosition(i,outerDistance);ctx.beginPath();ctx.moveTo(scale.xCenter,scale.yCenter);ctx.lineTo(outerPosition.x,outerPosition.y);ctx.stroke();ctx.closePath();} +if(pointLabelOpts.display){var pointLabelPosition=scale.getPointPosition(i,outerDistance+5);var pointLabelFontColor=getValueOrDefault(pointLabelOpts.fontColor,globalDefaults.defaultFontColor);ctx.font=plFont.font;ctx.fillStyle=pointLabelFontColor;var angleRadians=scale.getIndexAngle(i);var angle=helpers.toDegrees(angleRadians);ctx.textAlign=getTextAlignForAngle(angle);adjustPointPositionForLabelHeight(angle,scale._pointLabelSizes[i],pointLabelPosition);fillText(ctx,scale.pointLabels[i]||'',pointLabelPosition,plFont.size);}}} +function drawRadiusLine(scale,gridLineOpts,radius,index){var ctx=scale.ctx;ctx.strokeStyle=helpers.getValueAtIndexOrDefault(gridLineOpts.color,index-1);ctx.lineWidth=helpers.getValueAtIndexOrDefault(gridLineOpts.lineWidth,index-1);if(scale.options.gridLines.circular){ctx.beginPath();ctx.arc(scale.xCenter,scale.yCenter,radius,0,Math.PI*2);ctx.closePath();ctx.stroke();}else{var valueCount=getValueCount(scale);if(valueCount===0){return;} +ctx.beginPath();var pointPosition=scale.getPointPosition(0,radius);ctx.moveTo(pointPosition.x,pointPosition.y);for(var i=1;i0&&max>0?min:0);},draw:function(){var me=this;var opts=me.options;var gridLineOpts=opts.gridLines;var tickOpts=opts.ticks;var getValueOrDefault=helpers.getValueOrDefault;if(opts.display){var ctx=me.ctx;var tickFontSize=getValueOrDefault(tickOpts.fontSize,globalDefaults.defaultFontSize);var tickFontStyle=getValueOrDefault(tickOpts.fontStyle,globalDefaults.defaultFontStyle);var tickFontFamily=getValueOrDefault(tickOpts.fontFamily,globalDefaults.defaultFontFamily);var tickLabelFont=helpers.fontString(tickFontSize,tickFontStyle,tickFontFamily);helpers.each(me.ticks,function(label,index){if(index>0||opts.reverse){var yCenterOffset=me.getDistanceFromCenterForValue(me.ticksAsNumbers[index]);var yHeight=me.yCenter-yCenterOffset;if(gridLineOpts.display&&index!==0){drawRadiusLine(me,gridLineOpts,yCenterOffset,index);} +if(tickOpts.display){var tickFontColor=getValueOrDefault(tickOpts.fontColor,globalDefaults.defaultFontColor);ctx.font=tickLabelFont;if(tickOpts.showLabelBackdrop){var labelWidth=ctx.measureText(label).width;ctx.fillStyle=tickOpts.backdropColor;ctx.fillRect(me.xCenter-labelWidth/2-tickOpts.backdropPaddingX,yHeight-tickFontSize/2-tickOpts.backdropPaddingY,labelWidth+tickOpts.backdropPaddingX*2,tickFontSize+tickOpts.backdropPaddingY*2);} +ctx.textAlign='center';ctx.textBaseline='middle';ctx.fillStyle=tickFontColor;ctx.fillText(label,me.xCenter,yHeight);}}});if(opts.angleLines.display||opts.pointLabels.display){drawPointLabels(me);}}}});Chart.scaleService.registerScaleType('radialLinear',LinearRadialScale,defaultConfig);};},{}],49:[function(require,module,exports){'use strict';var moment=require(6);moment=typeof(moment)==='function'?moment:window.moment;module.exports=function(Chart){var helpers=Chart.helpers;var interval={millisecond:{size:1,steps:[1,2,5,10,20,50,100,250,500]},second:{size:1000,steps:[1,2,5,10,30]},minute:{size:60000,steps:[1,2,5,10,30]},hour:{size:3600000,steps:[1,2,3,6,12]},day:{size:86400000,steps:[1,2,5]},week:{size:604800000,maxStep:4},month:{size:2.628e9,maxStep:3},quarter:{size:7.884e9,maxStep:4},year:{size:3.154e10,maxStep:false}};var defaultConfig={position:'bottom',time:{parser:false,format:false,unit:false,round:false,displayFormat:false,isoWeekday:false,minUnit:'millisecond',displayFormats:{millisecond:'h:mm:ss.SSS a',second:'h:mm:ss a',minute:'h:mm:ss a',hour:'MMM D, hA',day:'ll',week:'ll',month:'MMM YYYY',quarter:'[Q]Q - YYYY',year:'YYYY'},},ticks:{autoSkip:false}};function parseTime(axis,label){var timeOpts=axis.options.time;if(typeof timeOpts.parser==='string'){return moment(label,timeOpts.parser);} +if(typeof timeOpts.parser==='function'){return timeOpts.parser(label);} +if(typeof label.getMonth==='function'||typeof label==='number'){return moment(label);} +if(label.isValid&&label.isValid()){return label;} +var format=timeOpts.format;if(typeof format!=='string'&&format.call){console.warn('options.time.format is deprecated and replaced by options.time.parser.');return format(label);} +return moment(label,format);} +function determineUnit(minUnit,min,max,maxTicks){var units=Object.keys(interval);var unit;var numUnits=units.length;for(var i=units.indexOf(minUnit);imaxTicks;i++){multiplier=unitDefinition.steps[i];sizeInUnits=Math.ceil(range/(unitSizeInMilliSeconds*multiplier));}}else{while(sizeInUnits>maxTicks&&maxTicks>0){++multiplier;sizeInUnits=Math.ceil(range/(unitSizeInMilliSeconds*multiplier));}} +return multiplier;} +function generateTicks(options,dataRange,niceRange){var ticks=[];if(options.maxTicks){var stepSize=options.stepSize;ticks.push(options.min!==undefined?options.min:niceRange.min);var cur=moment(niceRange.min);while(cur.add(stepSize,options.unit).valueOf()0){niceMax.add(1,'week');} +niceMax=niceMax.valueOf();}else{niceMin=moment(dataRange.min).startOf(options.unit).valueOf();niceMax=moment(dataRange.max).startOf(options.unit);if(dataRange.max-niceMax>0){niceMax.add(1,options.unit);} +niceMax=niceMax.valueOf();} +return generateTicks(options,dataRange,{min:niceMin,max:niceMax});};var TimeScale=Chart.Scale.extend({initialize:function(){if(!moment){throw new Error('Chart.js - Moment.js could not be found! You must include it before Chart.js to use the time scale. Download at https://momentjs.com');} +Chart.Scale.prototype.initialize.call(this);},determineDataLimits:function(){var me=this;var timeOpts=me.options.time;var dataMin=Number.MAX_SAFE_INTEGER;var dataMax=Number.MIN_SAFE_INTEGER;var chartData=me.chart.data;var parsedData={labels:[],datasets:[]};var timestamp;helpers.each(chartData.labels,function(label,labelIndex){var labelMoment=parseTime(me,label);if(labelMoment.isValid()){if(timeOpts.round){labelMoment.startOf(timeOpts.round);} +timestamp=labelMoment.valueOf();dataMin=Math.min(timestamp,dataMin);dataMax=Math.max(timestamp,dataMax);parsedData.labels[labelIndex]=timestamp;}});helpers.each(chartData.datasets,function(dataset,datasetIndex){var timestamps=[];if(typeof dataset.data[0]==='object'&&dataset.data[0]!==null&&me.chart.isDatasetVisible(datasetIndex)){helpers.each(dataset.data,function(value,dataIndex){var dataMoment=parseTime(me,me.getRightValue(value));if(dataMoment.isValid()){if(timeOpts.round){dataMoment.startOf(timeOpts.round);} +timestamp=dataMoment.valueOf();dataMin=Math.min(timestamp,dataMin);dataMax=Math.max(timestamp,dataMax);timestamps[dataIndex]=timestamp;}});}else{timestamps=parsedData.labels.slice();} +parsedData.datasets[datasetIndex]=timestamps;});me.dataMin=dataMin;me.dataMax=dataMax;me._parsedData=parsedData;},buildTicks:function(){var me=this;var timeOpts=me.options.time;var minTimestamp;var maxTimestamp;var dataMin=me.dataMin;var dataMax=me.dataMax;if(timeOpts.min){var minMoment=parseTime(me,timeOpts.min);if(timeOpts.round){minMoment.round(timeOpts.round);} +minTimestamp=minMoment.valueOf();} +if(timeOpts.max){maxTimestamp=parseTime(me,timeOpts.max).valueOf();} +var maxTicks=me.getLabelCapacity(minTimestamp||dataMin);var unit=timeOpts.unit||determineUnit(timeOpts.minUnit,minTimestamp||dataMin,maxTimestamp||dataMax,maxTicks);me.displayFormat=timeOpts.displayFormats[unit];var stepSize=timeOpts.stepSize||determineStepSize(minTimestamp||dataMin,maxTimestamp||dataMax,unit,maxTicks);me.ticks=Chart.Ticks.generators.time({maxTicks:maxTicks,min:minTimestamp,max:maxTimestamp,stepSize:stepSize,unit:unit,isoWeekday:timeOpts.isoWeekday},{min:dataMin,max:dataMax});me.max=helpers.max(me.ticks);me.min=helpers.min(me.ticks);},getLabelForIndex:function(index,datasetIndex){var me=this;var label=me.chart.data.labels&&index=1;d--){var i=parseInt(n/t*d);if(o&&(i=parseFloat(n/t*d).toFixed(c)),r)for(;/(\d+)(\d{3})/.test(i.toString());)i=i.toString().replace(/(\d+)(\d{3})/,"$1,$2");a.unshift(i)}e.data("counterup-nums",a),e.text("0");var s=function(){e.text(e.data("counterup-nums").shift()),e.data("counterup-nums").length?setTimeout(e.data("counterup-func"),u.delay):(delete e.data("counterup-nums"),e.data("counterup-nums",null),e.data("counterup-func",null))};e.data("counterup-func",s),setTimeout(e.data("counterup-func"),u.delay)};e.waypoint(a,{offset:"100%",triggerOnce:!0})})}}(jQuery); \ No newline at end of file diff --git a/assets/counterup/jquery.waypoints.min.js b/assets/counterup/jquery.waypoints.min.js new file mode 100644 index 0000000..d70b245 --- /dev/null +++ b/assets/counterup/jquery.waypoints.min.js @@ -0,0 +1,662 @@ +/*! +Waypoints - 4.0.1 +Copyright © 2011-2016 Caleb Troughton +Licensed under the MIT license. +https://github.com/imakewebthings/waypoints/blob/master/licenses.txt +*/ +(function() { + 'use strict' + + var keyCounter = 0 + var allWaypoints = {} + + /* http://imakewebthings.com/waypoints/api/waypoint */ + function Waypoint(options) { + if (!options) { + throw new Error('No options passed to Waypoint constructor') + } + if (!options.element) { + throw new Error('No element option passed to Waypoint constructor') + } + if (!options.handler) { + throw new Error('No handler option passed to Waypoint constructor') + } + + this.key = 'waypoint-' + keyCounter + this.options = Waypoint.Adapter.extend({}, Waypoint.defaults, options) + this.element = this.options.element + this.adapter = new Waypoint.Adapter(this.element) + this.callback = options.handler + this.axis = this.options.horizontal ? 'horizontal' : 'vertical' + this.enabled = this.options.enabled + this.triggerPoint = null + this.group = Waypoint.Group.findOrCreate({ + name: this.options.group, + axis: this.axis + }) + this.context = Waypoint.Context.findOrCreateByElement(this.options.context) + + if (Waypoint.offsetAliases[this.options.offset]) { + this.options.offset = Waypoint.offsetAliases[this.options.offset] + } + this.group.add(this) + this.context.add(this) + allWaypoints[this.key] = this + keyCounter += 1 + } + + /* Private */ + Waypoint.prototype.queueTrigger = function(direction) { + this.group.queueTrigger(this, direction) + } + + /* Private */ + Waypoint.prototype.trigger = function(args) { + if (!this.enabled) { + return + } + if (this.callback) { + this.callback.apply(this, args) + } + } + + /* Public */ + /* http://imakewebthings.com/waypoints/api/destroy */ + Waypoint.prototype.destroy = function() { + this.context.remove(this) + this.group.remove(this) + delete allWaypoints[this.key] + } + + /* Public */ + /* http://imakewebthings.com/waypoints/api/disable */ + Waypoint.prototype.disable = function() { + this.enabled = false + return this + } + + /* Public */ + /* http://imakewebthings.com/waypoints/api/enable */ + Waypoint.prototype.enable = function() { + this.context.refresh() + this.enabled = true + return this + } + + /* Public */ + /* http://imakewebthings.com/waypoints/api/next */ + Waypoint.prototype.next = function() { + return this.group.next(this) + } + + /* Public */ + /* http://imakewebthings.com/waypoints/api/previous */ + Waypoint.prototype.previous = function() { + return this.group.previous(this) + } + + /* Private */ + Waypoint.invokeAll = function(method) { + var allWaypointsArray = [] + for (var waypointKey in allWaypoints) { + allWaypointsArray.push(allWaypoints[waypointKey]) + } + for (var i = 0, end = allWaypointsArray.length; i < end; i++) { + allWaypointsArray[i][method]() + } + } + + /* Public */ + /* http://imakewebthings.com/waypoints/api/destroy-all */ + Waypoint.destroyAll = function() { + Waypoint.invokeAll('destroy') + } + + /* Public */ + /* http://imakewebthings.com/waypoints/api/disable-all */ + Waypoint.disableAll = function() { + Waypoint.invokeAll('disable') + } + + /* Public */ + /* http://imakewebthings.com/waypoints/api/enable-all */ + Waypoint.enableAll = function() { + Waypoint.Context.refreshAll() + for (var waypointKey in allWaypoints) { + allWaypoints[waypointKey].enabled = true + } + return this + } + + /* Public */ + /* http://imakewebthings.com/waypoints/api/refresh-all */ + Waypoint.refreshAll = function() { + Waypoint.Context.refreshAll() + } + + /* Public */ + /* http://imakewebthings.com/waypoints/api/viewport-height */ + Waypoint.viewportHeight = function() { + return window.innerHeight || document.documentElement.clientHeight + } + + /* Public */ + /* http://imakewebthings.com/waypoints/api/viewport-width */ + Waypoint.viewportWidth = function() { + return document.documentElement.clientWidth + } + + Waypoint.adapters = [] + + Waypoint.defaults = { + context: window, + continuous: true, + enabled: true, + group: 'default', + horizontal: false, + offset: 0 + } + + Waypoint.offsetAliases = { + 'bottom-in-view': function() { + return this.context.innerHeight() - this.adapter.outerHeight() + }, + 'right-in-view': function() { + return this.context.innerWidth() - this.adapter.outerWidth() + } + } + + window.Waypoint = Waypoint +}()) +;(function() { + 'use strict' + + function requestAnimationFrameShim(callback) { + window.setTimeout(callback, 1000 / 60) + } + + var keyCounter = 0 + var contexts = {} + var Waypoint = window.Waypoint + var oldWindowLoad = window.onload + + /* http://imakewebthings.com/waypoints/api/context */ + function Context(element) { + this.element = element + this.Adapter = Waypoint.Adapter + this.adapter = new this.Adapter(element) + this.key = 'waypoint-context-' + keyCounter + this.didScroll = false + this.didResize = false + this.oldScroll = { + x: this.adapter.scrollLeft(), + y: this.adapter.scrollTop() + } + this.waypoints = { + vertical: {}, + horizontal: {} + } + + element.waypointContextKey = this.key + contexts[element.waypointContextKey] = this + keyCounter += 1 + if (!Waypoint.windowContext) { + Waypoint.windowContext = true + Waypoint.windowContext = new Context(window) + } + + this.createThrottledScrollHandler() + this.createThrottledResizeHandler() + } + + /* Private */ + Context.prototype.add = function(waypoint) { + var axis = waypoint.options.horizontal ? 'horizontal' : 'vertical' + this.waypoints[axis][waypoint.key] = waypoint + this.refresh() + } + + /* Private */ + Context.prototype.checkEmpty = function() { + var horizontalEmpty = this.Adapter.isEmptyObject(this.waypoints.horizontal) + var verticalEmpty = this.Adapter.isEmptyObject(this.waypoints.vertical) + var isWindow = this.element == this.element.window + if (horizontalEmpty && verticalEmpty && !isWindow) { + this.adapter.off('.waypoints') + delete contexts[this.key] + } + } + + /* Private */ + Context.prototype.createThrottledResizeHandler = function() { + var self = this + + function resizeHandler() { + self.handleResize() + self.didResize = false + } + + this.adapter.on('resize.waypoints', function() { + if (!self.didResize) { + self.didResize = true + Waypoint.requestAnimationFrame(resizeHandler) + } + }) + } + + /* Private */ + Context.prototype.createThrottledScrollHandler = function() { + var self = this + function scrollHandler() { + self.handleScroll() + self.didScroll = false + } + + this.adapter.on('scroll.waypoints', function() { + if (!self.didScroll || Waypoint.isTouch) { + self.didScroll = true + Waypoint.requestAnimationFrame(scrollHandler) + } + }) + } + + /* Private */ + Context.prototype.handleResize = function() { + Waypoint.Context.refreshAll() + } + + /* Private */ + Context.prototype.handleScroll = function() { + var triggeredGroups = {} + var axes = { + horizontal: { + newScroll: this.adapter.scrollLeft(), + oldScroll: this.oldScroll.x, + forward: 'right', + backward: 'left' + }, + vertical: { + newScroll: this.adapter.scrollTop(), + oldScroll: this.oldScroll.y, + forward: 'down', + backward: 'up' + } + } + + for (var axisKey in axes) { + var axis = axes[axisKey] + var isForward = axis.newScroll > axis.oldScroll + var direction = isForward ? axis.forward : axis.backward + + for (var waypointKey in this.waypoints[axisKey]) { + var waypoint = this.waypoints[axisKey][waypointKey] + if (waypoint.triggerPoint === null) { + continue + } + var wasBeforeTriggerPoint = axis.oldScroll < waypoint.triggerPoint + var nowAfterTriggerPoint = axis.newScroll >= waypoint.triggerPoint + var crossedForward = wasBeforeTriggerPoint && nowAfterTriggerPoint + var crossedBackward = !wasBeforeTriggerPoint && !nowAfterTriggerPoint + if (crossedForward || crossedBackward) { + waypoint.queueTrigger(direction) + triggeredGroups[waypoint.group.id] = waypoint.group + } + } + } + + for (var groupKey in triggeredGroups) { + triggeredGroups[groupKey].flushTriggers() + } + + this.oldScroll = { + x: axes.horizontal.newScroll, + y: axes.vertical.newScroll + } + } + + /* Private */ + Context.prototype.innerHeight = function() { + /*eslint-disable eqeqeq */ + if (this.element == this.element.window) { + return Waypoint.viewportHeight() + } + /*eslint-enable eqeqeq */ + return this.adapter.innerHeight() + } + + /* Private */ + Context.prototype.remove = function(waypoint) { + delete this.waypoints[waypoint.axis][waypoint.key] + this.checkEmpty() + } + + /* Private */ + Context.prototype.innerWidth = function() { + /*eslint-disable eqeqeq */ + if (this.element == this.element.window) { + return Waypoint.viewportWidth() + } + /*eslint-enable eqeqeq */ + return this.adapter.innerWidth() + } + + /* Public */ + /* http://imakewebthings.com/waypoints/api/context-destroy */ + Context.prototype.destroy = function() { + var allWaypoints = [] + for (var axis in this.waypoints) { + for (var waypointKey in this.waypoints[axis]) { + allWaypoints.push(this.waypoints[axis][waypointKey]) + } + } + for (var i = 0, end = allWaypoints.length; i < end; i++) { + allWaypoints[i].destroy() + } + } + + /* Public */ + /* http://imakewebthings.com/waypoints/api/context-refresh */ + Context.prototype.refresh = function() { + /*eslint-disable eqeqeq */ + var isWindow = this.element == this.element.window + /*eslint-enable eqeqeq */ + var contextOffset = isWindow ? undefined : this.adapter.offset() + var triggeredGroups = {} + var axes + + this.handleScroll() + axes = { + horizontal: { + contextOffset: isWindow ? 0 : contextOffset.left, + contextScroll: isWindow ? 0 : this.oldScroll.x, + contextDimension: this.innerWidth(), + oldScroll: this.oldScroll.x, + forward: 'right', + backward: 'left', + offsetProp: 'left' + }, + vertical: { + contextOffset: isWindow ? 0 : contextOffset.top, + contextScroll: isWindow ? 0 : this.oldScroll.y, + contextDimension: this.innerHeight(), + oldScroll: this.oldScroll.y, + forward: 'down', + backward: 'up', + offsetProp: 'top' + } + } + + for (var axisKey in axes) { + var axis = axes[axisKey] + for (var waypointKey in this.waypoints[axisKey]) { + var waypoint = this.waypoints[axisKey][waypointKey] + var adjustment = waypoint.options.offset + var oldTriggerPoint = waypoint.triggerPoint + var elementOffset = 0 + var freshWaypoint = oldTriggerPoint == null + var contextModifier, wasBeforeScroll, nowAfterScroll + var triggeredBackward, triggeredForward + + if (waypoint.element !== waypoint.element.window) { + elementOffset = waypoint.adapter.offset()[axis.offsetProp] + } + + if (typeof adjustment === 'function') { + adjustment = adjustment.apply(waypoint) + } + else if (typeof adjustment === 'string') { + adjustment = parseFloat(adjustment) + if (waypoint.options.offset.indexOf('%') > - 1) { + adjustment = Math.ceil(axis.contextDimension * adjustment / 100) + } + } + + contextModifier = axis.contextScroll - axis.contextOffset + waypoint.triggerPoint = Math.floor(elementOffset + contextModifier - adjustment) + wasBeforeScroll = oldTriggerPoint < axis.oldScroll + nowAfterScroll = waypoint.triggerPoint >= axis.oldScroll + triggeredBackward = wasBeforeScroll && nowAfterScroll + triggeredForward = !wasBeforeScroll && !nowAfterScroll + + if (!freshWaypoint && triggeredBackward) { + waypoint.queueTrigger(axis.backward) + triggeredGroups[waypoint.group.id] = waypoint.group + } + else if (!freshWaypoint && triggeredForward) { + waypoint.queueTrigger(axis.forward) + triggeredGroups[waypoint.group.id] = waypoint.group + } + else if (freshWaypoint && axis.oldScroll >= waypoint.triggerPoint) { + waypoint.queueTrigger(axis.forward) + triggeredGroups[waypoint.group.id] = waypoint.group + } + } + } + + Waypoint.requestAnimationFrame(function() { + for (var groupKey in triggeredGroups) { + triggeredGroups[groupKey].flushTriggers() + } + }) + + return this + } + + /* Private */ + Context.findOrCreateByElement = function(element) { + return Context.findByElement(element) || new Context(element) + } + + /* Private */ + Context.refreshAll = function() { + for (var contextId in contexts) { + contexts[contextId].refresh() + } + } + + /* Public */ + /* http://imakewebthings.com/waypoints/api/context-find-by-element */ + Context.findByElement = function(element) { + return contexts[element.waypointContextKey] + } + + window.onload = function() { + if (oldWindowLoad) { + oldWindowLoad() + } + Context.refreshAll() + } + + + Waypoint.requestAnimationFrame = function(callback) { + var requestFn = window.requestAnimationFrame || + window.mozRequestAnimationFrame || + window.webkitRequestAnimationFrame || + requestAnimationFrameShim + requestFn.call(window, callback) + } + Waypoint.Context = Context +}()) +;(function() { + 'use strict' + + function byTriggerPoint(a, b) { + return a.triggerPoint - b.triggerPoint + } + + function byReverseTriggerPoint(a, b) { + return b.triggerPoint - a.triggerPoint + } + + var groups = { + vertical: {}, + horizontal: {} + } + var Waypoint = window.Waypoint + + /* http://imakewebthings.com/waypoints/api/group */ + function Group(options) { + this.name = options.name + this.axis = options.axis + this.id = this.name + '-' + this.axis + this.waypoints = [] + this.clearTriggerQueues() + groups[this.axis][this.name] = this + } + + /* Private */ + Group.prototype.add = function(waypoint) { + this.waypoints.push(waypoint) + } + + /* Private */ + Group.prototype.clearTriggerQueues = function() { + this.triggerQueues = { + up: [], + down: [], + left: [], + right: [] + } + } + + /* Private */ + Group.prototype.flushTriggers = function() { + for (var direction in this.triggerQueues) { + var waypoints = this.triggerQueues[direction] + var reverse = direction === 'up' || direction === 'left' + waypoints.sort(reverse ? byReverseTriggerPoint : byTriggerPoint) + for (var i = 0, end = waypoints.length; i < end; i += 1) { + var waypoint = waypoints[i] + if (waypoint.options.continuous || i === waypoints.length - 1) { + waypoint.trigger([direction]) + } + } + } + this.clearTriggerQueues() + } + + /* Private */ + Group.prototype.next = function(waypoint) { + this.waypoints.sort(byTriggerPoint) + var index = Waypoint.Adapter.inArray(waypoint, this.waypoints) + var isLast = index === this.waypoints.length - 1 + return isLast ? null : this.waypoints[index + 1] + } + + /* Private */ + Group.prototype.previous = function(waypoint) { + this.waypoints.sort(byTriggerPoint) + var index = Waypoint.Adapter.inArray(waypoint, this.waypoints) + return index ? this.waypoints[index - 1] : null + } + + /* Private */ + Group.prototype.queueTrigger = function(waypoint, direction) { + this.triggerQueues[direction].push(waypoint) + } + + /* Private */ + Group.prototype.remove = function(waypoint) { + var index = Waypoint.Adapter.inArray(waypoint, this.waypoints) + if (index > -1) { + this.waypoints.splice(index, 1) + } + } + + /* Public */ + /* http://imakewebthings.com/waypoints/api/first */ + Group.prototype.first = function() { + return this.waypoints[0] + } + + /* Public */ + /* http://imakewebthings.com/waypoints/api/last */ + Group.prototype.last = function() { + return this.waypoints[this.waypoints.length - 1] + } + + /* Private */ + Group.findOrCreate = function(options) { + return groups[options.axis][options.name] || new Group(options) + } + + Waypoint.Group = Group +}()) +;(function() { + 'use strict' + + var $ = window.jQuery + var Waypoint = window.Waypoint + + function JQueryAdapter(element) { + this.$element = $(element) + } + + $.each([ + 'innerHeight', + 'innerWidth', + 'off', + 'offset', + 'on', + 'outerHeight', + 'outerWidth', + 'scrollLeft', + 'scrollTop' + ], function(i, method) { + JQueryAdapter.prototype[method] = function() { + var args = Array.prototype.slice.call(arguments) + return this.$element[method].apply(this.$element, args) + } + }) + + $.each([ + 'extend', + 'inArray', + 'isEmptyObject' + ], function(i, method) { + JQueryAdapter[method] = $[method] + }) + + Waypoint.adapters.push({ + name: 'jquery', + Adapter: JQueryAdapter + }) + Waypoint.Adapter = JQueryAdapter +}()) +;(function() { + 'use strict' + + var Waypoint = window.Waypoint + + function createExtension(framework) { + return function() { + var waypoints = [] + var overrides = arguments[0] + + if (framework.isFunction(arguments[0])) { + overrides = framework.extend({}, arguments[1]) + overrides.handler = arguments[0] + } + + this.each(function() { + var options = framework.extend({}, overrides, { + element: this + }) + if (typeof options.context === 'string') { + options.context = framework(this).closest(options.context)[0] + } + waypoints.push(new Waypoint(options)) + }) + + return waypoints + } + } + + if (window.jQuery) { + window.jQuery.fn.waypoint = createExtension(window.jQuery) + } + if (window.Zepto) { + window.Zepto.fn.waypoint = createExtension(window.Zepto) + } +}()) +; \ No newline at end of file diff --git a/assets/datatables/export/buttons.dataTables.min.css b/assets/datatables/export/buttons.dataTables.min.css new file mode 100644 index 0000000..d827587 --- /dev/null +++ b/assets/datatables/export/buttons.dataTables.min.css @@ -0,0 +1 @@ +@keyframes dtb-spinner{100%{transform:rotate(360deg)}}@-o-keyframes dtb-spinner{100%{-o-transform:rotate(360deg);transform:rotate(360deg)}}@-ms-keyframes dtb-spinner{100%{-ms-transform:rotate(360deg);transform:rotate(360deg)}}@-webkit-keyframes dtb-spinner{100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@-moz-keyframes dtb-spinner{100%{-moz-transform:rotate(360deg);transform:rotate(360deg)}}div.dt-button-info{position:fixed;top:50%;left:50%;width:400px;margin-top:-100px;margin-left:-200px;background-color:white;border:2px solid #111;box-shadow:3px 3px 8px rgba(0,0,0,0.3);border-radius:3px;text-align:center;z-index:21}div.dt-button-info h2{padding:0.5em;margin:0;font-weight:normal;border-bottom:1px solid #ddd;background-color:#f3f3f3}div.dt-button-info>div{padding:1em}button.dt-button,div.dt-button,a.dt-button{position:relative;display:inline-block;box-sizing:border-box;margin-right:0.333em;margin-bottom:0.333em;padding:0.5em 1em;border:1px solid #999;border-radius:2px;cursor:pointer;font-size:0.88em;line-height:1.6em;color:black;white-space:nowrap;overflow:hidden;background-color:#e9e9e9;background-image:-webkit-linear-gradient(top, #fff 0%, #e9e9e9 100%);background-image:-moz-linear-gradient(top, #fff 0%, #e9e9e9 100%);background-image:-ms-linear-gradient(top, #fff 0%, #e9e9e9 100%);background-image:-o-linear-gradient(top, #fff 0%, #e9e9e9 100%);background-image:linear-gradient(to bottom, #fff 0%, #e9e9e9 100%);filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0,StartColorStr='white', EndColorStr='#e9e9e9');-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;text-decoration:none;outline:none}button.dt-button.disabled,div.dt-button.disabled,a.dt-button.disabled{color:#999;border:1px solid #d0d0d0;cursor:default;background-color:#f9f9f9;background-image:-webkit-linear-gradient(top, #fff 0%, #f9f9f9 100%);background-image:-moz-linear-gradient(top, #fff 0%, #f9f9f9 100%);background-image:-ms-linear-gradient(top, #fff 0%, #f9f9f9 100%);background-image:-o-linear-gradient(top, #fff 0%, #f9f9f9 100%);background-image:linear-gradient(to bottom, #fff 0%, #f9f9f9 100%);filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0,StartColorStr='#ffffff', EndColorStr='#f9f9f9')}button.dt-button:active:not(.disabled),button.dt-button.active:not(.disabled),div.dt-button:active:not(.disabled),div.dt-button.active:not(.disabled),a.dt-button:active:not(.disabled),a.dt-button.active:not(.disabled){background-color:#e2e2e2;background-image:-webkit-linear-gradient(top, #f3f3f3 0%, #e2e2e2 100%);background-image:-moz-linear-gradient(top, #f3f3f3 0%, #e2e2e2 100%);background-image:-ms-linear-gradient(top, #f3f3f3 0%, #e2e2e2 100%);background-image:-o-linear-gradient(top, #f3f3f3 0%, #e2e2e2 100%);background-image:linear-gradient(to bottom, #f3f3f3 0%, #e2e2e2 100%);filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0,StartColorStr='#f3f3f3', EndColorStr='#e2e2e2');box-shadow:inset 1px 1px 3px #999999}button.dt-button:active:not(.disabled):hover:not(.disabled),button.dt-button.active:not(.disabled):hover:not(.disabled),div.dt-button:active:not(.disabled):hover:not(.disabled),div.dt-button.active:not(.disabled):hover:not(.disabled),a.dt-button:active:not(.disabled):hover:not(.disabled),a.dt-button.active:not(.disabled):hover:not(.disabled){box-shadow:inset 1px 1px 3px #999999;background-color:#cccccc;background-image:-webkit-linear-gradient(top, #eaeaea 0%, #ccc 100%);background-image:-moz-linear-gradient(top, #eaeaea 0%, #ccc 100%);background-image:-ms-linear-gradient(top, #eaeaea 0%, #ccc 100%);background-image:-o-linear-gradient(top, #eaeaea 0%, #ccc 100%);background-image:linear-gradient(to bottom, #eaeaea 0%, #ccc 100%);filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0,StartColorStr='#eaeaea', EndColorStr='#cccccc')}button.dt-button:hover,div.dt-button:hover,a.dt-button:hover{text-decoration:none}button.dt-button:hover:not(.disabled),div.dt-button:hover:not(.disabled),a.dt-button:hover:not(.disabled){border:1px solid #666;background-color:#e0e0e0;background-image:-webkit-linear-gradient(top, #f9f9f9 0%, #e0e0e0 100%);background-image:-moz-linear-gradient(top, #f9f9f9 0%, #e0e0e0 100%);background-image:-ms-linear-gradient(top, #f9f9f9 0%, #e0e0e0 100%);background-image:-o-linear-gradient(top, #f9f9f9 0%, #e0e0e0 100%);background-image:linear-gradient(to bottom, #f9f9f9 0%, #e0e0e0 100%);filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0,StartColorStr='#f9f9f9', EndColorStr='#e0e0e0')}button.dt-button:focus:not(.disabled),div.dt-button:focus:not(.disabled),a.dt-button:focus:not(.disabled){border:1px solid #426c9e;text-shadow:0 1px 0 #c4def1;outline:none;background-color:#79ace9;background-image:-webkit-linear-gradient(top, #bddef4 0%, #79ace9 100%);background-image:-moz-linear-gradient(top, #bddef4 0%, #79ace9 100%);background-image:-ms-linear-gradient(top, #bddef4 0%, #79ace9 100%);background-image:-o-linear-gradient(top, #bddef4 0%, #79ace9 100%);background-image:linear-gradient(to bottom, #bddef4 0%, #79ace9 100%);filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0,StartColorStr='#bddef4', EndColorStr='#79ace9')}.dt-button embed{outline:none}div.dt-buttons{position:relative;float:left}div.dt-buttons.buttons-right{float:right}div.dt-button-collection{position:absolute;top:0;left:0;width:150px;margin-top:3px;padding:8px 8px 4px 8px;border:1px solid #ccc;border:1px solid rgba(0,0,0,0.4);background-color:white;overflow:hidden;z-index:2002;border-radius:5px;box-shadow:3px 3px 5px rgba(0,0,0,0.3);-webkit-column-gap:8px;-moz-column-gap:8px;-ms-column-gap:8px;-o-column-gap:8px;column-gap:8px}div.dt-button-collection button.dt-button,div.dt-button-collection div.dt-button,div.dt-button-collection a.dt-button{position:relative;left:0;right:0;width:100%;display:block;float:none;margin-bottom:4px;margin-right:0}div.dt-button-collection button.dt-button:active:not(.disabled),div.dt-button-collection button.dt-button.active:not(.disabled),div.dt-button-collection div.dt-button:active:not(.disabled),div.dt-button-collection div.dt-button.active:not(.disabled),div.dt-button-collection a.dt-button:active:not(.disabled),div.dt-button-collection a.dt-button.active:not(.disabled){background-color:#dadada;background-image:-webkit-linear-gradient(top, #f0f0f0 0%, #dadada 100%);background-image:-moz-linear-gradient(top, #f0f0f0 0%, #dadada 100%);background-image:-ms-linear-gradient(top, #f0f0f0 0%, #dadada 100%);background-image:-o-linear-gradient(top, #f0f0f0 0%, #dadada 100%);background-image:linear-gradient(to bottom, #f0f0f0 0%, #dadada 100%);filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0,StartColorStr='#f0f0f0', EndColorStr='#dadada');box-shadow:inset 1px 1px 3px #666}div.dt-button-collection.fixed{position:fixed;top:50%;left:50%;margin-left:-75px;border-radius:0}div.dt-button-collection.fixed.two-column{margin-left:-150px}div.dt-button-collection.fixed.three-column{margin-left:-225px}div.dt-button-collection.fixed.four-column{margin-left:-300px}div.dt-button-collection>*{-webkit-column-break-inside:avoid;break-inside:avoid}div.dt-button-collection.two-column{width:300px;padding-bottom:1px;-webkit-column-count:2;-moz-column-count:2;-ms-column-count:2;-o-column-count:2;column-count:2}div.dt-button-collection.three-column{width:450px;padding-bottom:1px;-webkit-column-count:3;-moz-column-count:3;-ms-column-count:3;-o-column-count:3;column-count:3}div.dt-button-collection.four-column{width:600px;padding-bottom:1px;-webkit-column-count:4;-moz-column-count:4;-ms-column-count:4;-o-column-count:4;column-count:4}div.dt-button-collection .dt-button{border-radius:0}div.dt-button-background{position:fixed;top:0;left:0;width:100%;height:100%;background:rgba(0,0,0,0.7);background:-ms-radial-gradient(center, ellipse farthest-corner, rgba(0,0,0,0.3) 0%, rgba(0,0,0,0.7) 100%);background:-moz-radial-gradient(center, ellipse farthest-corner, rgba(0,0,0,0.3) 0%, rgba(0,0,0,0.7) 100%);background:-o-radial-gradient(center, ellipse farthest-corner, rgba(0,0,0,0.3) 0%, rgba(0,0,0,0.7) 100%);background:-webkit-gradient(radial, center center, 0, center center, 497, color-stop(0, rgba(0,0,0,0.3)), color-stop(1, rgba(0,0,0,0.7)));background:-webkit-radial-gradient(center, ellipse farthest-corner, rgba(0,0,0,0.3) 0%, rgba(0,0,0,0.7) 100%);background:radial-gradient(ellipse farthest-corner at center, rgba(0,0,0,0.3) 0%, rgba(0,0,0,0.7) 100%);z-index:2001}@media screen and (max-width: 640px){div.dt-buttons{float:none !important;text-align:center}}button.dt-button.processing,div.dt-button.processing,a.dt-button.processing{color:rgba(0,0,0,0.2)}button.dt-button.processing:after,div.dt-button.processing:after,a.dt-button.processing:after{position:absolute;top:50%;left:50%;width:16px;height:16px;margin:-8px 0 0 -8px;box-sizing:border-box;display:block;content:' ';border:2px solid #282828;border-radius:50%;border-left-color:transparent;border-right-color:transparent;animation:dtb-spinner 1500ms infinite linear;-o-animation:dtb-spinner 1500ms infinite linear;-ms-animation:dtb-spinner 1500ms infinite linear;-webkit-animation:dtb-spinner 1500ms infinite linear;-moz-animation:dtb-spinner 1500ms infinite linear} \ No newline at end of file diff --git a/assets/datatables/export/buttons.flash.min.js b/assets/datatables/export/buttons.flash.min.js new file mode 100644 index 0000000..d3c8c0e --- /dev/null +++ b/assets/datatables/export/buttons.flash.min.js @@ -0,0 +1,32 @@ +(function(g){"function"===typeof define&&define.amd?define(["jquery","datatables.net","datatables.net-buttons"],function(k){return g(k,window,document)}):"object"===typeof exports?module.exports=function(k,l){k||(k=window);if(!l||!l.fn.dataTable)l=require("datatables.net")(k,l).$;l.fn.dataTable.Buttons||require("datatables.net-buttons")(k,l);return g(l,k,k.document)}:g(jQuery,window,document)})(function(g,k,l,q){function w(a){for(var b="";0<=a;)b=String.fromCharCode(a%26+65)+b,a=Math.floor(a/26)- +1;return b}function o(a,b,d){var c=a.createElement(b);d&&(d.attr&&g(c).attr(d.attr),d.children&&g.each(d.children,function(a,b){c.appendChild(b)}),null!==d.text&&d.text!==q&&c.appendChild(a.createTextNode(d.text)));return c}function C(a,b){var d=a.header[b].length,c;a.footer&&a.footer[b].length>d&&(d=a.footer[b].length);for(var e=0,f=a.body.length;ed&&(d=c),40'+c),c=c.replace(/_dt_b_namespace_token_/g,":"));c=c.replace(/<([^<>]*?) xmlns=""([^<>]*?)>/g,"<$1 $2>");a[b]=c}})}var j=g.fn.dataTable,h={version:"1.0.4-TableTools2",clients:{},moviePath:"",nextId:1,$:function(a){"string"==typeof a&&(a=l.getElementById(a));a.addClass||(a.hide=function(){this.style.display="none"},a.show=function(){this.style.display= +""},a.addClass=function(a){this.removeClass(a);this.className+=" "+a},a.removeClass=function(a){this.className=this.className.replace(RegExp("\\s*"+a+"\\s*")," ").replace(/^\s+/,"").replace(/\s+$/,"")},a.hasClass=function(a){return!!this.className.match(RegExp("\\s*"+a+"\\s*"))});return a},setMoviePath:function(a){this.moviePath=a},dispatch:function(a,b,d){(a=this.clients[a])&&a.receiveEvent(b,d)},log:function(a){console.log("Flash: "+a)},register:function(a,b){this.clients[a]=b},getDOMObjectPosition:function(a){var b= +{left:0,top:0,width:a.width?a.width:a.offsetWidth,height:a.height?a.height:a.offsetHeight};""!==a.style.width&&(b.width=a.style.width.replace("px",""));""!==a.style.height&&(b.height=a.style.height.replace("px",""));for(;a;)b.left+=a.offsetLeft,b.top+=a.offsetTop,a=a.offsetParent;return b},Client:function(a){this.handlers={};this.id=h.nextId++;this.movieId="ZeroClipboard_TableToolsMovie_"+this.id;h.register(this.id,this);a&&this.glue(a)}};h.Client.prototype={id:0,ready:!1,movie:null,clipText:"",fileName:"", +action:"copy",handCursorEnabled:!0,cssEffects:!0,handlers:null,sized:!1,sheetName:"",glue:function(a,b){this.domElement=h.$(a);var d=99;this.domElement.style.zIndex&&(d=parseInt(this.domElement.style.zIndex,10)+1);var c=h.getDOMObjectPosition(this.domElement);this.div=l.createElement("div");var e=this.div.style;e.position="absolute";e.left="0px";e.top="0px";e.width=c.width+"px";e.height=c.height+"px";e.zIndex=d;"undefined"!=typeof b&&""!==b&&(this.div.title=b);0!==c.width&&0!==c.height&&(this.sized= +!0);this.domElement&&(this.domElement.appendChild(this.div),this.div.innerHTML=this.getHTML(c.width,c.height).replace(/&/g,"&"))},positionElement:function(){var a=h.getDOMObjectPosition(this.domElement),b=this.div.style;b.position="absolute";b.width=a.width+"px";b.height=a.height+"px";0!==a.width&&0!==a.height&&(this.sized=!0,b=this.div.childNodes[0],b.width=a.width,b.height=a.height)},getHTML:function(a,b){var d="",c="id="+this.id+"&width="+a+"&height="+b;if(navigator.userAgent.match(/MSIE/))var e= +location.href.match(/^https/i)?"https://":"http://",d=d+('');else d+='';return d},hide:function(){this.div&&(this.div.style.left="-2000px")}, +show:function(){this.reposition()},destroy:function(){var a=this;this.domElement&&this.div&&(g(this.div).remove(),this.div=this.domElement=null,g.each(h.clients,function(b,d){d===a&&delete h.clients[b]}))},reposition:function(a){a&&((this.domElement=h.$(a))||this.hide());if(this.domElement&&this.div){var a=h.getDOMObjectPosition(this.domElement),b=this.div.style;b.left=""+a.left+"px";b.top=""+a.top+"px"}},clearText:function(){this.clipText="";this.ready&&this.movie.clearText()},appendText:function(a){this.clipText+= +a;this.ready&&this.movie.appendText(a)},setText:function(a){this.clipText=a;this.ready&&this.movie.setText(a)},setFileName:function(a){this.fileName=a;this.ready&&this.movie.setFileName(a)},setSheetData:function(a){this.ready&&this.movie.setSheetData(JSON.stringify(a))},setAction:function(a){this.action=a;this.ready&&this.movie.setAction(a)},addEventListener:function(a,b){a=a.toString().toLowerCase().replace(/^on/,"");this.handlers[a]||(this.handlers[a]=[]);this.handlers[a].push(b)},setHandCursor:function(a){this.handCursorEnabled= +a;this.ready&&this.movie.setHandCursor(a)},setCSSEffects:function(a){this.cssEffects=!!a},receiveEvent:function(a,b){var d,a=a.toString().toLowerCase().replace(/^on/,"");switch(a){case "load":this.movie=l.getElementById(this.movieId);if(!this.movie){d=this;setTimeout(function(){d.receiveEvent("load",null)},1);return}if(!this.ready&&navigator.userAgent.match(/Firefox/)&&navigator.userAgent.match(/Windows/)){d=this;setTimeout(function(){d.receiveEvent("load",null)},100);this.ready=!0;return}this.ready= +!0;this.movie.clearText();this.movie.appendText(this.clipText);this.movie.setFileName(this.fileName);this.movie.setAction(this.action);this.movie.setHandCursor(this.handCursorEnabled);break;case "mouseover":this.domElement&&this.cssEffects&&this.recoverActive&&this.domElement.addClass("active");break;case "mouseout":this.domElement&&this.cssEffects&&(this.recoverActive=!1,this.domElement.hasClass("active")&&(this.domElement.removeClass("active"),this.recoverActive=!0));break;case "mousedown":this.domElement&& +this.cssEffects&&this.domElement.addClass("active");break;case "mouseup":this.domElement&&this.cssEffects&&(this.domElement.removeClass("active"),this.recoverActive=!1)}if(this.handlers[a])for(var c=0,e=this.handlers[a].length;c',"xl/_rels/workbook.xml.rels":'', +"[Content_Types].xml":'', +"xl/workbook.xml":'', +"xl/worksheets/sheet1.xml":'',"xl/styles.xml":''}, +B=[{match:/^\-?\d+\.\d%$/,style:60,fmt:function(a){return a/100}},{match:/^\-?\d+\.?\d*%$/,style:56,fmt:function(a){return a/100}},{match:/^\-?\$[\d,]+.?\d*$/,style:57},{match:/^\-?£[\d,]+.?\d*$/,style:58},{match:/^\-?€[\d,]+.?\d*$/,style:59},{match:/^\([\d,]+\)$/,style:61,fmt:function(a){return-1*a.replace(/[\(\)]/g,"")}},{match:/^\([\d,]+\.\d{2}\)$/,style:62,fmt:function(a){return-1*a.replace(/[\(\)]/g,"")}},{match:/^[\d,]+$/,style:63},{match:/^[\d,]+\.\d{2}$/,style:64}];j.Buttons.swfPath="//cdn.datatables.net/buttons/"+ +j.Buttons.version+"/swf/flashExport.swf";j.Api.register("buttons.resize()",function(){g.each(h.clients,function(a,b){b.domElement!==q&&b.domElement.parentNode&&b.positionElement()})});j.ext.buttons.copyFlash=g.extend({},u,{className:"buttons-copy buttons-flash",text:function(a){return a.i18n("buttons.copy","Copy")},action:function(a,b,d,c){if(c._fromFlash){this.processing(!0);var a=c._flash,e=A(b,c),d=b.buttons.exportInfo(c),f=z(c),e=e.str;d.title&&(e=d.title+f+f+e);d.messageTop&&(e=d.messageTop+ +f+f+e);d.messageBottom&&(e=e+f+f+d.messageBottom);c.customize&&(e=c.customize(e,c,b));a.setAction("copy");t(a,e);this.processing(!1);b.buttons.info(b.i18n("buttons.copyTitle","Copy to clipboard"),b.i18n("buttons.copySuccess",{_:"Copied %d rows to clipboard",1:"Copied 1 row to clipboard"},data.rows),3E3)}},fieldSeparator:"\t",fieldBoundary:""});j.ext.buttons.csvFlash=g.extend({},u,{className:"buttons-csv buttons-flash",text:function(a){return a.i18n("buttons.csv","CSV")},action:function(a,b,d,c){var a= +c._flash,e=A(b,c),d=b.buttons.exportInfo(c),b=c.customize?c.customize(e.str,c,b):e.str;a.setAction("csv");a.setFileName(d.filename);t(a,b)},escapeChar:'"'});j.ext.buttons.excelFlash=g.extend({},u,{className:"buttons-excel buttons-flash",text:function(a){return a.i18n("buttons.excel","Excel")},action:function(a,b,d,c){this.processing(!0);var a=c._flash,e=0,f=g.parseXML(n["xl/worksheets/sheet1.xml"]),h=f.getElementsByTagName("sheetData")[0],d={_rels:{".rels":g.parseXML(n["_rels/.rels"])},xl:{_rels:{"workbook.xml.rels":g.parseXML(n["xl/_rels/workbook.xml.rels"])}, +"workbook.xml":g.parseXML(n["xl/workbook.xml"]),"styles.xml":g.parseXML(n["xl/styles.xml"]),worksheets:{"sheet1.xml":f}},"[Content_Types].xml":g.parseXML(n["[Content_Types].xml"])},i=b.buttons.exportData(c.exportOptions),k,l,j=function(a){k=e+1;l=o(f,"row",{attr:{r:k}});for(var b=0,d=a.length;b'+b),b=b.replace(/_dt_b_namespace_token_/g,":"));b=b.replace(/<([^<>]*?) xmlns=""([^<>]*?)>/g,"<$1 $2>");a.file(d,b)}})}function q(a,b,d){var c=a.createElement(b);d&&(d.attr&&i(c).attr(d.attr),d.children&&i.each(d.children,function(a,b){c.appendChild(b)}),null!==d.text&&d.text!==s&&c.appendChild(a.createTextNode(d.text)));return c}function K(a,b){var d= +a.header[b].length,c;a.footer&&a.footer[b].length>d&&(d=a.footer[b].length);for(var f=0,g=a.body.length;fd&&(d=c),401*a[1]?!0:!1};try{var y=new XMLSerializer,w}catch(P){}var B={"_rels/.rels":'',"xl/_rels/workbook.xml.rels":'', +"[Content_Types].xml":'', +"xl/workbook.xml":'', +"xl/worksheets/sheet1.xml":'',"xl/styles.xml":''}, +J=[{match:/^\-?\d+\.\d%$/,style:60,fmt:function(a){return a/100}},{match:/^\-?\d+\.?\d*%$/,style:56,fmt:function(a){return a/100}},{match:/^\-?\$[\d,]+.?\d*$/,style:57},{match:/^\-?£[\d,]+.?\d*$/,style:58},{match:/^\-?€[\d,]+.?\d*$/,style:59},{match:/^\-?\d+$/,style:65},{match:/^\-?\d+\.\d{2}$/,style:66},{match:/^\([\d,]+\)$/,style:61,fmt:function(a){return-1*a.replace(/[\(\)]/g,"")}},{match:/^\([\d,]+\.\d{2}\)$/,style:62,fmt:function(a){return-1*a.replace(/[\(\)]/g,"")}},{match:/^\-?[\d,]+$/,style:63}, +{match:/^\-?[\d,]+\.\d{2}$/,style:64}];o.ext.buttons.copyHtml5={className:"buttons-copy buttons-html5",text:function(a){return a.i18n("buttons.copy","Copy")},action:function(a,b,d,c){this.processing(!0);var f=this,a=H(b,c),g=b.buttons.exportInfo(c),e=G(c),n=a.str,d=i("
").css({height:1,width:1,overflow:"hidden",position:"fixed",top:0,left:0});g.title&&(n=g.title+e+e+n);g.messageTop&&(n=g.messageTop+e+e+n);g.messageBottom&&(n=n+e+e+g.messageBottom);c.customize&&(n=c.customize(n,c,b));c=i("",h.noCloneChecked=!!e.cloneNode(!0).lastChild.defaultValue}();var be=r.documentElement,we=/^key/,Te=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,Ce=/^([^.]*)(?:\.(.+)|)/;function Ee(){return!0}function ke(){return!1}function Se(){try{return r.activeElement}catch(e){}}function De(e,t,n,r,i,o){var a,s;if("object"==typeof t){"string"!=typeof n&&(r=r||n,n=void 0);for(s in t)De(e,s,n,r,t[s],o);return e}if(null==r&&null==i?(i=n,r=n=void 0):null==i&&("string"==typeof n?(i=r,r=void 0):(i=r,r=n,n=void 0)),!1===i)i=ke;else if(!i)return e;return 1===o&&(a=i,(i=function(e){return w().off(e),a.apply(this,arguments)}).guid=a.guid||(a.guid=w.guid++)),e.each(function(){w.event.add(this,t,i,r,n)})}w.event={global:{},add:function(e,t,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,y=J.get(e);if(y){n.handler&&(n=(o=n).handler,i=o.selector),i&&w.find.matchesSelector(be,i),n.guid||(n.guid=w.guid++),(u=y.events)||(u=y.events={}),(a=y.handle)||(a=y.handle=function(t){return"undefined"!=typeof w&&w.event.triggered!==t.type?w.event.dispatch.apply(e,arguments):void 0}),l=(t=(t||"").match(M)||[""]).length;while(l--)d=g=(s=Ce.exec(t[l])||[])[1],h=(s[2]||"").split(".").sort(),d&&(f=w.event.special[d]||{},d=(i?f.delegateType:f.bindType)||d,f=w.event.special[d]||{},c=w.extend({type:d,origType:g,data:r,handler:n,guid:n.guid,selector:i,needsContext:i&&w.expr.match.needsContext.test(i),namespace:h.join(".")},o),(p=u[d])||((p=u[d]=[]).delegateCount=0,f.setup&&!1!==f.setup.call(e,r,h,a)||e.addEventListener&&e.addEventListener(d,a)),f.add&&(f.add.call(e,c),c.handler.guid||(c.handler.guid=n.guid)),i?p.splice(p.delegateCount++,0,c):p.push(c),w.event.global[d]=!0)}},remove:function(e,t,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,y=J.hasData(e)&&J.get(e);if(y&&(u=y.events)){l=(t=(t||"").match(M)||[""]).length;while(l--)if(s=Ce.exec(t[l])||[],d=g=s[1],h=(s[2]||"").split(".").sort(),d){f=w.event.special[d]||{},p=u[d=(r?f.delegateType:f.bindType)||d]||[],s=s[2]&&new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),a=o=p.length;while(o--)c=p[o],!i&&g!==c.origType||n&&n.guid!==c.guid||s&&!s.test(c.namespace)||r&&r!==c.selector&&("**"!==r||!c.selector)||(p.splice(o,1),c.selector&&p.delegateCount--,f.remove&&f.remove.call(e,c));a&&!p.length&&(f.teardown&&!1!==f.teardown.call(e,h,y.handle)||w.removeEvent(e,d,y.handle),delete u[d])}else for(d in u)w.event.remove(e,d+t[l],n,r,!0);w.isEmptyObject(u)&&J.remove(e,"handle events")}},dispatch:function(e){var t=w.event.fix(e),n,r,i,o,a,s,u=new Array(arguments.length),l=(J.get(this,"events")||{})[t.type]||[],c=w.event.special[t.type]||{};for(u[0]=t,n=1;n=1))for(;l!==this;l=l.parentNode||this)if(1===l.nodeType&&("click"!==e.type||!0!==l.disabled)){for(o=[],a={},n=0;n-1:w.find(i,this,null,[l]).length),a[i]&&o.push(r);o.length&&s.push({elem:l,handlers:o})}return l=this,u\x20\t\r\n\f]*)[^>]*)\/>/gi,Ae=/\s*$/g;function Le(e,t){return N(e,"table")&&N(11!==t.nodeType?t:t.firstChild,"tr")?w(e).children("tbody")[0]||e:e}function He(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function Oe(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Pe(e,t){var n,r,i,o,a,s,u,l;if(1===t.nodeType){if(J.hasData(e)&&(o=J.access(e),a=J.set(t,o),l=o.events)){delete a.handle,a.events={};for(i in l)for(n=0,r=l[i].length;n1&&"string"==typeof y&&!h.checkClone&&je.test(y))return e.each(function(i){var o=e.eq(i);v&&(t[0]=y.call(this,i,o.html())),Re(o,t,n,r)});if(p&&(i=xe(t,e[0].ownerDocument,!1,e,r),o=i.firstChild,1===i.childNodes.length&&(i=o),o||r)){for(u=(s=w.map(ye(i,"script"),He)).length;f")},clone:function(e,t,n){var r,i,o,a,s=e.cloneNode(!0),u=w.contains(e.ownerDocument,e);if(!(h.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||w.isXMLDoc(e)))for(a=ye(s),r=0,i=(o=ye(e)).length;r0&&ve(a,!u&&ye(e,"script")),s},cleanData:function(e){for(var t,n,r,i=w.event.special,o=0;void 0!==(n=e[o]);o++)if(Y(n)){if(t=n[J.expando]){if(t.events)for(r in t.events)i[r]?w.event.remove(n,r):w.removeEvent(n,r,t.handle);n[J.expando]=void 0}n[K.expando]&&(n[K.expando]=void 0)}}}),w.fn.extend({detach:function(e){return Ie(this,e,!0)},remove:function(e){return Ie(this,e)},text:function(e){return z(this,function(e){return void 0===e?w.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=e)})},null,e,arguments.length)},append:function(){return Re(this,arguments,function(e){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||Le(this,e).appendChild(e)})},prepend:function(){return Re(this,arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=Le(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return Re(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return Re(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},empty:function(){for(var e,t=0;null!=(e=this[t]);t++)1===e.nodeType&&(w.cleanData(ye(e,!1)),e.textContent="");return this},clone:function(e,t){return e=null!=e&&e,t=null==t?e:t,this.map(function(){return w.clone(this,e,t)})},html:function(e){return z(this,function(e){var t=this[0]||{},n=0,r=this.length;if(void 0===e&&1===t.nodeType)return t.innerHTML;if("string"==typeof e&&!Ae.test(e)&&!ge[(de.exec(e)||["",""])[1].toLowerCase()]){e=w.htmlPrefilter(e);try{for(;n=0&&(u+=Math.max(0,Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-o-u-s-.5))),u}function et(e,t,n){var r=$e(e),i=Fe(e,t,r),o="border-box"===w.css(e,"boxSizing",!1,r),a=o;if(We.test(i)){if(!n)return i;i="auto"}return a=a&&(h.boxSizingReliable()||i===e.style[t]),("auto"===i||!parseFloat(i)&&"inline"===w.css(e,"display",!1,r))&&(i=e["offset"+t[0].toUpperCase()+t.slice(1)],a=!0),(i=parseFloat(i)||0)+Ze(e,t,n||(o?"border":"content"),a,r,i)+"px"}w.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Fe(e,"opacity");return""===n?"1":n}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{},style:function(e,t,n,r){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var i,o,a,s=G(t),u=Xe.test(t),l=e.style;if(u||(t=Je(s)),a=w.cssHooks[t]||w.cssHooks[s],void 0===n)return a&&"get"in a&&void 0!==(i=a.get(e,!1,r))?i:l[t];"string"==(o=typeof n)&&(i=ie.exec(n))&&i[1]&&(n=ue(e,t,i),o="number"),null!=n&&n===n&&("number"===o&&(n+=i&&i[3]||(w.cssNumber[s]?"":"px")),h.clearCloneStyle||""!==n||0!==t.indexOf("background")||(l[t]="inherit"),a&&"set"in a&&void 0===(n=a.set(e,n,r))||(u?l.setProperty(t,n):l[t]=n))}},css:function(e,t,n,r){var i,o,a,s=G(t);return Xe.test(t)||(t=Je(s)),(a=w.cssHooks[t]||w.cssHooks[s])&&"get"in a&&(i=a.get(e,!0,n)),void 0===i&&(i=Fe(e,t,r)),"normal"===i&&t in Ve&&(i=Ve[t]),""===n||n?(o=parseFloat(i),!0===n||isFinite(o)?o||0:i):i}}),w.each(["height","width"],function(e,t){w.cssHooks[t]={get:function(e,n,r){if(n)return!ze.test(w.css(e,"display"))||e.getClientRects().length&&e.getBoundingClientRect().width?et(e,t,r):se(e,Ue,function(){return et(e,t,r)})},set:function(e,n,r){var i,o=$e(e),a="border-box"===w.css(e,"boxSizing",!1,o),s=r&&Ze(e,t,r,a,o);return a&&h.scrollboxSize()===o.position&&(s-=Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-parseFloat(o[t])-Ze(e,t,"border",!1,o)-.5)),s&&(i=ie.exec(n))&&"px"!==(i[3]||"px")&&(e.style[t]=n,n=w.css(e,t)),Ke(e,n,s)}}}),w.cssHooks.marginLeft=_e(h.reliableMarginLeft,function(e,t){if(t)return(parseFloat(Fe(e,"marginLeft"))||e.getBoundingClientRect().left-se(e,{marginLeft:0},function(){return e.getBoundingClientRect().left}))+"px"}),w.each({margin:"",padding:"",border:"Width"},function(e,t){w.cssHooks[e+t]={expand:function(n){for(var r=0,i={},o="string"==typeof n?n.split(" "):[n];r<4;r++)i[e+oe[r]+t]=o[r]||o[r-2]||o[0];return i}},"margin"!==e&&(w.cssHooks[e+t].set=Ke)}),w.fn.extend({css:function(e,t){return z(this,function(e,t,n){var r,i,o={},a=0;if(Array.isArray(t)){for(r=$e(e),i=t.length;a1)}});function tt(e,t,n,r,i){return new tt.prototype.init(e,t,n,r,i)}w.Tween=tt,tt.prototype={constructor:tt,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||w.easing._default,this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(w.cssNumber[n]?"":"px")},cur:function(){var e=tt.propHooks[this.prop];return e&&e.get?e.get(this):tt.propHooks._default.get(this)},run:function(e){var t,n=tt.propHooks[this.prop];return this.options.duration?this.pos=t=w.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):tt.propHooks._default.set(this),this}},tt.prototype.init.prototype=tt.prototype,tt.propHooks={_default:{get:function(e){var t;return 1!==e.elem.nodeType||null!=e.elem[e.prop]&&null==e.elem.style[e.prop]?e.elem[e.prop]:(t=w.css(e.elem,e.prop,""))&&"auto"!==t?t:0},set:function(e){w.fx.step[e.prop]?w.fx.step[e.prop](e):1!==e.elem.nodeType||null==e.elem.style[w.cssProps[e.prop]]&&!w.cssHooks[e.prop]?e.elem[e.prop]=e.now:w.style(e.elem,e.prop,e.now+e.unit)}}},tt.propHooks.scrollTop=tt.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},w.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2},_default:"swing"},w.fx=tt.prototype.init,w.fx.step={};var nt,rt,it=/^(?:toggle|show|hide)$/,ot=/queueHooks$/;function at(){rt&&(!1===r.hidden&&e.requestAnimationFrame?e.requestAnimationFrame(at):e.setTimeout(at,w.fx.interval),w.fx.tick())}function st(){return e.setTimeout(function(){nt=void 0}),nt=Date.now()}function ut(e,t){var n,r=0,i={height:e};for(t=t?1:0;r<4;r+=2-t)i["margin"+(n=oe[r])]=i["padding"+n]=e;return t&&(i.opacity=i.width=e),i}function lt(e,t,n){for(var r,i=(pt.tweeners[t]||[]).concat(pt.tweeners["*"]),o=0,a=i.length;o1)},removeAttr:function(e){return this.each(function(){w.removeAttr(this,e)})}}),w.extend({attr:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return"undefined"==typeof e.getAttribute?w.prop(e,t,n):(1===o&&w.isXMLDoc(e)||(i=w.attrHooks[t.toLowerCase()]||(w.expr.match.bool.test(t)?dt:void 0)),void 0!==n?null===n?void w.removeAttr(e,t):i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:(e.setAttribute(t,n+""),n):i&&"get"in i&&null!==(r=i.get(e,t))?r:null==(r=w.find.attr(e,t))?void 0:r)},attrHooks:{type:{set:function(e,t){if(!h.radioValue&&"radio"===t&&N(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},removeAttr:function(e,t){var n,r=0,i=t&&t.match(M);if(i&&1===e.nodeType)while(n=i[r++])e.removeAttribute(n)}}),dt={set:function(e,t,n){return!1===t?w.removeAttr(e,n):e.setAttribute(n,n),n}},w.each(w.expr.match.bool.source.match(/\w+/g),function(e,t){var n=ht[t]||w.find.attr;ht[t]=function(e,t,r){var i,o,a=t.toLowerCase();return r||(o=ht[a],ht[a]=i,i=null!=n(e,t,r)?a:null,ht[a]=o),i}});var gt=/^(?:input|select|textarea|button)$/i,yt=/^(?:a|area)$/i;w.fn.extend({prop:function(e,t){return z(this,w.prop,e,t,arguments.length>1)},removeProp:function(e){return this.each(function(){delete this[w.propFix[e]||e]})}}),w.extend({prop:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return 1===o&&w.isXMLDoc(e)||(t=w.propFix[t]||t,i=w.propHooks[t]),void 0!==n?i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:e[t]=n:i&&"get"in i&&null!==(r=i.get(e,t))?r:e[t]},propHooks:{tabIndex:{get:function(e){var t=w.find.attr(e,"tabindex");return t?parseInt(t,10):gt.test(e.nodeName)||yt.test(e.nodeName)&&e.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),h.optSelected||(w.propHooks.selected={get:function(e){var t=e.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null},set:function(e){var t=e.parentNode;t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex)}}),w.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){w.propFix[this.toLowerCase()]=this});function vt(e){return(e.match(M)||[]).join(" ")}function mt(e){return e.getAttribute&&e.getAttribute("class")||""}function xt(e){return Array.isArray(e)?e:"string"==typeof e?e.match(M)||[]:[]}w.fn.extend({addClass:function(e){var t,n,r,i,o,a,s,u=0;if(g(e))return this.each(function(t){w(this).addClass(e.call(this,t,mt(this)))});if((t=xt(e)).length)while(n=this[u++])if(i=mt(n),r=1===n.nodeType&&" "+vt(i)+" "){a=0;while(o=t[a++])r.indexOf(" "+o+" ")<0&&(r+=o+" ");i!==(s=vt(r))&&n.setAttribute("class",s)}return this},removeClass:function(e){var t,n,r,i,o,a,s,u=0;if(g(e))return this.each(function(t){w(this).removeClass(e.call(this,t,mt(this)))});if(!arguments.length)return this.attr("class","");if((t=xt(e)).length)while(n=this[u++])if(i=mt(n),r=1===n.nodeType&&" "+vt(i)+" "){a=0;while(o=t[a++])while(r.indexOf(" "+o+" ")>-1)r=r.replace(" "+o+" "," ");i!==(s=vt(r))&&n.setAttribute("class",s)}return this},toggleClass:function(e,t){var n=typeof e,r="string"===n||Array.isArray(e);return"boolean"==typeof t&&r?t?this.addClass(e):this.removeClass(e):g(e)?this.each(function(n){w(this).toggleClass(e.call(this,n,mt(this),t),t)}):this.each(function(){var t,i,o,a;if(r){i=0,o=w(this),a=xt(e);while(t=a[i++])o.hasClass(t)?o.removeClass(t):o.addClass(t)}else void 0!==e&&"boolean"!==n||((t=mt(this))&&J.set(this,"__className__",t),this.setAttribute&&this.setAttribute("class",t||!1===e?"":J.get(this,"__className__")||""))})},hasClass:function(e){var t,n,r=0;t=" "+e+" ";while(n=this[r++])if(1===n.nodeType&&(" "+vt(mt(n))+" ").indexOf(t)>-1)return!0;return!1}});var bt=/\r/g;w.fn.extend({val:function(e){var t,n,r,i=this[0];{if(arguments.length)return r=g(e),this.each(function(n){var i;1===this.nodeType&&(null==(i=r?e.call(this,n,w(this).val()):e)?i="":"number"==typeof i?i+="":Array.isArray(i)&&(i=w.map(i,function(e){return null==e?"":e+""})),(t=w.valHooks[this.type]||w.valHooks[this.nodeName.toLowerCase()])&&"set"in t&&void 0!==t.set(this,i,"value")||(this.value=i))});if(i)return(t=w.valHooks[i.type]||w.valHooks[i.nodeName.toLowerCase()])&&"get"in t&&void 0!==(n=t.get(i,"value"))?n:"string"==typeof(n=i.value)?n.replace(bt,""):null==n?"":n}}}),w.extend({valHooks:{option:{get:function(e){var t=w.find.attr(e,"value");return null!=t?t:vt(w.text(e))}},select:{get:function(e){var t,n,r,i=e.options,o=e.selectedIndex,a="select-one"===e.type,s=a?null:[],u=a?o+1:i.length;for(r=o<0?u:a?o:0;r-1)&&(n=!0);return n||(e.selectedIndex=-1),o}}}}),w.each(["radio","checkbox"],function(){w.valHooks[this]={set:function(e,t){if(Array.isArray(t))return e.checked=w.inArray(w(e).val(),t)>-1}},h.checkOn||(w.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})}),h.focusin="onfocusin"in e;var wt=/^(?:focusinfocus|focusoutblur)$/,Tt=function(e){e.stopPropagation()};w.extend(w.event,{trigger:function(t,n,i,o){var a,s,u,l,c,p,d,h,v=[i||r],m=f.call(t,"type")?t.type:t,x=f.call(t,"namespace")?t.namespace.split("."):[];if(s=h=u=i=i||r,3!==i.nodeType&&8!==i.nodeType&&!wt.test(m+w.event.triggered)&&(m.indexOf(".")>-1&&(m=(x=m.split(".")).shift(),x.sort()),c=m.indexOf(":")<0&&"on"+m,t=t[w.expando]?t:new w.Event(m,"object"==typeof t&&t),t.isTrigger=o?2:3,t.namespace=x.join("."),t.rnamespace=t.namespace?new RegExp("(^|\\.)"+x.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,t.result=void 0,t.target||(t.target=i),n=null==n?[t]:w.makeArray(n,[t]),d=w.event.special[m]||{},o||!d.trigger||!1!==d.trigger.apply(i,n))){if(!o&&!d.noBubble&&!y(i)){for(l=d.delegateType||m,wt.test(l+m)||(s=s.parentNode);s;s=s.parentNode)v.push(s),u=s;u===(i.ownerDocument||r)&&v.push(u.defaultView||u.parentWindow||e)}a=0;while((s=v[a++])&&!t.isPropagationStopped())h=s,t.type=a>1?l:d.bindType||m,(p=(J.get(s,"events")||{})[t.type]&&J.get(s,"handle"))&&p.apply(s,n),(p=c&&s[c])&&p.apply&&Y(s)&&(t.result=p.apply(s,n),!1===t.result&&t.preventDefault());return t.type=m,o||t.isDefaultPrevented()||d._default&&!1!==d._default.apply(v.pop(),n)||!Y(i)||c&&g(i[m])&&!y(i)&&((u=i[c])&&(i[c]=null),w.event.triggered=m,t.isPropagationStopped()&&h.addEventListener(m,Tt),i[m](),t.isPropagationStopped()&&h.removeEventListener(m,Tt),w.event.triggered=void 0,u&&(i[c]=u)),t.result}},simulate:function(e,t,n){var r=w.extend(new w.Event,n,{type:e,isSimulated:!0});w.event.trigger(r,null,t)}}),w.fn.extend({trigger:function(e,t){return this.each(function(){w.event.trigger(e,t,this)})},triggerHandler:function(e,t){var n=this[0];if(n)return w.event.trigger(e,t,n,!0)}}),h.focusin||w.each({focus:"focusin",blur:"focusout"},function(e,t){var n=function(e){w.event.simulate(t,e.target,w.event.fix(e))};w.event.special[t]={setup:function(){var r=this.ownerDocument||this,i=J.access(r,t);i||r.addEventListener(e,n,!0),J.access(r,t,(i||0)+1)},teardown:function(){var r=this.ownerDocument||this,i=J.access(r,t)-1;i?J.access(r,t,i):(r.removeEventListener(e,n,!0),J.remove(r,t))}}});var Ct=e.location,Et=Date.now(),kt=/\?/;w.parseXML=function(t){var n;if(!t||"string"!=typeof t)return null;try{n=(new e.DOMParser).parseFromString(t,"text/xml")}catch(e){n=void 0}return n&&!n.getElementsByTagName("parsererror").length||w.error("Invalid XML: "+t),n};var St=/\[\]$/,Dt=/\r?\n/g,Nt=/^(?:submit|button|image|reset|file)$/i,At=/^(?:input|select|textarea|keygen)/i;function jt(e,t,n,r){var i;if(Array.isArray(t))w.each(t,function(t,i){n||St.test(e)?r(e,i):jt(e+"["+("object"==typeof i&&null!=i?t:"")+"]",i,n,r)});else if(n||"object"!==x(t))r(e,t);else for(i in t)jt(e+"["+i+"]",t[i],n,r)}w.param=function(e,t){var n,r=[],i=function(e,t){var n=g(t)?t():t;r[r.length]=encodeURIComponent(e)+"="+encodeURIComponent(null==n?"":n)};if(Array.isArray(e)||e.jquery&&!w.isPlainObject(e))w.each(e,function(){i(this.name,this.value)});else for(n in e)jt(n,e[n],t,i);return r.join("&")},w.fn.extend({serialize:function(){return w.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=w.prop(this,"elements");return e?w.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!w(this).is(":disabled")&&At.test(this.nodeName)&&!Nt.test(e)&&(this.checked||!pe.test(e))}).map(function(e,t){var n=w(this).val();return null==n?null:Array.isArray(n)?w.map(n,function(e){return{name:t.name,value:e.replace(Dt,"\r\n")}}):{name:t.name,value:n.replace(Dt,"\r\n")}}).get()}});var qt=/%20/g,Lt=/#.*$/,Ht=/([?&])_=[^&]*/,Ot=/^(.*?):[ \t]*([^\r\n]*)$/gm,Pt=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Mt=/^(?:GET|HEAD)$/,Rt=/^\/\//,It={},Wt={},$t="*/".concat("*"),Bt=r.createElement("a");Bt.href=Ct.href;function Ft(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var r,i=0,o=t.toLowerCase().match(M)||[];if(g(n))while(r=o[i++])"+"===r[0]?(r=r.slice(1)||"*",(e[r]=e[r]||[]).unshift(n)):(e[r]=e[r]||[]).push(n)}}function _t(e,t,n,r){var i={},o=e===Wt;function a(s){var u;return i[s]=!0,w.each(e[s]||[],function(e,s){var l=s(t,n,r);return"string"!=typeof l||o||i[l]?o?!(u=l):void 0:(t.dataTypes.unshift(l),a(l),!1)}),u}return a(t.dataTypes[0])||!i["*"]&&a("*")}function zt(e,t){var n,r,i=w.ajaxSettings.flatOptions||{};for(n in t)void 0!==t[n]&&((i[n]?e:r||(r={}))[n]=t[n]);return r&&w.extend(!0,e,r),e}function Xt(e,t,n){var r,i,o,a,s=e.contents,u=e.dataTypes;while("*"===u[0])u.shift(),void 0===r&&(r=e.mimeType||t.getResponseHeader("Content-Type"));if(r)for(i in s)if(s[i]&&s[i].test(r)){u.unshift(i);break}if(u[0]in n)o=u[0];else{for(i in n){if(!u[0]||e.converters[i+" "+u[0]]){o=i;break}a||(a=i)}o=o||a}if(o)return o!==u[0]&&u.unshift(o),n[o]}function Ut(e,t,n,r){var i,o,a,s,u,l={},c=e.dataTypes.slice();if(c[1])for(a in e.converters)l[a.toLowerCase()]=e.converters[a];o=c.shift();while(o)if(e.responseFields[o]&&(n[e.responseFields[o]]=t),!u&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),u=o,o=c.shift())if("*"===o)o=u;else if("*"!==u&&u!==o){if(!(a=l[u+" "+o]||l["* "+o]))for(i in l)if((s=i.split(" "))[1]===o&&(a=l[u+" "+s[0]]||l["* "+s[0]])){!0===a?a=l[i]:!0!==l[i]&&(o=s[0],c.unshift(s[1]));break}if(!0!==a)if(a&&e["throws"])t=a(t);else try{t=a(t)}catch(e){return{state:"parsererror",error:a?e:"No conversion from "+u+" to "+o}}}return{state:"success",data:t}}w.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Ct.href,type:"GET",isLocal:Pt.test(Ct.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":$t,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":w.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?zt(zt(e,w.ajaxSettings),t):zt(w.ajaxSettings,e)},ajaxPrefilter:Ft(It),ajaxTransport:Ft(Wt),ajax:function(t,n){"object"==typeof t&&(n=t,t=void 0),n=n||{};var i,o,a,s,u,l,c,f,p,d,h=w.ajaxSetup({},n),g=h.context||h,y=h.context&&(g.nodeType||g.jquery)?w(g):w.event,v=w.Deferred(),m=w.Callbacks("once memory"),x=h.statusCode||{},b={},T={},C="canceled",E={readyState:0,getResponseHeader:function(e){var t;if(c){if(!s){s={};while(t=Ot.exec(a))s[t[1].toLowerCase()]=t[2]}t=s[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return c?a:null},setRequestHeader:function(e,t){return null==c&&(e=T[e.toLowerCase()]=T[e.toLowerCase()]||e,b[e]=t),this},overrideMimeType:function(e){return null==c&&(h.mimeType=e),this},statusCode:function(e){var t;if(e)if(c)E.always(e[E.status]);else for(t in e)x[t]=[x[t],e[t]];return this},abort:function(e){var t=e||C;return i&&i.abort(t),k(0,t),this}};if(v.promise(E),h.url=((t||h.url||Ct.href)+"").replace(Rt,Ct.protocol+"//"),h.type=n.method||n.type||h.method||h.type,h.dataTypes=(h.dataType||"*").toLowerCase().match(M)||[""],null==h.crossDomain){l=r.createElement("a");try{l.href=h.url,l.href=l.href,h.crossDomain=Bt.protocol+"//"+Bt.host!=l.protocol+"//"+l.host}catch(e){h.crossDomain=!0}}if(h.data&&h.processData&&"string"!=typeof h.data&&(h.data=w.param(h.data,h.traditional)),_t(It,h,n,E),c)return E;(f=w.event&&h.global)&&0==w.active++&&w.event.trigger("ajaxStart"),h.type=h.type.toUpperCase(),h.hasContent=!Mt.test(h.type),o=h.url.replace(Lt,""),h.hasContent?h.data&&h.processData&&0===(h.contentType||"").indexOf("application/x-www-form-urlencoded")&&(h.data=h.data.replace(qt,"+")):(d=h.url.slice(o.length),h.data&&(h.processData||"string"==typeof h.data)&&(o+=(kt.test(o)?"&":"?")+h.data,delete h.data),!1===h.cache&&(o=o.replace(Ht,"$1"),d=(kt.test(o)?"&":"?")+"_="+Et+++d),h.url=o+d),h.ifModified&&(w.lastModified[o]&&E.setRequestHeader("If-Modified-Since",w.lastModified[o]),w.etag[o]&&E.setRequestHeader("If-None-Match",w.etag[o])),(h.data&&h.hasContent&&!1!==h.contentType||n.contentType)&&E.setRequestHeader("Content-Type",h.contentType),E.setRequestHeader("Accept",h.dataTypes[0]&&h.accepts[h.dataTypes[0]]?h.accepts[h.dataTypes[0]]+("*"!==h.dataTypes[0]?", "+$t+"; q=0.01":""):h.accepts["*"]);for(p in h.headers)E.setRequestHeader(p,h.headers[p]);if(h.beforeSend&&(!1===h.beforeSend.call(g,E,h)||c))return E.abort();if(C="abort",m.add(h.complete),E.done(h.success),E.fail(h.error),i=_t(Wt,h,n,E)){if(E.readyState=1,f&&y.trigger("ajaxSend",[E,h]),c)return E;h.async&&h.timeout>0&&(u=e.setTimeout(function(){E.abort("timeout")},h.timeout));try{c=!1,i.send(b,k)}catch(e){if(c)throw e;k(-1,e)}}else k(-1,"No Transport");function k(t,n,r,s){var l,p,d,b,T,C=n;c||(c=!0,u&&e.clearTimeout(u),i=void 0,a=s||"",E.readyState=t>0?4:0,l=t>=200&&t<300||304===t,r&&(b=Xt(h,E,r)),b=Ut(h,b,E,l),l?(h.ifModified&&((T=E.getResponseHeader("Last-Modified"))&&(w.lastModified[o]=T),(T=E.getResponseHeader("etag"))&&(w.etag[o]=T)),204===t||"HEAD"===h.type?C="nocontent":304===t?C="notmodified":(C=b.state,p=b.data,l=!(d=b.error))):(d=C,!t&&C||(C="error",t<0&&(t=0))),E.status=t,E.statusText=(n||C)+"",l?v.resolveWith(g,[p,C,E]):v.rejectWith(g,[E,C,d]),E.statusCode(x),x=void 0,f&&y.trigger(l?"ajaxSuccess":"ajaxError",[E,h,l?p:d]),m.fireWith(g,[E,C]),f&&(y.trigger("ajaxComplete",[E,h]),--w.active||w.event.trigger("ajaxStop")))}return E},getJSON:function(e,t,n){return w.get(e,t,n,"json")},getScript:function(e,t){return w.get(e,void 0,t,"script")}}),w.each(["get","post"],function(e,t){w[t]=function(e,n,r,i){return g(n)&&(i=i||r,r=n,n=void 0),w.ajax(w.extend({url:e,type:t,dataType:i,data:n,success:r},w.isPlainObject(e)&&e))}}),w._evalUrl=function(e){return w.ajax({url:e,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,"throws":!0})},w.fn.extend({wrapAll:function(e){var t;return this[0]&&(g(e)&&(e=e.call(this[0])),t=w(e,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstElementChild)e=e.firstElementChild;return e}).append(this)),this},wrapInner:function(e){return g(e)?this.each(function(t){w(this).wrapInner(e.call(this,t))}):this.each(function(){var t=w(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=g(e);return this.each(function(n){w(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(e){return this.parent(e).not("body").each(function(){w(this).replaceWith(this.childNodes)}),this}}),w.expr.pseudos.hidden=function(e){return!w.expr.pseudos.visible(e)},w.expr.pseudos.visible=function(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)},w.ajaxSettings.xhr=function(){try{return new e.XMLHttpRequest}catch(e){}};var Vt={0:200,1223:204},Gt=w.ajaxSettings.xhr();h.cors=!!Gt&&"withCredentials"in Gt,h.ajax=Gt=!!Gt,w.ajaxTransport(function(t){var n,r;if(h.cors||Gt&&!t.crossDomain)return{send:function(i,o){var a,s=t.xhr();if(s.open(t.type,t.url,t.async,t.username,t.password),t.xhrFields)for(a in t.xhrFields)s[a]=t.xhrFields[a];t.mimeType&&s.overrideMimeType&&s.overrideMimeType(t.mimeType),t.crossDomain||i["X-Requested-With"]||(i["X-Requested-With"]="XMLHttpRequest");for(a in i)s.setRequestHeader(a,i[a]);n=function(e){return function(){n&&(n=r=s.onload=s.onerror=s.onabort=s.ontimeout=s.onreadystatechange=null,"abort"===e?s.abort():"error"===e?"number"!=typeof s.status?o(0,"error"):o(s.status,s.statusText):o(Vt[s.status]||s.status,s.statusText,"text"!==(s.responseType||"text")||"string"!=typeof s.responseText?{binary:s.response}:{text:s.responseText},s.getAllResponseHeaders()))}},s.onload=n(),r=s.onerror=s.ontimeout=n("error"),void 0!==s.onabort?s.onabort=r:s.onreadystatechange=function(){4===s.readyState&&e.setTimeout(function(){n&&r()})},n=n("abort");try{s.send(t.hasContent&&t.data||null)}catch(e){if(n)throw e}},abort:function(){n&&n()}}}),w.ajaxPrefilter(function(e){e.crossDomain&&(e.contents.script=!1)}),w.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(e){return w.globalEval(e),e}}}),w.ajaxPrefilter("script",function(e){void 0===e.cache&&(e.cache=!1),e.crossDomain&&(e.type="GET")}),w.ajaxTransport("script",function(e){if(e.crossDomain){var t,n;return{send:function(i,o){t=w("' + : $r; + } +} + +// ------------------------------------------------------------------------ + +if ( ! function_exists('get_clickable_smileys')) +{ + /** + * Get Clickable Smileys + * + * Returns an array of image tag links that can be clicked to be inserted + * into a form field. + * + * @param string the URL to the folder containing the smiley images + * @param array + * @return array + */ + function get_clickable_smileys($image_url, $alias = '') + { + // For backward compatibility with js_insert_smiley + if (is_array($alias)) + { + $smileys = $alias; + } + elseif (FALSE === ($smileys = _get_smiley_array())) + { + return FALSE; + } + + // Add a trailing slash to the file path if needed + $image_url = rtrim($image_url, '/').'/'; + + $used = array(); + foreach ($smileys as $key => $val) + { + // Keep duplicates from being used, which can happen if the + // mapping array contains multiple identical replacements. For example: + // :-) and :) might be replaced with the same image so both smileys + // will be in the array. + if (isset($used[$smileys[$key][0]])) + { + continue; + } + + $link[] = ''.$smileys[$key][3].''; + $used[$smileys[$key][0]] = TRUE; + } + + return $link; + } +} + +// ------------------------------------------------------------------------ + +if ( ! function_exists('parse_smileys')) +{ + /** + * Parse Smileys + * + * Takes a string as input and swaps any contained smileys for the actual image + * + * @param string the text to be parsed + * @param string the URL to the folder containing the smiley images + * @param array + * @return string + */ + function parse_smileys($str = '', $image_url = '', $smileys = NULL) + { + if ($image_url === '' OR ( ! is_array($smileys) && FALSE === ($smileys = _get_smiley_array()))) + { + return $str; + } + + // Add a trailing slash to the file path if needed + $image_url = rtrim($image_url, '/').'/'; + + foreach ($smileys as $key => $val) + { + $str = str_replace($key, ''.$smileys[$key][3].'', $str); + } + + return $str; + } +} + +// ------------------------------------------------------------------------ + +if ( ! function_exists('_get_smiley_array')) +{ + /** + * Get Smiley Array + * + * Fetches the config/smiley.php file + * + * @return mixed + */ + function _get_smiley_array() + { + static $_smileys; + + if ( ! is_array($_smileys)) + { + if (file_exists(APPPATH.'config/smileys.php')) + { + include(APPPATH.'config/smileys.php'); + } + + if (file_exists(APPPATH.'config/'.ENVIRONMENT.'/smileys.php')) + { + include(APPPATH.'config/'.ENVIRONMENT.'/smileys.php'); + } + + if (empty($smileys) OR ! is_array($smileys)) + { + $_smileys = array(); + return FALSE; + } + + $_smileys = $smileys; + } + + return $_smileys; + } +} diff --git a/system/helpers/string_helper.php b/system/helpers/string_helper.php new file mode 100644 index 0000000..c7dd969 --- /dev/null +++ b/system/helpers/string_helper.php @@ -0,0 +1,304 @@ + $val) + { + $str[$key] = strip_slashes($val); + } + + return $str; + } +} + +// ------------------------------------------------------------------------ + +if ( ! function_exists('strip_quotes')) +{ + /** + * Strip Quotes + * + * Removes single and double quotes from a string + * + * @param string + * @return string + */ + function strip_quotes($str) + { + return str_replace(array('"', "'"), '', $str); + } +} + +// ------------------------------------------------------------------------ + +if ( ! function_exists('quotes_to_entities')) +{ + /** + * Quotes to Entities + * + * Converts single and double quotes to entities + * + * @param string + * @return string + */ + function quotes_to_entities($str) + { + return str_replace(array("\'","\"","'",'"'), array("'",""","'","""), $str); + } +} + +// ------------------------------------------------------------------------ + +if ( ! function_exists('reduce_double_slashes')) +{ + /** + * Reduce Double Slashes + * + * Converts double slashes in a string to a single slash, + * except those found in http:// + * + * http://www.some-site.com//index.php + * + * becomes: + * + * http://www.some-site.com/index.php + * + * @param string + * @return string + */ + function reduce_double_slashes($str) + { + return preg_replace('#(^|[^:])//+#', '\\1/', $str); + } +} + +// ------------------------------------------------------------------------ + +if ( ! function_exists('reduce_multiples')) +{ + /** + * Reduce Multiples + * + * Reduces multiple instances of a particular character. Example: + * + * Fred, Bill,, Joe, Jimmy + * + * becomes: + * + * Fred, Bill, Joe, Jimmy + * + * @param string + * @param string the character you wish to reduce + * @param bool TRUE/FALSE - whether to trim the character from the beginning/end + * @return string + */ + function reduce_multiples($str, $character = ',', $trim = FALSE) + { + $str = preg_replace('#'.preg_quote($character, '#').'{2,}#', $character, $str); + return ($trim === TRUE) ? trim($str, $character) : $str; + } +} + +// ------------------------------------------------------------------------ + +if ( ! function_exists('random_string')) +{ + /** + * Create a "Random" String + * + * @param string type of random string. basic, alpha, alnum, numeric, nozero, unique, md5, encrypt and sha1 + * @param int number of characters + * @return string + */ + function random_string($type = 'alnum', $len = 8) + { + switch ($type) + { + case 'basic': + return mt_rand(); + case 'alnum': + case 'numeric': + case 'nozero': + case 'alpha': + switch ($type) + { + case 'alpha': + $pool = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; + break; + case 'alnum': + $pool = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; + break; + case 'numeric': + $pool = '0123456789'; + break; + case 'nozero': + $pool = '123456789'; + break; + } + return substr(str_shuffle(str_repeat($pool, ceil($len / strlen($pool)))), 0, $len); + case 'unique': // todo: remove in 3.1+ + case 'md5': + return md5(uniqid(mt_rand())); + case 'encrypt': // todo: remove in 3.1+ + case 'sha1': + return sha1(uniqid(mt_rand(), TRUE)); + } + } +} + +// ------------------------------------------------------------------------ + +if ( ! function_exists('increment_string')) +{ + /** + * Add's _1 to a string or increment the ending number to allow _2, _3, etc + * + * @param string required + * @param string What should the duplicate number be appended with + * @param string Which number should be used for the first dupe increment + * @return string + */ + function increment_string($str, $separator = '_', $first = 1) + { + preg_match('/(.+)'.preg_quote($separator, '/').'([0-9]+)$/', $str, $match); + return isset($match[2]) ? $match[1].$separator.($match[2] + 1) : $str.$separator.$first; + } +} + +// ------------------------------------------------------------------------ + +if ( ! function_exists('alternator')) +{ + /** + * Alternator + * + * Allows strings to be alternated. See docs... + * + * @param string (as many parameters as needed) + * @return string + */ + function alternator() + { + static $i; + + if (func_num_args() === 0) + { + $i = 0; + return ''; + } + + $args = func_get_args(); + return $args[($i++ % count($args))]; + } +} + +// ------------------------------------------------------------------------ + +if ( ! function_exists('repeater')) +{ + /** + * Repeater function + * + * @todo Remove in version 3.1+. + * @deprecated 3.0.0 This is just an alias for PHP's native str_repeat() + * + * @param string $data String to repeat + * @param int $num Number of repeats + * @return string + */ + function repeater($data, $num = 1) + { + return ($num > 0) ? str_repeat($data, $num) : ''; + } +} diff --git a/system/helpers/text_helper.php b/system/helpers/text_helper.php new file mode 100644 index 0000000..e1c5e24 --- /dev/null +++ b/system/helpers/text_helper.php @@ -0,0 +1,567 @@ += $n) + { + $out = trim($out); + return (mb_strlen($out) === mb_strlen($str)) ? $out : $out.$end_char; + } + } + } +} + +// ------------------------------------------------------------------------ + +if ( ! function_exists('ascii_to_entities')) +{ + /** + * High ASCII to Entities + * + * Converts high ASCII text and MS Word special characters to character entities + * + * @param string $str + * @return string + */ + function ascii_to_entities($str) + { + $out = ''; + $length = defined('MB_OVERLOAD_STRING') + ? mb_strlen($str, '8bit') - 1 + : strlen($str) - 1; + for ($i = 0, $count = 1, $temp = array(); $i <= $length; $i++) + { + $ordinal = ord($str[$i]); + + if ($ordinal < 128) + { + /* + If the $temp array has a value but we have moved on, then it seems only + fair that we output that entity and restart $temp before continuing. -Paul + */ + if (count($temp) === 1) + { + $out .= '&#'.array_shift($temp).';'; + $count = 1; + } + + $out .= $str[$i]; + } + else + { + if (count($temp) === 0) + { + $count = ($ordinal < 224) ? 2 : 3; + } + + $temp[] = $ordinal; + + if (count($temp) === $count) + { + $number = ($count === 3) + ? (($temp[0] % 16) * 4096) + (($temp[1] % 64) * 64) + ($temp[2] % 64) + : (($temp[0] % 32) * 64) + ($temp[1] % 64); + + $out .= '&#'.$number.';'; + $count = 1; + $temp = array(); + } + // If this is the last iteration, just output whatever we have + elseif ($i === $length) + { + $out .= '&#'.implode(';', $temp).';'; + } + } + } + + return $out; + } +} + +// ------------------------------------------------------------------------ + +if ( ! function_exists('entities_to_ascii')) +{ + /** + * Entities to ASCII + * + * Converts character entities back to ASCII + * + * @param string + * @param bool + * @return string + */ + function entities_to_ascii($str, $all = TRUE) + { + if (preg_match_all('/\&#(\d+)\;/', $str, $matches)) + { + for ($i = 0, $s = count($matches[0]); $i < $s; $i++) + { + $digits = $matches[1][$i]; + $out = ''; + + if ($digits < 128) + { + $out .= chr($digits); + + } + elseif ($digits < 2048) + { + $out .= chr(192 + (($digits - ($digits % 64)) / 64)).chr(128 + ($digits % 64)); + } + else + { + $out .= chr(224 + (($digits - ($digits % 4096)) / 4096)) + .chr(128 + ((($digits % 4096) - ($digits % 64)) / 64)) + .chr(128 + ($digits % 64)); + } + + $str = str_replace($matches[0][$i], $out, $str); + } + } + + if ($all) + { + return str_replace( + array('&', '<', '>', '"', ''', '-'), + array('&', '<', '>', '"', "'", '-'), + $str + ); + } + + return $str; + } +} + +// ------------------------------------------------------------------------ + +if ( ! function_exists('word_censor')) +{ + /** + * Word Censoring Function + * + * Supply a string and an array of disallowed words and any + * matched words will be converted to #### or to the replacement + * word you've submitted. + * + * @param string the text string + * @param string the array of censored words + * @param string the optional replacement value + * @return string + */ + function word_censor($str, $censored, $replacement = '') + { + if ( ! is_array($censored)) + { + return $str; + } + + $str = ' '.$str.' '; + + // \w, \b and a few others do not match on a unicode character + // set for performance reasons. As a result words like über + // will not match on a word boundary. Instead, we'll assume that + // a bad word will be bookeneded by any of these characters. + $delim = '[-_\'\"`(){}<>\[\]|!?@#%&,.:;^~*+=\/ 0-9\n\r\t]'; + + foreach ($censored as $badword) + { + $badword = str_replace('\*', '\w*?', preg_quote($badword, '/')); + if ($replacement !== '') + { + $str = preg_replace( + "/({$delim})(".$badword.")({$delim})/i", + "\\1{$replacement}\\3", + $str + ); + } + elseif (preg_match_all("/{$delim}(".$badword."){$delim}/i", $str, $matches, PREG_PATTERN_ORDER | PREG_OFFSET_CAPTURE)) + { + $matches = $matches[1]; + for ($i = count($matches) - 1; $i >= 0; $i--) + { + $length = strlen($matches[$i][0]); + $str = substr_replace( + $str, + str_repeat('#', $length), + $matches[$i][1], + $length + ); + } + } + } + + return trim($str); + } +} + +// ------------------------------------------------------------------------ + +if ( ! function_exists('highlight_code')) +{ + /** + * Code Highlighter + * + * Colorizes code strings + * + * @param string the text string + * @return string + */ + function highlight_code($str) + { + /* The highlight string function encodes and highlights + * brackets so we need them to start raw. + * + * Also replace any existing PHP tags to temporary markers + * so they don't accidentally break the string out of PHP, + * and thus, thwart the highlighting. + */ + $str = str_replace( + array('<', '>', '', '<%', '%>', '\\', ''), + array('<', '>', 'phptagopen', 'phptagclose', 'asptagopen', 'asptagclose', 'backslashtmp', 'scriptclose'), + $str + ); + + // The highlight_string function requires that the text be surrounded + // by PHP tags, which we will remove later + $str = highlight_string('', TRUE); + + // Remove our artificially added PHP, and the syntax highlighting that came with it + $str = preg_replace( + array( + '/<\?php( | )/i', + '/(.*?)\?><\/span>\n<\/span>\n<\/code>/is', + '/<\/span>/i' + ), + array( + '', + "$1\n\n", + '' + ), + $str + ); + + // Replace our markers back to PHP tags. + return str_replace( + array('phptagopen', 'phptagclose', 'asptagopen', 'asptagclose', 'backslashtmp', 'scriptclose'), + array('<?', '?>', '<%', '%>', '\\', '</script>'), + $str + ); + } +} + +// ------------------------------------------------------------------------ + +if ( ! function_exists('highlight_phrase')) +{ + /** + * Phrase Highlighter + * + * Highlights a phrase within a text string + * + * @param string $str the text string + * @param string $phrase the phrase you'd like to highlight + * @param string $tag_open the openging tag to precede the phrase with + * @param string $tag_close the closing tag to end the phrase with + * @return string + */ + function highlight_phrase($str, $phrase, $tag_open = '', $tag_close = '') + { + return ($str !== '' && $phrase !== '') + ? preg_replace('/('.preg_quote($phrase, '/').')/i'.(UTF8_ENABLED ? 'u' : ''), $tag_open.'\\1'.$tag_close, $str) + : $str; + } +} + +// ------------------------------------------------------------------------ + +if ( ! function_exists('convert_accented_characters')) +{ + /** + * Convert Accented Foreign Characters to ASCII + * + * @param string $str Input string + * @return string + */ + function convert_accented_characters($str) + { + static $array_from, $array_to; + + if ( ! is_array($array_from)) + { + if (file_exists(APPPATH.'config/foreign_chars.php')) + { + include(APPPATH.'config/foreign_chars.php'); + } + + if (file_exists(APPPATH.'config/'.ENVIRONMENT.'/foreign_chars.php')) + { + include(APPPATH.'config/'.ENVIRONMENT.'/foreign_chars.php'); + } + + if (empty($foreign_characters) OR ! is_array($foreign_characters)) + { + $array_from = array(); + $array_to = array(); + + return $str; + } + + $array_from = array_keys($foreign_characters); + $array_to = array_values($foreign_characters); + } + + return preg_replace($array_from, $array_to, $str); + } +} + +// ------------------------------------------------------------------------ + +if ( ! function_exists('word_wrap')) +{ + /** + * Word Wrap + * + * Wraps text at the specified character. Maintains the integrity of words. + * Anything placed between {unwrap}{/unwrap} will not be word wrapped, nor + * will URLs. + * + * @param string $str the text string + * @param int $charlim = 76 the number of characters to wrap at + * @return string + */ + function word_wrap($str, $charlim = 76) + { + // Set the character limit + is_numeric($charlim) OR $charlim = 76; + + // Reduce multiple spaces + $str = preg_replace('| +|', ' ', $str); + + // Standardize newlines + if (strpos($str, "\r") !== FALSE) + { + $str = str_replace(array("\r\n", "\r"), "\n", $str); + } + + // If the current word is surrounded by {unwrap} tags we'll + // strip the entire chunk and replace it with a marker. + $unwrap = array(); + if (preg_match_all('|\{unwrap\}(.+?)\{/unwrap\}|s', $str, $matches)) + { + for ($i = 0, $c = count($matches[0]); $i < $c; $i++) + { + $unwrap[] = $matches[1][$i]; + $str = str_replace($matches[0][$i], '{{unwrapped'.$i.'}}', $str); + } + } + + // Use PHP's native function to do the initial wordwrap. + // We set the cut flag to FALSE so that any individual words that are + // too long get left alone. In the next step we'll deal with them. + $str = wordwrap($str, $charlim, "\n", FALSE); + + // Split the string into individual lines of text and cycle through them + $output = ''; + foreach (explode("\n", $str) as $line) + { + // Is the line within the allowed character count? + // If so we'll join it to the output and continue + if (mb_strlen($line) <= $charlim) + { + $output .= $line."\n"; + continue; + } + + $temp = ''; + while (mb_strlen($line) > $charlim) + { + // If the over-length word is a URL we won't wrap it + if (preg_match('!\[url.+\]|://|www\.!', $line)) + { + break; + } + + // Trim the word down + $temp .= mb_substr($line, 0, $charlim - 1); + $line = mb_substr($line, $charlim - 1); + } + + // If $temp contains data it means we had to split up an over-length + // word into smaller chunks so we'll add it back to our current line + if ($temp !== '') + { + $output .= $temp."\n".$line."\n"; + } + else + { + $output .= $line."\n"; + } + } + + // Put our markers back + if (count($unwrap) > 0) + { + foreach ($unwrap as $key => $val) + { + $output = str_replace('{{unwrapped'.$key.'}}', $val, $output); + } + } + + return $output; + } +} + +// ------------------------------------------------------------------------ + +if ( ! function_exists('ellipsize')) +{ + /** + * Ellipsize String + * + * This function will strip tags from a string, split it at its max_length and ellipsize + * + * @param string string to ellipsize + * @param int max length of string + * @param mixed int (1|0) or float, .5, .2, etc for position to split + * @param string ellipsis ; Default '...' + * @return string ellipsized string + */ + function ellipsize($str, $max_length, $position = 1, $ellipsis = '…') + { + // Strip tags + $str = trim(strip_tags($str)); + + // Is the string long enough to ellipsize? + if (mb_strlen($str) <= $max_length) + { + return $str; + } + + $beg = mb_substr($str, 0, floor($max_length * $position)); + $position = ($position > 1) ? 1 : $position; + + if ($position === 1) + { + $end = mb_substr($str, 0, -($max_length - mb_strlen($beg))); + } + else + { + $end = mb_substr($str, -($max_length - mb_strlen($beg))); + } + + return $beg.$ellipsis.$end; + } +} diff --git a/system/helpers/typography_helper.php b/system/helpers/typography_helper.php new file mode 100644 index 0000000..d308a57 --- /dev/null +++ b/system/helpers/typography_helper.php @@ -0,0 +1,104 @@ +load->library('typography'); + return $CI->typography->nl2br_except_pre($str); + } +} + +// ------------------------------------------------------------------------ + +if ( ! function_exists('auto_typography')) +{ + /** + * Auto Typography Wrapper Function + * + * @param string $str + * @param bool $reduce_linebreaks = FALSE whether to reduce multiple instances of double newlines to two + * @return string + */ + function auto_typography($str, $reduce_linebreaks = FALSE) + { + $CI =& get_instance(); + $CI->load->library('typography'); + return $CI->typography->auto_typography($str, $reduce_linebreaks); + } +} + +// -------------------------------------------------------------------- + +if ( ! function_exists('entity_decode')) +{ + /** + * HTML Entities Decode + * + * This function is a replacement for html_entity_decode() + * + * @param string + * @param string + * @return string + */ + function entity_decode($str, $charset = NULL) + { + return get_instance()->security->entity_decode($str, $charset); + } +} diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php new file mode 100644 index 0000000..bebfd25 --- /dev/null +++ b/system/helpers/url_helper.php @@ -0,0 +1,569 @@ +config->site_url($uri, $protocol); + } +} + +// ------------------------------------------------------------------------ + +if ( ! function_exists('base_url')) +{ + /** + * Base URL + * + * Create a local URL based on your basepath. + * Segments can be passed in as a string or an array, same as site_url + * or a URL to a file can be passed in, e.g. to an image file. + * + * @param string $uri + * @param string $protocol + * @return string + */ + function base_url($uri = '', $protocol = NULL) + { + return get_instance()->config->base_url($uri, $protocol); + } +} + +// ------------------------------------------------------------------------ + +if ( ! function_exists('current_url')) +{ + /** + * Current URL + * + * Returns the full URL (including segments) of the page where this + * function is placed + * + * @return string + */ + function current_url() + { + $CI =& get_instance(); + return $CI->config->site_url($CI->uri->uri_string()); + } +} + +// ------------------------------------------------------------------------ + +if ( ! function_exists('uri_string')) +{ + /** + * URL String + * + * Returns the URI segments. + * + * @return string + */ + function uri_string() + { + return get_instance()->uri->uri_string(); + } +} + +// ------------------------------------------------------------------------ + +if ( ! function_exists('index_page')) +{ + /** + * Index page + * + * Returns the "index_page" from your config file + * + * @return string + */ + function index_page() + { + return get_instance()->config->item('index_page'); + } +} + +// ------------------------------------------------------------------------ + +if ( ! function_exists('anchor')) +{ + /** + * Anchor Link + * + * Creates an anchor based on the local URL. + * + * @param string the URL + * @param string the link title + * @param mixed any attributes + * @return string + */ + function anchor($uri = '', $title = '', $attributes = '') + { + $title = (string) $title; + + $site_url = is_array($uri) + ? site_url($uri) + : (preg_match('#^(\w+:)?//#i', $uri) ? $uri : site_url($uri)); + + if ($title === '') + { + $title = $site_url; + } + + if ($attributes !== '') + { + $attributes = _stringify_attributes($attributes); + } + + return ''.$title.''; + } +} + +// ------------------------------------------------------------------------ + +if ( ! function_exists('anchor_popup')) +{ + /** + * Anchor Link - Pop-up version + * + * Creates an anchor based on the local URL. The link + * opens a new window based on the attributes specified. + * + * @param string the URL + * @param string the link title + * @param mixed any attributes + * @return string + */ + function anchor_popup($uri = '', $title = '', $attributes = FALSE) + { + $title = (string) $title; + $site_url = preg_match('#^(\w+:)?//#i', $uri) ? $uri : site_url($uri); + + if ($title === '') + { + $title = $site_url; + } + + if ($attributes === FALSE) + { + return '".$title.''; + } + + if ( ! is_array($attributes)) + { + $attributes = array($attributes); + + // Ref: http://www.w3schools.com/jsref/met_win_open.asp + $window_name = '_blank'; + } + elseif ( ! empty($attributes['window_name'])) + { + $window_name = $attributes['window_name']; + unset($attributes['window_name']); + } + else + { + $window_name = '_blank'; + } + + foreach (array('width' => '800', 'height' => '600', 'scrollbars' => 'yes', 'menubar' => 'no', 'status' => 'yes', 'resizable' => 'yes', 'screenx' => '0', 'screeny' => '0') as $key => $val) + { + $atts[$key] = isset($attributes[$key]) ? $attributes[$key] : $val; + unset($attributes[$key]); + } + + $attributes = _stringify_attributes($attributes); + + return ''.$title.''; + } +} + +// ------------------------------------------------------------------------ + +if ( ! function_exists('mailto')) +{ + /** + * Mailto Link + * + * @param string the email address + * @param string the link title + * @param mixed any attributes + * @return string + */ + function mailto($email, $title = '', $attributes = '') + { + $title = (string) $title; + + if ($title === '') + { + $title = $email; + } + + return ''.$title.''; + } +} + +// ------------------------------------------------------------------------ + +if ( ! function_exists('safe_mailto')) +{ + /** + * Encoded Mailto Link + * + * Create a spam-protected mailto link written in Javascript + * + * @param string the email address + * @param string the link title + * @param mixed any attributes + * @return string + */ + function safe_mailto($email, $title = '', $attributes = '') + { + $title = (string) $title; + + if ($title === '') + { + $title = $email; + } + + $x = str_split(' $val) + { + $x[] = ' '.$key.'="'; + for ($i = 0, $l = strlen($val); $i < $l; $i++) + { + $x[] = '|'.ord($val[$i]); + } + $x[] = '"'; + } + } + else + { + for ($i = 0, $l = strlen($attributes); $i < $l; $i++) + { + $x[] = $attributes[$i]; + } + } + } + + $x[] = '>'; + + $temp = array(); + for ($i = 0, $l = strlen($title); $i < $l; $i++) + { + $ordinal = ord($title[$i]); + + if ($ordinal < 128) + { + $x[] = '|'.$ordinal; + } + else + { + if (count($temp) === 0) + { + $count = ($ordinal < 224) ? 2 : 3; + } + + $temp[] = $ordinal; + if (count($temp) === $count) + { + $number = ($count === 3) + ? (($temp[0] % 16) * 4096) + (($temp[1] % 64) * 64) + ($temp[2] % 64) + : (($temp[0] % 32) * 64) + ($temp[1] % 64); + $x[] = '|'.$number; + $count = 1; + $temp = array(); + } + } + } + + $x[] = '<'; $x[] = '/'; $x[] = 'a'; $x[] = '>'; + + $x = array_reverse($x); + + $output = "'; + + return $output; + } +} + +// ------------------------------------------------------------------------ + +if ( ! function_exists('auto_link')) +{ + /** + * Auto-linker + * + * Automatically links URL and Email addresses. + * Note: There's a bit of extra code here to deal with + * URLs or emails that end in a period. We'll strip these + * off and add them after the link. + * + * @param string the string + * @param string the type: email, url, or both + * @param bool whether to create pop-up links + * @return string + */ + function auto_link($str, $type = 'both', $popup = FALSE) + { + // Find and replace any URLs. + if ($type !== 'email' && preg_match_all('#(\w*://|www\.)[a-z0-9]+(-+[a-z0-9]+)*(\.[a-z0-9]+(-+[a-z0-9]+)*)+(/([^\s()<>;]+\w)?/?)?#i', $str, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER)) + { + // Set our target HTML if using popup links. + $target = ($popup) ? ' target="_blank" rel="noopener"' : ''; + + // We process the links in reverse order (last -> first) so that + // the returned string offsets from preg_match_all() are not + // moved as we add more HTML. + foreach (array_reverse($matches) as $match) + { + // $match[0] is the matched string/link + // $match[1] is either a protocol prefix or 'www.' + // + // With PREG_OFFSET_CAPTURE, both of the above is an array, + // where the actual value is held in [0] and its offset at the [1] index. + $a = ''.$match[0][0].''; + $str = substr_replace($str, $a, $match[0][1], strlen($match[0][0])); + } + } + + // Find and replace any emails. + if ($type !== 'url' && preg_match_all('#([\w\.\-\+]+@[a-z0-9\-]+\.[a-z0-9\-\.]+[^[:punct:]\s])#i', $str, $matches, PREG_OFFSET_CAPTURE)) + { + foreach (array_reverse($matches[0]) as $match) + { + if (filter_var($match[0], FILTER_VALIDATE_EMAIL) !== FALSE) + { + $str = substr_replace($str, safe_mailto($match[0]), $match[1], strlen($match[0])); + } + } + } + + return $str; + } +} + +// ------------------------------------------------------------------------ + +if ( ! function_exists('prep_url')) +{ + /** + * Prep URL + * + * Simply adds the http:// part if no scheme is included + * + * @param string the URL + * @return string + */ + function prep_url($str = '') + { + if ($str === 'http://' OR $str === '') + { + return ''; + } + + $url = parse_url($str); + + if ( ! $url OR ! isset($url['scheme'])) + { + return 'http://'.$str; + } + + return $str; + } +} + +// ------------------------------------------------------------------------ + +if ( ! function_exists('url_title')) +{ + /** + * Create URL Title + * + * Takes a "title" string as input and creates a + * human-friendly URL string with a "separator" string + * as the word separator. + * + * @todo Remove old 'dash' and 'underscore' usage in 3.1+. + * @param string $str Input string + * @param string $separator Word separator + * (usually '-' or '_') + * @param bool $lowercase Whether to transform the output string to lowercase + * @return string + */ + function url_title($str, $separator = '-', $lowercase = FALSE) + { + if ($separator === 'dash') + { + $separator = '-'; + } + elseif ($separator === 'underscore') + { + $separator = '_'; + } + + $q_separator = preg_quote($separator, '#'); + + $trans = array( + '&.+?;' => '', + '[^\w\d _-]' => '', + '\s+' => $separator, + '('.$q_separator.')+' => $separator + ); + + $str = strip_tags($str); + foreach ($trans as $key => $val) + { + $str = preg_replace('#'.$key.'#i'.(UTF8_ENABLED ? 'u' : ''), $val, $str); + } + + if ($lowercase === TRUE) + { + $str = strtolower($str); + } + + return trim(trim($str, $separator)); + } +} + +// ------------------------------------------------------------------------ + +if ( ! function_exists('redirect')) +{ + /** + * Header Redirect + * + * Header redirect in two flavors + * For very fine grained control over headers, you could use the Output + * Library's set_header() function. + * + * @param string $uri URL + * @param string $method Redirect method + * 'auto', 'location' or 'refresh' + * @param int $code HTTP Response status code + * @return void + */ + function redirect($uri = '', $method = 'auto', $code = NULL) + { + if ( ! preg_match('#^(\w+:)?//#i', $uri)) + { + $uri = site_url($uri); + } + + // IIS environment likely? Use 'refresh' for better compatibility + if ($method === 'auto' && isset($_SERVER['SERVER_SOFTWARE']) && strpos($_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS') !== FALSE) + { + $method = 'refresh'; + } + elseif ($method !== 'refresh' && (empty($code) OR ! is_numeric($code))) + { + if (isset($_SERVER['SERVER_PROTOCOL'], $_SERVER['REQUEST_METHOD']) && $_SERVER['SERVER_PROTOCOL'] === 'HTTP/1.1') + { + $code = ($_SERVER['REQUEST_METHOD'] !== 'GET') + ? 303 // reference: http://en.wikipedia.org/wiki/Post/Redirect/Get + : 307; + } + else + { + $code = 302; + } + } + + switch ($method) + { + case 'refresh': + header('Refresh:0;url='.$uri); + break; + default: + header('Location: '.$uri, TRUE, $code); + break; + } + exit; + } +} diff --git a/system/helpers/xml_helper.php b/system/helpers/xml_helper.php new file mode 100644 index 0000000..2639956 --- /dev/null +++ b/system/helpers/xml_helper.php @@ -0,0 +1,90 @@ +', '"', "'", '-'), + array('&', '<', '>', '"', ''', '-'), + $str + ); + + // Decode the temp markers back to entities + $str = preg_replace('/'.$temp.'(\d+);/', '&#\\1;', $str); + + if ($protect_all === TRUE) + { + return preg_replace('/'.$temp.'(\w+);/', '&\\1;', $str); + } + + return $str; + } +} diff --git a/system/index.html b/system/index.html new file mode 100644 index 0000000..b702fbc --- /dev/null +++ b/system/index.html @@ -0,0 +1,11 @@ + + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + diff --git a/system/language/english/calendar_lang.php b/system/language/english/calendar_lang.php new file mode 100644 index 0000000..ce83814 --- /dev/null +++ b/system/language/english/calendar_lang.php @@ -0,0 +1,84 @@ + + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + diff --git a/system/language/english/migration_lang.php b/system/language/english/migration_lang.php new file mode 100644 index 0000000..967d59c --- /dev/null +++ b/system/language/english/migration_lang.php @@ -0,0 +1,47 @@ + + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + diff --git a/system/libraries/Cache/Cache.php b/system/libraries/Cache/Cache.php new file mode 100644 index 0000000..450d57b --- /dev/null +++ b/system/libraries/Cache/Cache.php @@ -0,0 +1,255 @@ +_adapter = $config['adapter']; + isset($config['backup']) && $this->_backup_driver = $config['backup']; + isset($config['key_prefix']) && $this->key_prefix = $config['key_prefix']; + + // If the specified adapter isn't available, check the backup. + if ( ! $this->is_supported($this->_adapter)) + { + if ( ! $this->is_supported($this->_backup_driver)) + { + // Backup isn't supported either. Default to 'Dummy' driver. + log_message('error', 'Cache adapter "'.$this->_adapter.'" and backup "'.$this->_backup_driver.'" are both unavailable. Cache is now using "Dummy" adapter.'); + $this->_adapter = 'dummy'; + } + else + { + // Backup is supported. Set it to primary. + log_message('debug', 'Cache adapter "'.$this->_adapter.'" is unavailable. Falling back to "'.$this->_backup_driver.'" backup adapter.'); + $this->_adapter = $this->_backup_driver; + } + } + } + + // ------------------------------------------------------------------------ + + /** + * Get + * + * Look for a value in the cache. If it exists, return the data + * if not, return FALSE + * + * @param string $id + * @return mixed value matching $id or FALSE on failure + */ + public function get($id) + { + return $this->{$this->_adapter}->get($this->key_prefix.$id); + } + + // ------------------------------------------------------------------------ + + /** + * Cache Save + * + * @param string $id Cache ID + * @param mixed $data Data to store + * @param int $ttl Cache TTL (in seconds) + * @param bool $raw Whether to store the raw value + * @return bool TRUE on success, FALSE on failure + */ + public function save($id, $data, $ttl = 60, $raw = FALSE) + { + return $this->{$this->_adapter}->save($this->key_prefix.$id, $data, $ttl, $raw); + } + + // ------------------------------------------------------------------------ + + /** + * Delete from Cache + * + * @param string $id Cache ID + * @return bool TRUE on success, FALSE on failure + */ + public function delete($id) + { + return $this->{$this->_adapter}->delete($this->key_prefix.$id); + } + + // ------------------------------------------------------------------------ + + /** + * Increment a raw value + * + * @param string $id Cache ID + * @param int $offset Step/value to add + * @return mixed New value on success or FALSE on failure + */ + public function increment($id, $offset = 1) + { + return $this->{$this->_adapter}->increment($this->key_prefix.$id, $offset); + } + + // ------------------------------------------------------------------------ + + /** + * Decrement a raw value + * + * @param string $id Cache ID + * @param int $offset Step/value to reduce by + * @return mixed New value on success or FALSE on failure + */ + public function decrement($id, $offset = 1) + { + return $this->{$this->_adapter}->decrement($this->key_prefix.$id, $offset); + } + + // ------------------------------------------------------------------------ + + /** + * Clean the cache + * + * @return bool TRUE on success, FALSE on failure + */ + public function clean() + { + return $this->{$this->_adapter}->clean(); + } + + // ------------------------------------------------------------------------ + + /** + * Cache Info + * + * @param string $type = 'user' user/filehits + * @return mixed array containing cache info on success OR FALSE on failure + */ + public function cache_info($type = 'user') + { + return $this->{$this->_adapter}->cache_info($type); + } + + // ------------------------------------------------------------------------ + + /** + * Get Cache Metadata + * + * @param string $id key to get cache metadata on + * @return mixed cache item metadata + */ + public function get_metadata($id) + { + return $this->{$this->_adapter}->get_metadata($this->key_prefix.$id); + } + + // ------------------------------------------------------------------------ + + /** + * Is the requested driver supported in this environment? + * + * @param string $driver The driver to test + * @return array + */ + public function is_supported($driver) + { + static $support; + + if ( ! isset($support, $support[$driver])) + { + $support[$driver] = $this->{$driver}->is_supported(); + } + + return $support[$driver]; + } +} diff --git a/system/libraries/Cache/drivers/Cache_apc.php b/system/libraries/Cache/drivers/Cache_apc.php new file mode 100644 index 0000000..8da8854 --- /dev/null +++ b/system/libraries/Cache/drivers/Cache_apc.php @@ -0,0 +1,217 @@ +is_supported()) + { + log_message('error', 'Cache: Failed to initialize APC; extension not loaded/enabled?'); + } + } + + // ------------------------------------------------------------------------ + + /** + * Get + * + * Look for a value in the cache. If it exists, return the data + * if not, return FALSE + * + * @param string + * @return mixed value that is stored/FALSE on failure + */ + public function get($id) + { + $success = FALSE; + $data = apc_fetch($id, $success); + + return ($success === TRUE) ? $data : FALSE; + } + + // ------------------------------------------------------------------------ + + /** + * Cache Save + * + * @param string $id Cache ID + * @param mixed $data Data to store + * @param int $ttl Length of time (in seconds) to cache the data + * @param bool $raw Whether to store the raw value (unused) + * @return bool TRUE on success, FALSE on failure + */ + public function save($id, $data, $ttl = 60, $raw = FALSE) + { + return apc_store($id, $data, (int) $ttl); + } + + // ------------------------------------------------------------------------ + + /** + * Delete from Cache + * + * @param mixed unique identifier of the item in the cache + * @return bool true on success/false on failure + */ + public function delete($id) + { + return apc_delete($id); + } + + // ------------------------------------------------------------------------ + + /** + * Increment a raw value + * + * @param string $id Cache ID + * @param int $offset Step/value to add + * @return mixed New value on success or FALSE on failure + */ + public function increment($id, $offset = 1) + { + return apc_inc($id, $offset); + } + + // ------------------------------------------------------------------------ + + /** + * Decrement a raw value + * + * @param string $id Cache ID + * @param int $offset Step/value to reduce by + * @return mixed New value on success or FALSE on failure + */ + public function decrement($id, $offset = 1) + { + return apc_dec($id, $offset); + } + + // ------------------------------------------------------------------------ + + /** + * Clean the cache + * + * @return bool false on failure/true on success + */ + public function clean() + { + return apc_clear_cache('user'); + } + + // ------------------------------------------------------------------------ + + /** + * Cache Info + * + * @param string user/filehits + * @return mixed array on success, false on failure + */ + public function cache_info($type = NULL) + { + return apc_cache_info($type); + } + + // ------------------------------------------------------------------------ + + /** + * Get Cache Metadata + * + * @param mixed key to get cache metadata on + * @return mixed array on success/false on failure + */ + public function get_metadata($id) + { + $cache_info = apc_cache_info('user', FALSE); + if (empty($cache_info) OR empty($cache_info['cache_list'])) + { + return FALSE; + } + + foreach ($cache_info['cache_list'] as &$entry) + { + if ($entry['info'] !== $id) + { + continue; + } + + $success = FALSE; + $metadata = array( + 'expire' => ($entry['ttl'] ? $entry['mtime'] + $entry['ttl'] : 0), + 'mtime' => $entry['ttl'], + 'data' => apc_fetch($id, $success) + ); + + return ($success === TRUE) ? $metadata : FALSE; + } + + return FALSE; + } + + // ------------------------------------------------------------------------ + + /** + * is_supported() + * + * Check to see if APC is available on this system, bail if it isn't. + * + * @return bool + */ + public function is_supported() + { + return (extension_loaded('apc') && ini_get('apc.enabled')); + } +} diff --git a/system/libraries/Cache/drivers/Cache_dummy.php b/system/libraries/Cache/drivers/Cache_dummy.php new file mode 100644 index 0000000..fdb9042 --- /dev/null +++ b/system/libraries/Cache/drivers/Cache_dummy.php @@ -0,0 +1,172 @@ +load->helper('file'); + $path = $CI->config->item('cache_path'); + $this->_cache_path = ($path === '') ? APPPATH.'cache/' : $path; + } + + // ------------------------------------------------------------------------ + + /** + * Fetch from cache + * + * @param string $id Cache ID + * @return mixed Data on success, FALSE on failure + */ + public function get($id) + { + $data = $this->_get($id); + return is_array($data) ? $data['data'] : FALSE; + } + + // ------------------------------------------------------------------------ + + /** + * Save into cache + * + * @param string $id Cache ID + * @param mixed $data Data to store + * @param int $ttl Time to live in seconds + * @param bool $raw Whether to store the raw value (unused) + * @return bool TRUE on success, FALSE on failure + */ + public function save($id, $data, $ttl = 60, $raw = FALSE) + { + $contents = array( + 'time' => time(), + 'ttl' => $ttl, + 'data' => $data + ); + + if (write_file($this->_cache_path.$id, serialize($contents))) + { + chmod($this->_cache_path.$id, 0640); + return TRUE; + } + + return FALSE; + } + + // ------------------------------------------------------------------------ + + /** + * Delete from Cache + * + * @param mixed unique identifier of item in cache + * @return bool true on success/false on failure + */ + public function delete($id) + { + return is_file($this->_cache_path.$id) ? unlink($this->_cache_path.$id) : FALSE; + } + + // ------------------------------------------------------------------------ + + /** + * Increment a raw value + * + * @param string $id Cache ID + * @param int $offset Step/value to add + * @return New value on success, FALSE on failure + */ + public function increment($id, $offset = 1) + { + $data = $this->_get($id); + + if ($data === FALSE) + { + $data = array('data' => 0, 'ttl' => 60); + } + elseif ( ! is_int($data['data'])) + { + return FALSE; + } + + $new_value = $data['data'] + $offset; + return $this->save($id, $new_value, $data['ttl']) + ? $new_value + : FALSE; + } + + // ------------------------------------------------------------------------ + + /** + * Decrement a raw value + * + * @param string $id Cache ID + * @param int $offset Step/value to reduce by + * @return New value on success, FALSE on failure + */ + public function decrement($id, $offset = 1) + { + $data = $this->_get($id); + + if ($data === FALSE) + { + $data = array('data' => 0, 'ttl' => 60); + } + elseif ( ! is_int($data['data'])) + { + return FALSE; + } + + $new_value = $data['data'] - $offset; + return $this->save($id, $new_value, $data['ttl']) + ? $new_value + : FALSE; + } + + // ------------------------------------------------------------------------ + + /** + * Clean the Cache + * + * @return bool false on failure/true on success + */ + public function clean() + { + return delete_files($this->_cache_path, FALSE, TRUE); + } + + // ------------------------------------------------------------------------ + + /** + * Cache Info + * + * Not supported by file-based caching + * + * @param string user/filehits + * @return mixed FALSE + */ + public function cache_info($type = NULL) + { + return get_dir_file_info($this->_cache_path); + } + + // ------------------------------------------------------------------------ + + /** + * Get Cache Metadata + * + * @param mixed key to get cache metadata on + * @return mixed FALSE on failure, array on success. + */ + public function get_metadata($id) + { + if ( ! is_file($this->_cache_path.$id)) + { + return FALSE; + } + + $data = unserialize(file_get_contents($this->_cache_path.$id)); + + if (is_array($data)) + { + $mtime = filemtime($this->_cache_path.$id); + + if ( ! isset($data['ttl'], $data['time'])) + { + return FALSE; + } + + return array( + 'expire' => $data['time'] + $data['ttl'], + 'mtime' => $mtime + ); + } + + return FALSE; + } + + // ------------------------------------------------------------------------ + + /** + * Is supported + * + * In the file driver, check to see that the cache directory is indeed writable + * + * @return bool + */ + public function is_supported() + { + return is_really_writable($this->_cache_path); + } + + // ------------------------------------------------------------------------ + + /** + * Get all data + * + * Internal method to get all the relevant data about a cache item + * + * @param string $id Cache ID + * @return mixed Data array on success or FALSE on failure + */ + protected function _get($id) + { + if ( ! is_file($this->_cache_path.$id)) + { + return FALSE; + } + + $data = unserialize(file_get_contents($this->_cache_path.$id)); + + if ($data['ttl'] > 0 && time() > $data['time'] + $data['ttl']) + { + file_exists($this->_cache_path.$id) && unlink($this->_cache_path.$id); + return FALSE; + } + + return $data; + } + +} diff --git a/system/libraries/Cache/drivers/Cache_memcached.php b/system/libraries/Cache/drivers/Cache_memcached.php new file mode 100644 index 0000000..bdc86a5 --- /dev/null +++ b/system/libraries/Cache/drivers/Cache_memcached.php @@ -0,0 +1,313 @@ + array( + 'host' => '127.0.0.1', + 'port' => 11211, + 'weight' => 1 + ) + ); + + // ------------------------------------------------------------------------ + + /** + * Class constructor + * + * Setup Memcache(d) + * + * @return void + */ + public function __construct() + { + // Try to load memcached server info from the config file. + $CI =& get_instance(); + $defaults = $this->_config['default']; + + if ($CI->config->load('memcached', TRUE, TRUE)) + { + $this->_config = $CI->config->config['memcached']; + } + + if (class_exists('Memcached', FALSE)) + { + $this->_memcached = new Memcached(); + } + elseif (class_exists('Memcache', FALSE)) + { + $this->_memcached = new Memcache(); + } + else + { + log_message('error', 'Cache: Failed to create Memcache(d) object; extension not loaded?'); + return; + } + + foreach ($this->_config as $cache_server) + { + isset($cache_server['hostname']) OR $cache_server['hostname'] = $defaults['host']; + isset($cache_server['port']) OR $cache_server['port'] = $defaults['port']; + isset($cache_server['weight']) OR $cache_server['weight'] = $defaults['weight']; + + if ($this->_memcached instanceof Memcache) + { + // Third parameter is persistence and defaults to TRUE. + $this->_memcached->addServer( + $cache_server['hostname'], + $cache_server['port'], + TRUE, + $cache_server['weight'] + ); + } + elseif ($this->_memcached instanceof Memcached) + { + $this->_memcached->addServer( + $cache_server['hostname'], + $cache_server['port'], + $cache_server['weight'] + ); + } + } + } + + // ------------------------------------------------------------------------ + + /** + * Fetch from cache + * + * @param string $id Cache ID + * @return mixed Data on success, FALSE on failure + */ + public function get($id) + { + $data = $this->_memcached->get($id); + + return is_array($data) ? $data[0] : $data; + } + + // ------------------------------------------------------------------------ + + /** + * Save + * + * @param string $id Cache ID + * @param mixed $data Data being cached + * @param int $ttl Time to live + * @param bool $raw Whether to store the raw value + * @return bool TRUE on success, FALSE on failure + */ + public function save($id, $data, $ttl = 60, $raw = FALSE) + { + if ($raw !== TRUE) + { + $data = array($data, time(), $ttl); + } + + if ($this->_memcached instanceof Memcached) + { + return $this->_memcached->set($id, $data, $ttl); + } + elseif ($this->_memcached instanceof Memcache) + { + return $this->_memcached->set($id, $data, 0, $ttl); + } + + return FALSE; + } + + // ------------------------------------------------------------------------ + + /** + * Delete from Cache + * + * @param mixed $id key to be deleted. + * @return bool true on success, false on failure + */ + public function delete($id) + { + return $this->_memcached->delete($id); + } + + // ------------------------------------------------------------------------ + + /** + * Increment a raw value + * + * @param string $id Cache ID + * @param int $offset Step/value to add + * @return mixed New value on success or FALSE on failure + */ + public function increment($id, $offset = 1) + { + if (($result = $this->_memcached->increment($id, $offset)) === FALSE) + { + return $this->_memcached->add($id, $offset) ? $offset : FALSE; + } + + return $result; + } + + // ------------------------------------------------------------------------ + + /** + * Decrement a raw value + * + * @param string $id Cache ID + * @param int $offset Step/value to reduce by + * @return mixed New value on success or FALSE on failure + */ + public function decrement($id, $offset = 1) + { + if (($result = $this->_memcached->decrement($id, $offset)) === FALSE) + { + return $this->_memcached->add($id, 0) ? 0 : FALSE; + } + + return $result; + } + + // ------------------------------------------------------------------------ + + /** + * Clean the Cache + * + * @return bool false on failure/true on success + */ + public function clean() + { + return $this->_memcached->flush(); + } + + // ------------------------------------------------------------------------ + + /** + * Cache Info + * + * @return mixed array on success, false on failure + */ + public function cache_info() + { + return $this->_memcached->getStats(); + } + + // ------------------------------------------------------------------------ + + /** + * Get Cache Metadata + * + * @param mixed $id key to get cache metadata on + * @return mixed FALSE on failure, array on success. + */ + public function get_metadata($id) + { + $stored = $this->_memcached->get($id); + + if (count($stored) !== 3) + { + return FALSE; + } + + list($data, $time, $ttl) = $stored; + + return array( + 'expire' => $time + $ttl, + 'mtime' => $time, + 'data' => $data + ); + } + + // ------------------------------------------------------------------------ + + /** + * Is supported + * + * Returns FALSE if memcached is not supported on the system. + * If it is, we setup the memcached object & return TRUE + * + * @return bool + */ + public function is_supported() + { + return (extension_loaded('memcached') OR extension_loaded('memcache')); + } + + // ------------------------------------------------------------------------ + + /** + * Class destructor + * + * Closes the connection to Memcache(d) if present. + * + * @return void + */ + public function __destruct() + { + if ($this->_memcached instanceof Memcache) + { + $this->_memcached->close(); + } + elseif ($this->_memcached instanceof Memcached && method_exists($this->_memcached, 'quit')) + { + $this->_memcached->quit(); + } + } +} diff --git a/system/libraries/Cache/drivers/Cache_redis.php b/system/libraries/Cache/drivers/Cache_redis.php new file mode 100644 index 0000000..bff96fb --- /dev/null +++ b/system/libraries/Cache/drivers/Cache_redis.php @@ -0,0 +1,330 @@ + + * @link + */ +class CI_Cache_redis extends CI_Driver +{ + /** + * Default config + * + * @static + * @var array + */ + protected static $_default_config = array( + 'socket_type' => 'tcp', + 'host' => '127.0.0.1', + 'password' => NULL, + 'port' => 6379, + 'timeout' => 0 + ); + + /** + * Redis connection + * + * @var Redis + */ + protected $_redis; + + /** + * An internal cache for storing keys of serialized values. + * + * @var array + */ + protected $_serialized = array(); + + /** + * del()/delete() method name depending on phpRedis version + * + * @var string + */ + protected static $_delete_name; + + // ------------------------------------------------------------------------ + + /** + * Class constructor + * + * Setup Redis + * + * Loads Redis config file if present. Will halt execution + * if a Redis connection can't be established. + * + * @return void + * @see Redis::connect() + */ + public function __construct() + { + if ( ! $this->is_supported()) + { + log_message('error', 'Cache: Failed to create Redis object; extension not loaded?'); + return; + } + + isset(static::$_delete_name) OR static::$_delete_name = version_compare(phpversion('phpredis'), '5', '>=') + ? 'del' + : 'delete'; + + $CI =& get_instance(); + + if ($CI->config->load('redis', TRUE, TRUE)) + { + $config = array_merge(self::$_default_config, $CI->config->item('redis')); + } + else + { + $config = self::$_default_config; + } + + $this->_redis = new Redis(); + + try + { + if ($config['socket_type'] === 'unix') + { + $success = $this->_redis->connect($config['socket']); + } + else // tcp socket + { + $success = $this->_redis->connect($config['host'], $config['port'], $config['timeout']); + } + + if ( ! $success) + { + log_message('error', 'Cache: Redis connection failed. Check your configuration.'); + } + + if (isset($config['password']) && ! $this->_redis->auth($config['password'])) + { + log_message('error', 'Cache: Redis authentication failed.'); + } + } + catch (RedisException $e) + { + log_message('error', 'Cache: Redis connection refused ('.$e->getMessage().')'); + } + } + + // ------------------------------------------------------------------------ + + /** + * Get cache + * + * @param string $key Cache ID + * @return mixed + */ + public function get($key) + { + $value = $this->_redis->get($key); + + if ($value !== FALSE && $this->_redis->sIsMember('_ci_redis_serialized', $key)) + { + return unserialize($value); + } + + return $value; + } + + // ------------------------------------------------------------------------ + + /** + * Save cache + * + * @param string $id Cache ID + * @param mixed $data Data to save + * @param int $ttl Time to live in seconds + * @param bool $raw Whether to store the raw value (unused) + * @return bool TRUE on success, FALSE on failure + */ + public function save($id, $data, $ttl = 60, $raw = FALSE) + { + if (is_array($data) OR is_object($data)) + { + if ( ! $this->_redis->sIsMember('_ci_redis_serialized', $id) && ! $this->_redis->sAdd('_ci_redis_serialized', $id)) + { + return FALSE; + } + + isset($this->_serialized[$id]) OR $this->_serialized[$id] = TRUE; + $data = serialize($data); + } + else + { + $this->_redis->sRemove('_ci_redis_serialized', $id); + } + + return $this->_redis->set($id, $data, $ttl); + } + + // ------------------------------------------------------------------------ + + /** + * Delete from cache + * + * @param string $key Cache key + * @return bool + */ + public function delete($key) + { + if ($this->_redis->{static::$_delete_name}($key) !== 1) + { + return FALSE; + } + + $this->_redis->sRemove('_ci_redis_serialized', $key); + + return TRUE; + } + + // ------------------------------------------------------------------------ + + /** + * Increment a raw value + * + * @param string $id Cache ID + * @param int $offset Step/value to add + * @return mixed New value on success or FALSE on failure + */ + public function increment($id, $offset = 1) + { + return $this->_redis->incrBy($id, $offset); + } + + // ------------------------------------------------------------------------ + + /** + * Decrement a raw value + * + * @param string $id Cache ID + * @param int $offset Step/value to reduce by + * @return mixed New value on success or FALSE on failure + */ + public function decrement($id, $offset = 1) + { + return $this->_redis->decrBy($id, $offset); + } + + // ------------------------------------------------------------------------ + + /** + * Clean cache + * + * @return bool + * @see Redis::flushDB() + */ + public function clean() + { + return $this->_redis->flushDB(); + } + + // ------------------------------------------------------------------------ + + /** + * Get cache driver info + * + * @param string $type Not supported in Redis. + * Only included in order to offer a + * consistent cache API. + * @return array + * @see Redis::info() + */ + public function cache_info($type = NULL) + { + return $this->_redis->info(); + } + + // ------------------------------------------------------------------------ + + /** + * Get cache metadata + * + * @param string $key Cache key + * @return array + */ + public function get_metadata($key) + { + $value = $this->get($key); + + if ($value !== FALSE) + { + return array( + 'expire' => time() + $this->_redis->ttl($key), + 'data' => $value + ); + } + + return FALSE; + } + + // ------------------------------------------------------------------------ + + /** + * Check if Redis driver is supported + * + * @return bool + */ + public function is_supported() + { + return extension_loaded('redis'); + } + + // ------------------------------------------------------------------------ + + /** + * Class destructor + * + * Closes the connection to Redis if present. + * + * @return void + */ + public function __destruct() + { + if ($this->_redis) + { + $this->_redis->close(); + } + } +} diff --git a/system/libraries/Cache/drivers/Cache_wincache.php b/system/libraries/Cache/drivers/Cache_wincache.php new file mode 100644 index 0000000..1feaa15 --- /dev/null +++ b/system/libraries/Cache/drivers/Cache_wincache.php @@ -0,0 +1,217 @@ +is_supported()) + { + log_message('error', 'Cache: Failed to initialize Wincache; extension not loaded/enabled?'); + } + } + + // ------------------------------------------------------------------------ + + /** + * Get + * + * Look for a value in the cache. If it exists, return the data, + * if not, return FALSE + * + * @param string $id Cache Ide + * @return mixed Value that is stored/FALSE on failure + */ + public function get($id) + { + $success = FALSE; + $data = wincache_ucache_get($id, $success); + + // Success returned by reference from wincache_ucache_get() + return ($success) ? $data : FALSE; + } + + // ------------------------------------------------------------------------ + + /** + * Cache Save + * + * @param string $id Cache ID + * @param mixed $data Data to store + * @param int $ttl Time to live (in seconds) + * @param bool $raw Whether to store the raw value (unused) + * @return bool true on success/false on failure + */ + public function save($id, $data, $ttl = 60, $raw = FALSE) + { + return wincache_ucache_set($id, $data, $ttl); + } + + // ------------------------------------------------------------------------ + + /** + * Delete from Cache + * + * @param mixed unique identifier of the item in the cache + * @return bool true on success/false on failure + */ + public function delete($id) + { + return wincache_ucache_delete($id); + } + + // ------------------------------------------------------------------------ + + /** + * Increment a raw value + * + * @param string $id Cache ID + * @param int $offset Step/value to add + * @return mixed New value on success or FALSE on failure + */ + public function increment($id, $offset = 1) + { + $success = FALSE; + $value = wincache_ucache_inc($id, $offset, $success); + + return ($success === TRUE) ? $value : FALSE; + } + + // ------------------------------------------------------------------------ + + /** + * Decrement a raw value + * + * @param string $id Cache ID + * @param int $offset Step/value to reduce by + * @return mixed New value on success or FALSE on failure + */ + public function decrement($id, $offset = 1) + { + $success = FALSE; + $value = wincache_ucache_dec($id, $offset, $success); + + return ($success === TRUE) ? $value : FALSE; + } + + // ------------------------------------------------------------------------ + + /** + * Clean the cache + * + * @return bool false on failure/true on success + */ + public function clean() + { + return wincache_ucache_clear(); + } + + // ------------------------------------------------------------------------ + + /** + * Cache Info + * + * @return mixed array on success, false on failure + */ + public function cache_info() + { + return wincache_ucache_info(TRUE); + } + + // ------------------------------------------------------------------------ + + /** + * Get Cache Metadata + * + * @param mixed key to get cache metadata on + * @return mixed array on success/false on failure + */ + public function get_metadata($id) + { + if ($stored = wincache_ucache_info(FALSE, $id)) + { + $age = $stored['ucache_entries'][1]['age_seconds']; + $ttl = $stored['ucache_entries'][1]['ttl_seconds']; + $hitcount = $stored['ucache_entries'][1]['hitcount']; + + return array( + 'expire' => $ttl - $age, + 'hitcount' => $hitcount, + 'age' => $age, + 'ttl' => $ttl + ); + } + + return FALSE; + } + + // ------------------------------------------------------------------------ + + /** + * is_supported() + * + * Check to see if WinCache is available on this system, bail if it isn't. + * + * @return bool + */ + public function is_supported() + { + return (extension_loaded('wincache') && ini_get('wincache.ucenabled')); + } +} diff --git a/system/libraries/Cache/drivers/index.html b/system/libraries/Cache/drivers/index.html new file mode 100644 index 0000000..b702fbc --- /dev/null +++ b/system/libraries/Cache/drivers/index.html @@ -0,0 +1,11 @@ + + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + diff --git a/system/libraries/Cache/index.html b/system/libraries/Cache/index.html new file mode 100644 index 0000000..b702fbc --- /dev/null +++ b/system/libraries/Cache/index.html @@ -0,0 +1,11 @@ + + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + diff --git a/system/libraries/Calendar.php b/system/libraries/Calendar.php new file mode 100644 index 0000000..a6bdae5 --- /dev/null +++ b/system/libraries/Calendar.php @@ -0,0 +1,546 @@ +CI =& get_instance(); + $this->CI->lang->load('calendar'); + + empty($config) OR $this->initialize($config); + + log_message('info', 'Calendar Class Initialized'); + } + + // -------------------------------------------------------------------- + + /** + * Initialize the user preferences + * + * Accepts an associative array as input, containing display preferences + * + * @param array config preferences + * @return CI_Calendar + */ + public function initialize($config = array()) + { + foreach ($config as $key => $val) + { + if (isset($this->$key)) + { + $this->$key = $val; + } + } + + // Set the next_prev_url to the controller if required but not defined + if ($this->show_next_prev === TRUE && empty($this->next_prev_url)) + { + $this->next_prev_url = $this->CI->config->site_url($this->CI->router->class.'/'.$this->CI->router->method); + } + + return $this; + } + + // -------------------------------------------------------------------- + + /** + * Generate the calendar + * + * @param int the year + * @param int the month + * @param array the data to be shown in the calendar cells + * @return string + */ + public function generate($year = '', $month = '', $data = array()) + { + $local_time = time(); + + // Set and validate the supplied month/year + if (empty($year)) + { + $year = date('Y', $local_time); + } + elseif (strlen($year) === 1) + { + $year = '200'.$year; + } + elseif (strlen($year) === 2) + { + $year = '20'.$year; + } + + if (empty($month)) + { + $month = date('m', $local_time); + } + elseif (strlen($month) === 1) + { + $month = '0'.$month; + } + + $adjusted_date = $this->adjust_date($month, $year); + + $month = $adjusted_date['month']; + $year = $adjusted_date['year']; + + // Determine the total days in the month + $total_days = $this->get_total_days($month, $year); + + // Set the starting day of the week + $start_days = array('sunday' => 0, 'monday' => 1, 'tuesday' => 2, 'wednesday' => 3, 'thursday' => 4, 'friday' => 5, 'saturday' => 6); + $start_day = isset($start_days[$this->start_day]) ? $start_days[$this->start_day] : 0; + + // Set the starting day number + $local_date = mktime(12, 0, 0, $month, 1, $year); + $date = getdate($local_date); + $day = $start_day + 1 - $date['wday']; + + while ($day > 1) + { + $day -= 7; + } + + // Set the current month/year/day + // We use this to determine the "today" date + $cur_year = date('Y', $local_time); + $cur_month = date('m', $local_time); + $cur_day = date('j', $local_time); + + $is_current_month = ($cur_year == $year && $cur_month == $month); + + // Generate the template data array + $this->parse_template(); + + // Begin building the calendar output + $out = $this->replacements['table_open']."\n\n".$this->replacements['heading_row_start']."\n"; + + // "previous" month link + if ($this->show_next_prev === TRUE) + { + // Add a trailing slash to the URL if needed + $this->next_prev_url = preg_replace('/(.+?)\/*$/', '\\1/', $this->next_prev_url); + + $adjusted_date = $this->adjust_date($month - 1, $year); + $out .= str_replace('{previous_url}', $this->next_prev_url.$adjusted_date['year'].'/'.$adjusted_date['month'], $this->replacements['heading_previous_cell'])."\n"; + } + + // Heading containing the month/year + $colspan = ($this->show_next_prev === TRUE) ? 5 : 7; + + $this->replacements['heading_title_cell'] = str_replace('{colspan}', $colspan, + str_replace('{heading}', $this->get_month_name($month).' '.$year, $this->replacements['heading_title_cell'])); + + $out .= $this->replacements['heading_title_cell']."\n"; + + // "next" month link + if ($this->show_next_prev === TRUE) + { + $adjusted_date = $this->adjust_date($month + 1, $year); + $out .= str_replace('{next_url}', $this->next_prev_url.$adjusted_date['year'].'/'.$adjusted_date['month'], $this->replacements['heading_next_cell']); + } + + $out .= "\n".$this->replacements['heading_row_end']."\n\n" + // Write the cells containing the days of the week + .$this->replacements['week_row_start']."\n"; + + $day_names = $this->get_day_names(); + + for ($i = 0; $i < 7; $i ++) + { + $out .= str_replace('{week_day}', $day_names[($start_day + $i) %7], $this->replacements['week_day_cell']); + } + + $out .= "\n".$this->replacements['week_row_end']."\n"; + + // Build the main body of the calendar + while ($day <= $total_days) + { + $out .= "\n".$this->replacements['cal_row_start']."\n"; + + for ($i = 0; $i < 7; $i++) + { + if ($day > 0 && $day <= $total_days) + { + $out .= ($is_current_month === TRUE && $day == $cur_day) ? $this->replacements['cal_cell_start_today'] : $this->replacements['cal_cell_start']; + + if (isset($data[$day])) + { + // Cells with content + $temp = ($is_current_month === TRUE && $day == $cur_day) ? + $this->replacements['cal_cell_content_today'] : $this->replacements['cal_cell_content']; + $out .= str_replace(array('{content}', '{day}'), array($data[$day], $day), $temp); + } + else + { + // Cells with no content + $temp = ($is_current_month === TRUE && $day == $cur_day) ? + $this->replacements['cal_cell_no_content_today'] : $this->replacements['cal_cell_no_content']; + $out .= str_replace('{day}', $day, $temp); + } + + $out .= ($is_current_month === TRUE && $day == $cur_day) ? $this->replacements['cal_cell_end_today'] : $this->replacements['cal_cell_end']; + } + elseif ($this->show_other_days === TRUE) + { + $out .= $this->replacements['cal_cell_start_other']; + + if ($day <= 0) + { + // Day of previous month + $prev_month = $this->adjust_date($month - 1, $year); + $prev_month_days = $this->get_total_days($prev_month['month'], $prev_month['year']); + $out .= str_replace('{day}', $prev_month_days + $day, $this->replacements['cal_cell_other']); + } + else + { + // Day of next month + $out .= str_replace('{day}', $day - $total_days, $this->replacements['cal_cell_other']); + } + + $out .= $this->replacements['cal_cell_end_other']; + } + else + { + // Blank cells + $out .= $this->replacements['cal_cell_start'].$this->replacements['cal_cell_blank'].$this->replacements['cal_cell_end']; + } + + $day++; + } + + $out .= "\n".$this->replacements['cal_row_end']."\n"; + } + + return $out .= "\n".$this->replacements['table_close']; + } + + // -------------------------------------------------------------------- + + /** + * Get Month Name + * + * Generates a textual month name based on the numeric + * month provided. + * + * @param int the month + * @return string + */ + public function get_month_name($month) + { + if ($this->month_type === 'short') + { + $month_names = array('01' => 'cal_jan', '02' => 'cal_feb', '03' => 'cal_mar', '04' => 'cal_apr', '05' => 'cal_may', '06' => 'cal_jun', '07' => 'cal_jul', '08' => 'cal_aug', '09' => 'cal_sep', '10' => 'cal_oct', '11' => 'cal_nov', '12' => 'cal_dec'); + } + else + { + $month_names = array('01' => 'cal_january', '02' => 'cal_february', '03' => 'cal_march', '04' => 'cal_april', '05' => 'cal_mayl', '06' => 'cal_june', '07' => 'cal_july', '08' => 'cal_august', '09' => 'cal_september', '10' => 'cal_october', '11' => 'cal_november', '12' => 'cal_december'); + } + + return ($this->CI->lang->line($month_names[$month]) === FALSE) + ? ucfirst(substr($month_names[$month], 4)) + : $this->CI->lang->line($month_names[$month]); + } + + // -------------------------------------------------------------------- + + /** + * Get Day Names + * + * Returns an array of day names (Sunday, Monday, etc.) based + * on the type. Options: long, short, abr + * + * @param string + * @return array + */ + public function get_day_names($day_type = '') + { + if ($day_type !== '') + { + $this->day_type = $day_type; + } + + if ($this->day_type === 'long') + { + $day_names = array('sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday'); + } + elseif ($this->day_type === 'short') + { + $day_names = array('sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat'); + } + else + { + $day_names = array('su', 'mo', 'tu', 'we', 'th', 'fr', 'sa'); + } + + $days = array(); + for ($i = 0, $c = count($day_names); $i < $c; $i++) + { + $days[] = ($this->CI->lang->line('cal_'.$day_names[$i]) === FALSE) ? ucfirst($day_names[$i]) : $this->CI->lang->line('cal_'.$day_names[$i]); + } + + return $days; + } + + // -------------------------------------------------------------------- + + /** + * Adjust Date + * + * This function makes sure that we have a valid month/year. + * For example, if you submit 13 as the month, the year will + * increment and the month will become January. + * + * @param int the month + * @param int the year + * @return array + */ + public function adjust_date($month, $year) + { + $date = array(); + + $date['month'] = $month; + $date['year'] = $year; + + while ($date['month'] > 12) + { + $date['month'] -= 12; + $date['year']++; + } + + while ($date['month'] <= 0) + { + $date['month'] += 12; + $date['year']--; + } + + if (strlen($date['month']) === 1) + { + $date['month'] = '0'.$date['month']; + } + + return $date; + } + + // -------------------------------------------------------------------- + + /** + * Total days in a given month + * + * @param int the month + * @param int the year + * @return int + */ + public function get_total_days($month, $year) + { + $this->CI->load->helper('date'); + return days_in_month($month, $year); + } + + // -------------------------------------------------------------------- + + /** + * Set Default Template Data + * + * This is used in the event that the user has not created their own template + * + * @return array + */ + public function default_template() + { + return array( + 'table_open' => '', + 'heading_row_start' => '', + 'heading_previous_cell' => '', + 'heading_title_cell' => '', + 'heading_next_cell' => '', + 'heading_row_end' => '', + 'week_row_start' => '', + 'week_day_cell' => '', + 'week_row_end' => '', + 'cal_row_start' => '', + 'cal_cell_start' => '', + 'cal_cell_end_today' => '', + 'cal_cell_end_other' => '', + 'cal_row_end' => '', + 'table_close' => '
<<{heading}>>
{week_day}
', + 'cal_cell_start_today' => '', + 'cal_cell_start_other' => '', + 'cal_cell_content' => '{day}', + 'cal_cell_content_today' => '{day}', + 'cal_cell_no_content' => '{day}', + 'cal_cell_no_content_today' => '{day}', + 'cal_cell_blank' => ' ', + 'cal_cell_other' => '{day}', + 'cal_cell_end' => '
' + ); + } + + // -------------------------------------------------------------------- + + /** + * Parse Template + * + * Harvests the data within the template {pseudo-variables} + * used to display the calendar + * + * @return CI_Calendar + */ + public function parse_template() + { + $this->replacements = $this->default_template(); + + if (empty($this->template)) + { + return $this; + } + + if (is_string($this->template)) + { + $today = array('cal_cell_start_today', 'cal_cell_content_today', 'cal_cell_no_content_today', 'cal_cell_end_today'); + + foreach (array('table_open', 'table_close', 'heading_row_start', 'heading_previous_cell', 'heading_title_cell', 'heading_next_cell', 'heading_row_end', 'week_row_start', 'week_day_cell', 'week_row_end', 'cal_row_start', 'cal_cell_start', 'cal_cell_content', 'cal_cell_no_content', 'cal_cell_blank', 'cal_cell_end', 'cal_row_end', 'cal_cell_start_today', 'cal_cell_content_today', 'cal_cell_no_content_today', 'cal_cell_end_today', 'cal_cell_start_other', 'cal_cell_other', 'cal_cell_end_other') as $val) + { + if (preg_match('/\{'.$val.'\}(.*?)\{\/'.$val.'\}/si', $this->template, $match)) + { + $this->replacements[$val] = $match[1]; + } + elseif (in_array($val, $today, TRUE)) + { + $this->replacements[$val] = $this->replacements[substr($val, 0, -6)]; + } + } + } + elseif (is_array($this->template)) + { + $this->replacements = array_merge($this->replacements, $this->template); + } + + return $this; + } + +} diff --git a/system/libraries/Cart.php b/system/libraries/Cart.php new file mode 100644 index 0000000..6a10775 --- /dev/null +++ b/system/libraries/Cart.php @@ -0,0 +1,567 @@ +CI =& get_instance(); + + // Are any config settings being passed manually? If so, set them + $config = is_array($params) ? $params : array(); + + // Load the Sessions class + $this->CI->load->driver('session', $config); + + // Grab the shopping cart array from the session table + $this->_cart_contents = $this->CI->session->userdata('cart_contents'); + if ($this->_cart_contents === NULL) + { + // No cart exists so we'll set some base values + $this->_cart_contents = array('cart_total' => 0, 'total_items' => 0); + } + + log_message('info', 'Cart Class Initialized'); + } + + // -------------------------------------------------------------------- + + /** + * Insert items into the cart and save it to the session table + * + * @param array + * @return bool + */ + public function insert($items = array()) + { + // Was any cart data passed? No? Bah... + if ( ! is_array($items) OR count($items) === 0) + { + log_message('error', 'The insert method must be passed an array containing data.'); + return FALSE; + } + + // You can either insert a single product using a one-dimensional array, + // or multiple products using a multi-dimensional one. The way we + // determine the array type is by looking for a required array key named "id" + // at the top level. If it's not found, we will assume it's a multi-dimensional array. + + $save_cart = FALSE; + if (isset($items['id'])) + { + if (($rowid = $this->_insert($items))) + { + $save_cart = TRUE; + } + } + else + { + foreach ($items as $val) + { + if (is_array($val) && isset($val['id'])) + { + if ($this->_insert($val)) + { + $save_cart = TRUE; + } + } + } + } + + // Save the cart data if the insert was successful + if ($save_cart === TRUE) + { + $this->_save_cart(); + return isset($rowid) ? $rowid : TRUE; + } + + return FALSE; + } + + // -------------------------------------------------------------------- + + /** + * Insert + * + * @param array + * @return bool + */ + protected function _insert($items = array()) + { + // Was any cart data passed? No? Bah... + if ( ! is_array($items) OR count($items) === 0) + { + log_message('error', 'The insert method must be passed an array containing data.'); + return FALSE; + } + + // -------------------------------------------------------------------- + + // Does the $items array contain an id, quantity, price, and name? These are required + if ( ! isset($items['id'], $items['qty'], $items['price'], $items['name'])) + { + log_message('error', 'The cart array must contain a product ID, quantity, price, and name.'); + return FALSE; + } + + // -------------------------------------------------------------------- + + // Prep the quantity. It can only be a number. Duh... also trim any leading zeros + $items['qty'] = (float) $items['qty']; + + // If the quantity is zero or blank there's nothing for us to do + if ($items['qty'] == 0) + { + return FALSE; + } + + // -------------------------------------------------------------------- + + // Validate the product ID. It can only be alpha-numeric, dashes, underscores or periods + // Not totally sure we should impose this rule, but it seems prudent to standardize IDs. + // Note: These can be user-specified by setting the $this->product_id_rules variable. + if ( ! preg_match('/^['.$this->product_id_rules.']+$/i', $items['id'])) + { + log_message('error', 'Invalid product ID. The product ID can only contain alpha-numeric characters, dashes, and underscores'); + return FALSE; + } + + // -------------------------------------------------------------------- + + // Validate the product name. It can only be alpha-numeric, dashes, underscores, colons or periods. + // Note: These can be user-specified by setting the $this->product_name_rules variable. + if ($this->product_name_safe && ! preg_match('/^['.$this->product_name_rules.']+$/i'.(UTF8_ENABLED ? 'u' : ''), $items['name'])) + { + log_message('error', 'An invalid name was submitted as the product name: '.$items['name'].' The name can only contain alpha-numeric characters, dashes, underscores, colons, and spaces'); + return FALSE; + } + + // -------------------------------------------------------------------- + + // Prep the price. Remove leading zeros and anything that isn't a number or decimal point. + $items['price'] = (float) $items['price']; + + // We now need to create a unique identifier for the item being inserted into the cart. + // Every time something is added to the cart it is stored in the master cart array. + // Each row in the cart array, however, must have a unique index that identifies not only + // a particular product, but makes it possible to store identical products with different options. + // For example, what if someone buys two identical t-shirts (same product ID), but in + // different sizes? The product ID (and other attributes, like the name) will be identical for + // both sizes because it's the same shirt. The only difference will be the size. + // Internally, we need to treat identical submissions, but with different options, as a unique product. + // Our solution is to convert the options array to a string and MD5 it along with the product ID. + // This becomes the unique "row ID" + if (isset($items['options']) && count($items['options']) > 0) + { + $rowid = md5($items['id'].serialize($items['options'])); + } + else + { + // No options were submitted so we simply MD5 the product ID. + // Technically, we don't need to MD5 the ID in this case, but it makes + // sense to standardize the format of array indexes for both conditions + $rowid = md5($items['id']); + } + + // -------------------------------------------------------------------- + + // Now that we have our unique "row ID", we'll add our cart items to the master array + // grab quantity if it's already there and add it on + $old_quantity = isset($this->_cart_contents[$rowid]['qty']) ? (int) $this->_cart_contents[$rowid]['qty'] : 0; + + // Re-create the entry, just to make sure our index contains only the data from this submission + $items['rowid'] = $rowid; + $items['qty'] += $old_quantity; + $this->_cart_contents[$rowid] = $items; + + return $rowid; + } + + // -------------------------------------------------------------------- + + /** + * Update the cart + * + * This function permits the quantity of a given item to be changed. + * Typically it is called from the "view cart" page if a user makes + * changes to the quantity before checkout. That array must contain the + * product ID and quantity for each item. + * + * @param array + * @return bool + */ + public function update($items = array()) + { + // Was any cart data passed? + if ( ! is_array($items) OR count($items) === 0) + { + return FALSE; + } + + // You can either update a single product using a one-dimensional array, + // or multiple products using a multi-dimensional one. The way we + // determine the array type is by looking for a required array key named "rowid". + // If it's not found we assume it's a multi-dimensional array + $save_cart = FALSE; + if (isset($items['rowid'])) + { + if ($this->_update($items) === TRUE) + { + $save_cart = TRUE; + } + } + else + { + foreach ($items as $val) + { + if (is_array($val) && isset($val['rowid'])) + { + if ($this->_update($val) === TRUE) + { + $save_cart = TRUE; + } + } + } + } + + // Save the cart data if the insert was successful + if ($save_cart === TRUE) + { + $this->_save_cart(); + return TRUE; + } + + return FALSE; + } + + // -------------------------------------------------------------------- + + /** + * Update the cart + * + * This function permits changing item properties. + * Typically it is called from the "view cart" page if a user makes + * changes to the quantity before checkout. That array must contain the + * rowid and quantity for each item. + * + * @param array + * @return bool + */ + protected function _update($items = array()) + { + // Without these array indexes there is nothing we can do + if ( ! isset($items['rowid'], $this->_cart_contents[$items['rowid']])) + { + return FALSE; + } + + // Prep the quantity + if (isset($items['qty'])) + { + $items['qty'] = (float) $items['qty']; + // Is the quantity zero? If so we will remove the item from the cart. + // If the quantity is greater than zero we are updating + if ($items['qty'] == 0) + { + unset($this->_cart_contents[$items['rowid']]); + return TRUE; + } + } + + // find updatable keys + $keys = array_intersect(array_keys($this->_cart_contents[$items['rowid']]), array_keys($items)); + // if a price was passed, make sure it contains valid data + if (isset($items['price'])) + { + $items['price'] = (float) $items['price']; + } + + // product id & name shouldn't be changed + foreach (array_diff($keys, array('id', 'name')) as $key) + { + $this->_cart_contents[$items['rowid']][$key] = $items[$key]; + } + + return TRUE; + } + + // -------------------------------------------------------------------- + + /** + * Save the cart array to the session DB + * + * @return bool + */ + protected function _save_cart() + { + // Let's add up the individual prices and set the cart sub-total + $this->_cart_contents['total_items'] = $this->_cart_contents['cart_total'] = 0; + foreach ($this->_cart_contents as $key => $val) + { + // We make sure the array contains the proper indexes + if ( ! is_array($val) OR ! isset($val['price'], $val['qty'])) + { + continue; + } + + $this->_cart_contents['cart_total'] += ($val['price'] * $val['qty']); + $this->_cart_contents['total_items'] += $val['qty']; + $this->_cart_contents[$key]['subtotal'] = ($this->_cart_contents[$key]['price'] * $this->_cart_contents[$key]['qty']); + } + + // Is our cart empty? If so we delete it from the session + if (count($this->_cart_contents) <= 2) + { + $this->CI->session->unset_userdata('cart_contents'); + + // Nothing more to do... coffee time! + return FALSE; + } + + // If we made it this far it means that our cart has data. + // Let's pass it to the Session class so it can be stored + $this->CI->session->set_userdata(array('cart_contents' => $this->_cart_contents)); + + // Woot! + return TRUE; + } + + // -------------------------------------------------------------------- + + /** + * Cart Total + * + * @return int + */ + public function total() + { + return $this->_cart_contents['cart_total']; + } + + // -------------------------------------------------------------------- + + /** + * Remove Item + * + * Removes an item from the cart + * + * @param int + * @return bool + */ + public function remove($rowid) + { + // unset & save + unset($this->_cart_contents[$rowid]); + $this->_save_cart(); + return TRUE; + } + + // -------------------------------------------------------------------- + + /** + * Total Items + * + * Returns the total item count + * + * @return int + */ + public function total_items() + { + return $this->_cart_contents['total_items']; + } + + // -------------------------------------------------------------------- + + /** + * Cart Contents + * + * Returns the entire cart array + * + * @param bool + * @return array + */ + public function contents($newest_first = FALSE) + { + // do we want the newest first? + $cart = ($newest_first) ? array_reverse($this->_cart_contents) : $this->_cart_contents; + + // Remove these so they don't create a problem when showing the cart table + unset($cart['total_items']); + unset($cart['cart_total']); + + return $cart; + } + + // -------------------------------------------------------------------- + + /** + * Get cart item + * + * Returns the details of a specific item in the cart + * + * @param string $row_id + * @return array + */ + public function get_item($row_id) + { + return (in_array($row_id, array('total_items', 'cart_total'), TRUE) OR ! isset($this->_cart_contents[$row_id])) + ? FALSE + : $this->_cart_contents[$row_id]; + } + + // -------------------------------------------------------------------- + + /** + * Has options + * + * Returns TRUE if the rowid passed to this function correlates to an item + * that has options associated with it. + * + * @param string $row_id = '' + * @return bool + */ + public function has_options($row_id = '') + { + return (isset($this->_cart_contents[$row_id]['options']) && count($this->_cart_contents[$row_id]['options']) !== 0); + } + + // -------------------------------------------------------------------- + + /** + * Product options + * + * Returns the an array of options, for a particular product row ID + * + * @param string $row_id = '' + * @return array + */ + public function product_options($row_id = '') + { + return isset($this->_cart_contents[$row_id]['options']) ? $this->_cart_contents[$row_id]['options'] : array(); + } + + // -------------------------------------------------------------------- + + /** + * Format Number + * + * Returns the supplied number with commas and a decimal point. + * + * @param float + * @return string + */ + public function format_number($n = '') + { + return ($n === '') ? '' : number_format( (float) $n, 2, '.', ','); + } + + // -------------------------------------------------------------------- + + /** + * Destroy the cart + * + * Empties the cart and kills the session + * + * @return void + */ + public function destroy() + { + $this->_cart_contents = array('cart_total' => 0, 'total_items' => 0); + $this->CI->session->unset_userdata('cart_contents'); + } + +} diff --git a/system/libraries/Driver.php b/system/libraries/Driver.php new file mode 100644 index 0000000..7e6cf4f --- /dev/null +++ b/system/libraries/Driver.php @@ -0,0 +1,342 @@ +load_driver($child); + } + + /** + * Load driver + * + * Separate load_driver call to support explicit driver load by library or user + * + * @param string Driver name (w/o parent prefix) + * @return object Child class + */ + public function load_driver($child) + { + // Get CodeIgniter instance and subclass prefix + $prefix = config_item('subclass_prefix'); + + if ( ! isset($this->lib_name)) + { + // Get library name without any prefix + $this->lib_name = str_replace(array('CI_', $prefix), '', get_class($this)); + } + + // The child will be prefixed with the parent lib + $child_name = $this->lib_name.'_'.$child; + + // See if requested child is a valid driver + if ( ! in_array($child, $this->valid_drivers)) + { + // The requested driver isn't valid! + $msg = 'Invalid driver requested: '.$child_name; + log_message('error', $msg); + show_error($msg); + } + + // Get package paths and filename case variations to search + $CI = get_instance(); + $paths = $CI->load->get_package_paths(TRUE); + + // Is there an extension? + $class_name = $prefix.$child_name; + $found = class_exists($class_name, FALSE); + if ( ! $found) + { + // Check for subclass file + foreach ($paths as $path) + { + // Does the file exist? + $file = $path.'libraries/'.$this->lib_name.'/drivers/'.$prefix.$child_name.'.php'; + if (file_exists($file)) + { + // Yes - require base class from BASEPATH + $basepath = BASEPATH.'libraries/'.$this->lib_name.'/drivers/'.$child_name.'.php'; + if ( ! file_exists($basepath)) + { + $msg = 'Unable to load the requested class: CI_'.$child_name; + log_message('error', $msg); + show_error($msg); + } + + // Include both sources and mark found + include_once($basepath); + include_once($file); + $found = TRUE; + break; + } + } + } + + // Do we need to search for the class? + if ( ! $found) + { + // Use standard class name + $class_name = 'CI_'.$child_name; + if ( ! class_exists($class_name, FALSE)) + { + // Check package paths + foreach ($paths as $path) + { + // Does the file exist? + $file = $path.'libraries/'.$this->lib_name.'/drivers/'.$child_name.'.php'; + if (file_exists($file)) + { + // Include source + include_once($file); + break; + } + } + } + } + + // Did we finally find the class? + if ( ! class_exists($class_name, FALSE)) + { + if (class_exists($child_name, FALSE)) + { + $class_name = $child_name; + } + else + { + $msg = 'Unable to load the requested driver: '.$class_name; + log_message('error', $msg); + show_error($msg); + } + } + + // Instantiate, decorate and add child + $obj = new $class_name(); + $obj->decorate($this); + $this->$child = $obj; + return $this->$child; + } + +} + +// -------------------------------------------------------------------------- + +/** + * CodeIgniter Driver Class + * + * This class enables you to create drivers for a Library based on the Driver Library. + * It handles the drivers' access to the parent library + * + * @package CodeIgniter + * @subpackage Libraries + * @category Libraries + * @author EllisLab Dev Team + * @link + */ +class CI_Driver { + + /** + * Instance of the parent class + * + * @var object + */ + protected $_parent; + + /** + * List of methods in the parent class + * + * @var array + */ + protected $_methods = array(); + + /** + * List of properties in the parent class + * + * @var array + */ + protected $_properties = array(); + + /** + * Array of methods and properties for the parent class(es) + * + * @static + * @var array + */ + protected static $_reflections = array(); + + /** + * Decorate + * + * Decorates the child with the parent driver lib's methods and properties + * + * @param object + * @return void + */ + public function decorate($parent) + { + $this->_parent = $parent; + + // Lock down attributes to what is defined in the class + // and speed up references in magic methods + + $class_name = get_class($parent); + + if ( ! isset(self::$_reflections[$class_name])) + { + $r = new ReflectionObject($parent); + + foreach ($r->getMethods() as $method) + { + if ($method->isPublic()) + { + $this->_methods[] = $method->getName(); + } + } + + foreach ($r->getProperties() as $prop) + { + if ($prop->isPublic()) + { + $this->_properties[] = $prop->getName(); + } + } + + self::$_reflections[$class_name] = array($this->_methods, $this->_properties); + } + else + { + list($this->_methods, $this->_properties) = self::$_reflections[$class_name]; + } + } + + // -------------------------------------------------------------------- + + /** + * __call magic method + * + * Handles access to the parent driver library's methods + * + * @param string + * @param array + * @return mixed + */ + public function __call($method, $args = array()) + { + if (in_array($method, $this->_methods)) + { + return call_user_func_array(array($this->_parent, $method), $args); + } + + throw new BadMethodCallException('No such method: '.$method.'()'); + } + + // -------------------------------------------------------------------- + + /** + * __get magic method + * + * Handles reading of the parent driver library's properties + * + * @param string + * @return mixed + */ + public function __get($var) + { + if (in_array($var, $this->_properties)) + { + return $this->_parent->$var; + } + } + + // -------------------------------------------------------------------- + + /** + * __set magic method + * + * Handles writing to the parent driver library's properties + * + * @param string + * @param array + * @return mixed + */ + public function __set($var, $val) + { + if (in_array($var, $this->_properties)) + { + $this->_parent->$var = $val; + } + } + +} diff --git a/system/libraries/Email.php b/system/libraries/Email.php new file mode 100644 index 0000000..10b7477 --- /dev/null +++ b/system/libraries/Email.php @@ -0,0 +1,2490 @@ + '1 (Highest)', + 2 => '2 (High)', + 3 => '3 (Normal)', + 4 => '4 (Low)', + 5 => '5 (Lowest)' + ); + + /** + * mbstring.func_overload flag + * + * @var bool + */ + protected static $func_overload; + + // -------------------------------------------------------------------- + + /** + * Constructor - Sets Email Preferences + * + * The constructor can be passed an array of config values + * + * @param array $config = array() + * @return void + */ + public function __construct(array $config = array()) + { + $this->charset = config_item('charset'); + $this->initialize($config); + $this->_safe_mode = ( ! is_php('5.4') && ini_get('safe_mode')); + + isset(self::$func_overload) OR self::$func_overload = (extension_loaded('mbstring') && ini_get('mbstring.func_overload')); + + log_message('info', 'Email Class Initialized'); + } + + // -------------------------------------------------------------------- + + /** + * Initialize preferences + * + * @param array $config + * @return CI_Email + */ + public function initialize(array $config = array()) + { + $this->clear(); + + foreach ($config as $key => $val) + { + if (isset($this->$key)) + { + $method = 'set_'.$key; + + if (method_exists($this, $method)) + { + $this->$method($val); + } + else + { + $this->$key = $val; + } + } + } + + $this->charset = strtoupper($this->charset); + $this->_smtp_auth = isset($this->smtp_user[0], $this->smtp_pass[0]); + + return $this; + } + + // -------------------------------------------------------------------- + + /** + * Initialize the Email Data + * + * @param bool + * @return CI_Email + */ + public function clear($clear_attachments = FALSE) + { + $this->_subject = ''; + $this->_body = ''; + $this->_finalbody = ''; + $this->_header_str = ''; + $this->_replyto_flag = FALSE; + $this->_recipients = array(); + $this->_cc_array = array(); + $this->_bcc_array = array(); + $this->_headers = array(); + $this->_debug_msg = array(); + + $this->set_header('Date', $this->_set_date()); + + if ($clear_attachments !== FALSE) + { + $this->_attachments = array(); + } + + return $this; + } + + // -------------------------------------------------------------------- + + /** + * Set FROM + * + * @param string $from + * @param string $name + * @param string $return_path = NULL Return-Path + * @return CI_Email + */ + public function from($from, $name = '', $return_path = NULL) + { + if (preg_match('/\<(.*)\>/', $from, $match)) + { + $from = $match[1]; + } + + if ($this->validate) + { + $this->validate_email($this->_str_to_array($from)); + if ($return_path) + { + $this->validate_email($this->_str_to_array($return_path)); + } + } + + // prepare the display name + if ($name !== '') + { + // only use Q encoding if there are characters that would require it + if ( ! preg_match('/[\200-\377]/', $name)) + { + // add slashes for non-printing characters, slashes, and double quotes, and surround it in double quotes + $name = '"'.addcslashes($name, "\0..\37\177'\"\\").'"'; + } + else + { + $name = $this->_prep_q_encoding($name); + } + } + + $this->set_header('From', $name.' <'.$from.'>'); + + isset($return_path) OR $return_path = $from; + $this->set_header('Return-Path', '<'.$return_path.'>'); + + return $this; + } + + // -------------------------------------------------------------------- + + /** + * Set Reply-to + * + * @param string + * @param string + * @return CI_Email + */ + public function reply_to($replyto, $name = '') + { + if (preg_match('/\<(.*)\>/', $replyto, $match)) + { + $replyto = $match[1]; + } + + if ($this->validate) + { + $this->validate_email($this->_str_to_array($replyto)); + } + + if ($name !== '') + { + // only use Q encoding if there are characters that would require it + if ( ! preg_match('/[\200-\377]/', $name)) + { + // add slashes for non-printing characters, slashes, and double quotes, and surround it in double quotes + $name = '"'.addcslashes($name, "\0..\37\177'\"\\").'"'; + } + else + { + $name = $this->_prep_q_encoding($name); + } + } + + $this->set_header('Reply-To', $name.' <'.$replyto.'>'); + $this->_replyto_flag = TRUE; + + return $this; + } + + // -------------------------------------------------------------------- + + /** + * Set Recipients + * + * @param string + * @return CI_Email + */ + public function to($to) + { + $to = $this->_str_to_array($to); + $to = $this->clean_email($to); + + if ($this->validate) + { + $this->validate_email($to); + } + + if ($this->_get_protocol() !== 'mail') + { + $this->set_header('To', implode(', ', $to)); + } + + $this->_recipients = $to; + + return $this; + } + + // -------------------------------------------------------------------- + + /** + * Set CC + * + * @param string + * @return CI_Email + */ + public function cc($cc) + { + $cc = $this->clean_email($this->_str_to_array($cc)); + + if ($this->validate) + { + $this->validate_email($cc); + } + + $this->set_header('Cc', implode(', ', $cc)); + + if ($this->_get_protocol() === 'smtp') + { + $this->_cc_array = $cc; + } + + return $this; + } + + // -------------------------------------------------------------------- + + /** + * Set BCC + * + * @param string + * @param string + * @return CI_Email + */ + public function bcc($bcc, $limit = '') + { + if ($limit !== '' && is_numeric($limit)) + { + $this->bcc_batch_mode = TRUE; + $this->bcc_batch_size = $limit; + } + + $bcc = $this->clean_email($this->_str_to_array($bcc)); + + if ($this->validate) + { + $this->validate_email($bcc); + } + + if ($this->_get_protocol() === 'smtp' OR ($this->bcc_batch_mode && count($bcc) > $this->bcc_batch_size)) + { + $this->_bcc_array = $bcc; + } + else + { + $this->set_header('Bcc', implode(', ', $bcc)); + } + + return $this; + } + + // -------------------------------------------------------------------- + + /** + * Set Email Subject + * + * @param string + * @return CI_Email + */ + public function subject($subject) + { + $subject = $this->_prep_q_encoding($subject); + $this->set_header('Subject', $subject); + return $this; + } + + // -------------------------------------------------------------------- + + /** + * Set Body + * + * @param string + * @return CI_Email + */ + public function message($body) + { + $this->_body = rtrim(str_replace("\r", '', $body)); + + /* strip slashes only if magic quotes is ON + if we do it with magic quotes OFF, it strips real, user-inputted chars. + + NOTE: In PHP 5.4 get_magic_quotes_gpc() will always return 0 and + it will probably not exist in future versions at all. + */ + if ( ! is_php('5.4') && get_magic_quotes_gpc()) + { + $this->_body = stripslashes($this->_body); + } + + return $this; + } + + // -------------------------------------------------------------------- + + /** + * Assign file attachments + * + * @param string $file Can be local path, URL or buffered content + * @param string $disposition = 'attachment' + * @param string $newname = NULL + * @param string $mime = '' + * @return CI_Email + */ + public function attach($file, $disposition = '', $newname = NULL, $mime = '') + { + if ($mime === '') + { + if (strpos($file, '://') === FALSE && ! file_exists($file)) + { + $this->_set_error_message('lang:email_attachment_missing', $file); + return FALSE; + } + + if ( ! $fp = @fopen($file, 'rb')) + { + $this->_set_error_message('lang:email_attachment_unreadable', $file); + return FALSE; + } + + $file_content = stream_get_contents($fp); + $mime = $this->_mime_types(pathinfo($file, PATHINFO_EXTENSION)); + fclose($fp); + } + else + { + $file_content =& $file; // buffered file + } + + $this->_attachments[] = array( + 'name' => array($file, $newname), + 'disposition' => empty($disposition) ? 'attachment' : $disposition, // Can also be 'inline' Not sure if it matters + 'type' => $mime, + 'content' => chunk_split(base64_encode($file_content)), + 'multipart' => 'mixed' + ); + + return $this; + } + + // -------------------------------------------------------------------- + + /** + * Set and return attachment Content-ID + * + * Useful for attached inline pictures + * + * @param string $filename + * @return string + */ + public function attachment_cid($filename) + { + for ($i = 0, $c = count($this->_attachments); $i < $c; $i++) + { + if ($this->_attachments[$i]['name'][0] === $filename) + { + $this->_attachments[$i]['multipart'] = 'related'; + $this->_attachments[$i]['cid'] = uniqid(basename($this->_attachments[$i]['name'][0]).'@'); + return $this->_attachments[$i]['cid']; + } + } + + return FALSE; + } + + // -------------------------------------------------------------------- + + /** + * Add a Header Item + * + * @param string + * @param string + * @return CI_Email + */ + public function set_header($header, $value) + { + $this->_headers[$header] = str_replace(array("\n", "\r"), '', $value); + return $this; + } + + // -------------------------------------------------------------------- + + /** + * Convert a String to an Array + * + * @param string + * @return array + */ + protected function _str_to_array($email) + { + if ( ! is_array($email)) + { + return (strpos($email, ',') !== FALSE) + ? preg_split('/[\s,]/', $email, -1, PREG_SPLIT_NO_EMPTY) + : (array) trim($email); + } + + return $email; + } + + // -------------------------------------------------------------------- + + /** + * Set Multipart Value + * + * @param string + * @return CI_Email + */ + public function set_alt_message($str) + { + $this->alt_message = (string) $str; + return $this; + } + + // -------------------------------------------------------------------- + + /** + * Set Mailtype + * + * @param string + * @return CI_Email + */ + public function set_mailtype($type = 'text') + { + $this->mailtype = ($type === 'html') ? 'html' : 'text'; + return $this; + } + + // -------------------------------------------------------------------- + + /** + * Set Wordwrap + * + * @param bool + * @return CI_Email + */ + public function set_wordwrap($wordwrap = TRUE) + { + $this->wordwrap = (bool) $wordwrap; + return $this; + } + + // -------------------------------------------------------------------- + + /** + * Set Protocol + * + * @param string + * @return CI_Email + */ + public function set_protocol($protocol = 'mail') + { + $this->protocol = in_array($protocol, $this->_protocols, TRUE) ? strtolower($protocol) : 'mail'; + return $this; + } + + // -------------------------------------------------------------------- + + /** + * Set Priority + * + * @param int + * @return CI_Email + */ + public function set_priority($n = 3) + { + $this->priority = preg_match('/^[1-5]$/', $n) ? (int) $n : 3; + return $this; + } + + // -------------------------------------------------------------------- + + /** + * Set Newline Character + * + * @param string + * @return CI_Email + */ + public function set_newline($newline = "\n") + { + $this->newline = in_array($newline, array("\n", "\r\n", "\r")) ? $newline : "\n"; + return $this; + } + + // -------------------------------------------------------------------- + + /** + * Set CRLF + * + * @param string + * @return CI_Email + */ + public function set_crlf($crlf = "\n") + { + $this->crlf = ($crlf !== "\n" && $crlf !== "\r\n" && $crlf !== "\r") ? "\n" : $crlf; + return $this; + } + + // -------------------------------------------------------------------- + + /** + * Get the Message ID + * + * @return string + */ + protected function _get_message_id() + { + $from = str_replace(array('>', '<'), '', $this->_headers['Return-Path']); + return '<'.uniqid('').strstr($from, '@').'>'; + } + + // -------------------------------------------------------------------- + + /** + * Get Mail Protocol + * + * @return mixed + */ + protected function _get_protocol() + { + $this->protocol = strtolower($this->protocol); + in_array($this->protocol, $this->_protocols, TRUE) OR $this->protocol = 'mail'; + return $this->protocol; + } + + // -------------------------------------------------------------------- + + /** + * Get Mail Encoding + * + * @return string + */ + protected function _get_encoding() + { + in_array($this->_encoding, $this->_bit_depths) OR $this->_encoding = '8bit'; + + foreach ($this->_base_charsets as $charset) + { + if (strpos($this->charset, $charset) === 0) + { + $this->_encoding = '7bit'; + } + } + + return $this->_encoding; + } + + // -------------------------------------------------------------------- + + /** + * Get content type (text/html/attachment) + * + * @return string + */ + protected function _get_content_type() + { + if ($this->mailtype === 'html') + { + return empty($this->_attachments) ? 'html' : 'html-attach'; + } + elseif ($this->mailtype === 'text' && ! empty($this->_attachments)) + { + return 'plain-attach'; + } + + return 'plain'; + } + + // -------------------------------------------------------------------- + + /** + * Set RFC 822 Date + * + * @return string + */ + protected function _set_date() + { + $timezone = date('Z'); + $operator = ($timezone[0] === '-') ? '-' : '+'; + $timezone = abs($timezone); + $timezone = floor($timezone/3600) * 100 + ($timezone % 3600) / 60; + + return sprintf('%s %s%04d', date('D, j M Y H:i:s'), $operator, $timezone); + } + + // -------------------------------------------------------------------- + + /** + * Mime message + * + * @return string + */ + protected function _get_mime_message() + { + return 'This is a multi-part message in MIME format.'.$this->newline.'Your email application may not support this format.'; + } + + // -------------------------------------------------------------------- + + /** + * Validate Email Address + * + * @param string + * @return bool + */ + public function validate_email($email) + { + if ( ! is_array($email)) + { + $this->_set_error_message('lang:email_must_be_array'); + return FALSE; + } + + foreach ($email as $val) + { + if ( ! $this->valid_email($val)) + { + $this->_set_error_message('lang:email_invalid_address', $val); + return FALSE; + } + } + + return TRUE; + } + + // -------------------------------------------------------------------- + + /** + * Email Validation + * + * @param string + * @return bool + */ + public function valid_email($email) + { + if (function_exists('idn_to_ascii') && strpos($email, '@')) + { + list($account, $domain) = explode('@', $email, 2); + $domain = defined('INTL_IDNA_VARIANT_UTS46') + ? idn_to_ascii($domain, 0, INTL_IDNA_VARIANT_UTS46) + : idn_to_ascii($domain); + + if ($domain !== FALSE) + { + $email = $account.'@'.$domain; + } + } + + return (bool) filter_var($email, FILTER_VALIDATE_EMAIL); + } + + // -------------------------------------------------------------------- + + /** + * Clean Extended Email Address: Joe Smith + * + * @param string + * @return string + */ + public function clean_email($email) + { + if ( ! is_array($email)) + { + return preg_match('/\<(.*)\>/', $email, $match) ? $match[1] : $email; + } + + $clean_email = array(); + + foreach ($email as $addy) + { + $clean_email[] = preg_match('/\<(.*)\>/', $addy, $match) ? $match[1] : $addy; + } + + return $clean_email; + } + + // -------------------------------------------------------------------- + + /** + * Build alternative plain text message + * + * Provides the raw message for use in plain-text headers of + * HTML-formatted emails. + * If the user hasn't specified his own alternative message + * it creates one by stripping the HTML + * + * @return string + */ + protected function _get_alt_message() + { + if ( ! empty($this->alt_message)) + { + return ($this->wordwrap) + ? $this->word_wrap($this->alt_message, 76) + : $this->alt_message; + } + + $body = preg_match('/\(.*)\<\/body\>/si', $this->_body, $match) ? $match[1] : $this->_body; + $body = str_replace("\t", '', preg_replace('#\n"; + } + + return $r; + } + + // -------------------------------------------------------------------- + + /** + * Executes the Method + * + * @param object + * @return mixed + */ + protected function _execute($m) + { + $methName = $m->method_name; + + // Check to see if it is a system call + $system_call = (strpos($methName, 'system') === 0); + + if ($this->xss_clean === FALSE) + { + $m->xss_clean = FALSE; + } + + //------------------------------------- + // Valid Method + //------------------------------------- + + if ( ! isset($this->methods[$methName]['function'])) + { + return new XML_RPC_Response(0, $this->xmlrpcerr['unknown_method'], $this->xmlrpcstr['unknown_method']); + } + + //------------------------------------- + // Check for Method (and Object) + //------------------------------------- + + $method_parts = explode('.', $this->methods[$methName]['function']); + $objectCall = ! empty($method_parts[1]); + + if ($system_call === TRUE) + { + if ( ! is_callable(array($this, $method_parts[1]))) + { + return new XML_RPC_Response(0, $this->xmlrpcerr['unknown_method'], $this->xmlrpcstr['unknown_method']); + } + } + elseif (($objectCall && ! is_callable(array($method_parts[0], $method_parts[1]))) + OR ( ! $objectCall && ! is_callable($this->methods[$methName]['function'])) + ) + { + return new XML_RPC_Response(0, $this->xmlrpcerr['unknown_method'], $this->xmlrpcstr['unknown_method']); + } + + //------------------------------------- + // Checking Methods Signature + //------------------------------------- + + if (isset($this->methods[$methName]['signature'])) + { + $sig = $this->methods[$methName]['signature']; + for ($i = 0, $c = count($sig); $i < $c; $i++) + { + $current_sig = $sig[$i]; + + if (count($current_sig) === count($m->params)+1) + { + for ($n = 0, $mc = count($m->params); $n < $mc; $n++) + { + $p = $m->params[$n]; + $pt = ($p->kindOf() === 'scalar') ? $p->scalarval() : $p->kindOf(); + + if ($pt !== $current_sig[$n+1]) + { + $pno = $n+1; + $wanted = $current_sig[$n+1]; + + return new XML_RPC_Response(0, + $this->xmlrpcerr['incorrect_params'], + $this->xmlrpcstr['incorrect_params'] . + ': Wanted '.$wanted.', got '.$pt.' at param '.$pno.')'); + } + } + } + } + } + + //------------------------------------- + // Calls the Function + //------------------------------------- + + if ($objectCall === TRUE) + { + if ($method_parts[0] === 'this' && $system_call === TRUE) + { + return call_user_func(array($this, $method_parts[1]), $m); + } + elseif ($this->object === FALSE) + { + return get_instance()->{$method_parts[1]}($m); + } + + return $this->object->{$method_parts[1]}($m); + } + + return call_user_func($this->methods[$methName]['function'], $m); + } + + // -------------------------------------------------------------------- + + /** + * Server Function: List Methods + * + * @param mixed + * @return object + */ + public function listMethods($m) + { + $v = new XML_RPC_Values(); + $output = array(); + + foreach ($this->methods as $key => $value) + { + $output[] = new XML_RPC_Values($key, 'string'); + } + + foreach ($this->system_methods as $key => $value) + { + $output[] = new XML_RPC_Values($key, 'string'); + } + + $v->addArray($output); + return new XML_RPC_Response($v); + } + + // -------------------------------------------------------------------- + + /** + * Server Function: Return Signature for Method + * + * @param mixed + * @return object + */ + public function methodSignature($m) + { + $parameters = $m->output_parameters(); + $method_name = $parameters[0]; + + if (isset($this->methods[$method_name])) + { + if ($this->methods[$method_name]['signature']) + { + $sigs = array(); + $signature = $this->methods[$method_name]['signature']; + + for ($i = 0, $c = count($signature); $i < $c; $i++) + { + $cursig = array(); + $inSig = $signature[$i]; + for ($j = 0, $jc = count($inSig); $j < $jc; $j++) + { + $cursig[]= new XML_RPC_Values($inSig[$j], 'string'); + } + $sigs[] = new XML_RPC_Values($cursig, 'array'); + } + + return new XML_RPC_Response(new XML_RPC_Values($sigs, 'array')); + } + + return new XML_RPC_Response(new XML_RPC_Values('undef', 'string')); + } + + return new XML_RPC_Response(0, $this->xmlrpcerr['introspect_unknown'], $this->xmlrpcstr['introspect_unknown']); + } + + // -------------------------------------------------------------------- + + /** + * Server Function: Doc String for Method + * + * @param mixed + * @return object + */ + public function methodHelp($m) + { + $parameters = $m->output_parameters(); + $method_name = $parameters[0]; + + if (isset($this->methods[$method_name])) + { + $docstring = isset($this->methods[$method_name]['docstring']) ? $this->methods[$method_name]['docstring'] : ''; + + return new XML_RPC_Response(new XML_RPC_Values($docstring, 'string')); + } + + return new XML_RPC_Response(0, $this->xmlrpcerr['introspect_unknown'], $this->xmlrpcstr['introspect_unknown']); + } + + // -------------------------------------------------------------------- + + /** + * Server Function: Multi-call + * + * @param mixed + * @return object + */ + public function multicall($m) + { + // Disabled + return new XML_RPC_Response(0, $this->xmlrpcerr['unknown_method'], $this->xmlrpcstr['unknown_method']); + + $parameters = $m->output_parameters(); + $calls = $parameters[0]; + + $result = array(); + + foreach ($calls as $value) + { + $m = new XML_RPC_Message($value[0]); + $plist = ''; + + for ($i = 0, $c = count($value[1]); $i < $c; $i++) + { + $m->addParam(new XML_RPC_Values($value[1][$i], 'string')); + } + + $attempt = $this->_execute($m); + + if ($attempt->faultCode() !== 0) + { + return $attempt; + } + + $result[] = new XML_RPC_Values(array($attempt->value()), 'array'); + } + + return new XML_RPC_Response(new XML_RPC_Values($result, 'array')); + } + + // -------------------------------------------------------------------- + + /** + * Multi-call Function: Error Handling + * + * @param mixed + * @return object + */ + public function multicall_error($err) + { + $str = is_string($err) ? $this->xmlrpcstr["multicall_${err}"] : $err->faultString(); + $code = is_string($err) ? $this->xmlrpcerr["multicall_${err}"] : $err->faultCode(); + + $struct['faultCode'] = new XML_RPC_Values($code, 'int'); + $struct['faultString'] = new XML_RPC_Values($str, 'string'); + + return new XML_RPC_Values($struct, 'struct'); + } + + // -------------------------------------------------------------------- + + /** + * Multi-call Function: Processes method + * + * @param mixed + * @return object + */ + public function do_multicall($call) + { + if ($call->kindOf() !== 'struct') + { + return $this->multicall_error('notstruct'); + } + elseif ( ! $methName = $call->me['struct']['methodName']) + { + return $this->multicall_error('nomethod'); + } + + list($scalar_value, $scalar_type) = array(reset($methName->me), key($methName->me)); + $scalar_type = $scalar_type === $this->xmlrpcI4 ? $this->xmlrpcInt : $scalar_type; + + if ($methName->kindOf() !== 'scalar' OR $scalar_type !== 'string') + { + return $this->multicall_error('notstring'); + } + elseif ($scalar_value === 'system.multicall') + { + return $this->multicall_error('recursion'); + } + elseif ( ! $params = $call->me['struct']['params']) + { + return $this->multicall_error('noparams'); + } + elseif ($params->kindOf() !== 'array') + { + return $this->multicall_error('notarray'); + } + + list($b, $a) = array(reset($params->me), key($params->me)); + + $msg = new XML_RPC_Message($scalar_value); + for ($i = 0, $numParams = count($b); $i < $numParams; $i++) + { + $msg->params[] = $params->me['array'][$i]; + } + + $result = $this->_execute($msg); + + if ($result->faultCode() !== 0) + { + return $this->multicall_error($result); + } + + return new XML_RPC_Values(array($result->value()), 'array'); + } + +} diff --git a/system/libraries/Zip.php b/system/libraries/Zip.php new file mode 100644 index 0000000..c0a1402 --- /dev/null +++ b/system/libraries/Zip.php @@ -0,0 +1,532 @@ +now = time(); + log_message('info', 'Zip Compression Class Initialized'); + } + + // -------------------------------------------------------------------- + + /** + * Add Directory + * + * Lets you add a virtual directory into which you can place files. + * + * @param mixed $directory the directory name. Can be string or array + * @return void + */ + public function add_dir($directory) + { + foreach ((array) $directory as $dir) + { + if ( ! preg_match('|.+/$|', $dir)) + { + $dir .= '/'; + } + + $dir_time = $this->_get_mod_time($dir); + $this->_add_dir($dir, $dir_time['file_mtime'], $dir_time['file_mdate']); + } + } + + // -------------------------------------------------------------------- + + /** + * Get file/directory modification time + * + * If this is a newly created file/dir, we will set the time to 'now' + * + * @param string $dir path to file + * @return array filemtime/filemdate + */ + protected function _get_mod_time($dir) + { + // filemtime() may return false, but raises an error for non-existing files + $date = file_exists($dir) ? getdate(filemtime($dir)) : getdate($this->now); + + return array( + 'file_mtime' => ($date['hours'] << 11) + ($date['minutes'] << 5) + $date['seconds'] / 2, + 'file_mdate' => (($date['year'] - 1980) << 9) + ($date['mon'] << 5) + $date['mday'] + ); + } + + // -------------------------------------------------------------------- + + /** + * Add Directory + * + * @param string $dir the directory name + * @param int $file_mtime + * @param int $file_mdate + * @return void + */ + protected function _add_dir($dir, $file_mtime, $file_mdate) + { + $dir = str_replace('\\', '/', $dir); + + $this->zipdata .= + "\x50\x4b\x03\x04\x0a\x00\x00\x00\x00\x00" + .pack('v', $file_mtime) + .pack('v', $file_mdate) + .pack('V', 0) // crc32 + .pack('V', 0) // compressed filesize + .pack('V', 0) // uncompressed filesize + .pack('v', self::strlen($dir)) // length of pathname + .pack('v', 0) // extra field length + .$dir + // below is "data descriptor" segment + .pack('V', 0) // crc32 + .pack('V', 0) // compressed filesize + .pack('V', 0); // uncompressed filesize + + $this->directory .= + "\x50\x4b\x01\x02\x00\x00\x0a\x00\x00\x00\x00\x00" + .pack('v', $file_mtime) + .pack('v', $file_mdate) + .pack('V',0) // crc32 + .pack('V',0) // compressed filesize + .pack('V',0) // uncompressed filesize + .pack('v', self::strlen($dir)) // length of pathname + .pack('v', 0) // extra field length + .pack('v', 0) // file comment length + .pack('v', 0) // disk number start + .pack('v', 0) // internal file attributes + .pack('V', 16) // external file attributes - 'directory' bit set + .pack('V', $this->offset) // relative offset of local header + .$dir; + + $this->offset = self::strlen($this->zipdata); + $this->entries++; + } + + // -------------------------------------------------------------------- + + /** + * Add Data to Zip + * + * Lets you add files to the archive. If the path is included + * in the filename it will be placed within a directory. Make + * sure you use add_dir() first to create the folder. + * + * @param mixed $filepath A single filepath or an array of file => data pairs + * @param string $data Single file contents + * @return void + */ + public function add_data($filepath, $data = NULL) + { + if (is_array($filepath)) + { + foreach ($filepath as $path => $data) + { + $file_data = $this->_get_mod_time($path); + $this->_add_data($path, $data, $file_data['file_mtime'], $file_data['file_mdate']); + } + } + else + { + $file_data = $this->_get_mod_time($filepath); + $this->_add_data($filepath, $data, $file_data['file_mtime'], $file_data['file_mdate']); + } + } + + // -------------------------------------------------------------------- + + /** + * Add Data to Zip + * + * @param string $filepath the file name/path + * @param string $data the data to be encoded + * @param int $file_mtime + * @param int $file_mdate + * @return void + */ + protected function _add_data($filepath, $data, $file_mtime, $file_mdate) + { + $filepath = str_replace('\\', '/', $filepath); + + $uncompressed_size = self::strlen($data); + $crc32 = crc32($data); + $gzdata = self::substr(gzcompress($data, $this->compression_level), 2, -4); + $compressed_size = self::strlen($gzdata); + + $this->zipdata .= + "\x50\x4b\x03\x04\x14\x00\x00\x00\x08\x00" + .pack('v', $file_mtime) + .pack('v', $file_mdate) + .pack('V', $crc32) + .pack('V', $compressed_size) + .pack('V', $uncompressed_size) + .pack('v', self::strlen($filepath)) // length of filename + .pack('v', 0) // extra field length + .$filepath + .$gzdata; // "file data" segment + + $this->directory .= + "\x50\x4b\x01\x02\x00\x00\x14\x00\x00\x00\x08\x00" + .pack('v', $file_mtime) + .pack('v', $file_mdate) + .pack('V', $crc32) + .pack('V', $compressed_size) + .pack('V', $uncompressed_size) + .pack('v', self::strlen($filepath)) // length of filename + .pack('v', 0) // extra field length + .pack('v', 0) // file comment length + .pack('v', 0) // disk number start + .pack('v', 0) // internal file attributes + .pack('V', 32) // external file attributes - 'archive' bit set + .pack('V', $this->offset) // relative offset of local header + .$filepath; + + $this->offset = self::strlen($this->zipdata); + $this->entries++; + $this->file_num++; + } + + // -------------------------------------------------------------------- + + /** + * Read the contents of a file and add it to the zip + * + * @param string $path + * @param bool $archive_filepath + * @return bool + */ + public function read_file($path, $archive_filepath = FALSE) + { + if (file_exists($path) && FALSE !== ($data = file_get_contents($path))) + { + if (is_string($archive_filepath)) + { + $name = str_replace('\\', '/', $archive_filepath); + } + else + { + $name = str_replace('\\', '/', $path); + + if ($archive_filepath === FALSE) + { + $name = preg_replace('|.*/(.+)|', '\\1', $name); + } + } + + $this->add_data($name, $data); + return TRUE; + } + + return FALSE; + } + + // ------------------------------------------------------------------------ + + /** + * Read a directory and add it to the zip. + * + * This function recursively reads a folder and everything it contains (including + * sub-folders) and creates a zip based on it. Whatever directory structure + * is in the original file path will be recreated in the zip file. + * + * @param string $path path to source directory + * @param bool $preserve_filepath + * @param string $root_path + * @return bool + */ + public function read_dir($path, $preserve_filepath = TRUE, $root_path = NULL) + { + $path = rtrim($path, '/\\').DIRECTORY_SEPARATOR; + if ( ! $fp = @opendir($path)) + { + return FALSE; + } + + // Set the original directory root for child dir's to use as relative + if ($root_path === NULL) + { + $root_path = str_replace(array('\\', '/'), DIRECTORY_SEPARATOR, dirname($path)).DIRECTORY_SEPARATOR; + } + + while (FALSE !== ($file = readdir($fp))) + { + if ($file[0] === '.') + { + continue; + } + + if (is_dir($path.$file)) + { + $this->read_dir($path.$file.DIRECTORY_SEPARATOR, $preserve_filepath, $root_path); + } + elseif (FALSE !== ($data = file_get_contents($path.$file))) + { + $name = str_replace(array('\\', '/'), DIRECTORY_SEPARATOR, $path); + if ($preserve_filepath === FALSE) + { + $name = str_replace($root_path, '', $name); + } + + $this->add_data($name.$file, $data); + } + } + + closedir($fp); + return TRUE; + } + + // -------------------------------------------------------------------- + + /** + * Get the Zip file + * + * @return string (binary encoded) + */ + public function get_zip() + { + // Is there any data to return? + if ($this->entries === 0) + { + return FALSE; + } + + return $this->zipdata + .$this->directory."\x50\x4b\x05\x06\x00\x00\x00\x00" + .pack('v', $this->entries) // total # of entries "on this disk" + .pack('v', $this->entries) // total # of entries overall + .pack('V', self::strlen($this->directory)) // size of central dir + .pack('V', self::strlen($this->zipdata)) // offset to start of central dir + ."\x00\x00"; // .zip file comment length + } + + // -------------------------------------------------------------------- + + /** + * Write File to the specified directory + * + * Lets you write a file + * + * @param string $filepath the file name + * @return bool + */ + public function archive($filepath) + { + if ( ! ($fp = @fopen($filepath, 'w+b'))) + { + return FALSE; + } + + flock($fp, LOCK_EX); + + for ($result = $written = 0, $data = $this->get_zip(), $length = self::strlen($data); $written < $length; $written += $result) + { + if (($result = fwrite($fp, self::substr($data, $written))) === FALSE) + { + break; + } + } + + flock($fp, LOCK_UN); + fclose($fp); + + return is_int($result); + } + + // -------------------------------------------------------------------- + + /** + * Download + * + * @param string $filename the file name + * @return void + */ + public function download($filename = 'backup.zip') + { + if ( ! preg_match('|.+?\.zip$|', $filename)) + { + $filename .= '.zip'; + } + + get_instance()->load->helper('download'); + $get_zip = $this->get_zip(); + $zip_content =& $get_zip; + + force_download($filename, $zip_content); + } + + // -------------------------------------------------------------------- + + /** + * Initialize Data + * + * Lets you clear current zip data. Useful if you need to create + * multiple zips with different data. + * + * @return CI_Zip + */ + public function clear_data() + { + $this->zipdata = ''; + $this->directory = ''; + $this->entries = 0; + $this->file_num = 0; + $this->offset = 0; + return $this; + } + + // -------------------------------------------------------------------- + + /** + * Byte-safe strlen() + * + * @param string $str + * @return int + */ + protected static function strlen($str) + { + return (self::$func_overload) + ? mb_strlen($str, '8bit') + : strlen($str); + } + + // -------------------------------------------------------------------- + + /** + * Byte-safe substr() + * + * @param string $str + * @param int $start + * @param int $length + * @return string + */ + protected static function substr($str, $start, $length = NULL) + { + if (self::$func_overload) + { + // mb_substr($str, $start, null, '8bit') returns an empty + // string on PHP 5.3 + isset($length) OR $length = ($start >= 0 ? self::strlen($str) - $start : -$start); + return mb_substr($str, $start, $length, '8bit'); + } + + return isset($length) + ? substr($str, $start, $length) + : substr($str, $start); + } +} diff --git a/system/libraries/index.html b/system/libraries/index.html new file mode 100644 index 0000000..b702fbc --- /dev/null +++ b/system/libraries/index.html @@ -0,0 +1,11 @@ + + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + +