Initial commit, Ecard system build with CodeIgniter PHP framework

Currently working
- Basic structure
- Basic caching and gzip compression for speed
- Admin authentication
This commit is contained in:
Ismo Vuorinen
2013-07-11 07:42:03 +03:00
committed by Ismo Vuorinen
parent 345d8ea65a
commit c10c9e3131
206 changed files with 53864 additions and 0 deletions

1
application/.htaccess Normal file
View File

@@ -0,0 +1 @@
Deny from all

View File

@@ -0,0 +1,53 @@
<?php
if (empty($config)) {
$config = array();
}
/*
|--------------------------------------------------------------------------
| Processing assets
|--------------------------------------------------------------------------
|
| Flags for processing actions
|
*/
$config['assets']['minify_css'] = true;
$config['assets']['minify_js'] = true;
$config['assets']['enable_less'] = true;
$config['assets']['enable_coffeescript'] = true;
$config['assets']['freeze'] = false;
/*
|--------------------------------------------------------------------------
| Cache
|--------------------------------------------------------------------------
|
| Define if the cache folder should be cleared when generating new cache files
|
*/
$config['assets']['auto_clear_cache'] = true;
$config['assets']['auto_clear_css_cache'] = true;
$config['assets']['auto_clear_js_cache'] = true;
/*
|--------------------------------------------------------------------------
| Default paths and directories, tags
|--------------------------------------------------------------------------
|
| Leave the base_url at null on default
| Default directories containing the assets
| Option to use HTML5 tags
|
*/
$config['assets']['base_url'] = null;
$config['assets']['assets_dir'] = 'assets';
$config['assets']['js_dir'] = 'js';
$config['assets']['css_dir'] = false;
$config['assets']['cache_dir'] = 'cache';
$config['assets']['img_dir'] = 'img';
$config['assets']['html5'] = true;

View File

@@ -0,0 +1,127 @@
<?php
if (! defined('BASEPATH')) {
exit('No direct script access allowed');
}
/*
| -------------------------------------------------------------------
| AUTO-LOADER
| -------------------------------------------------------------------
| This file specifies which systems should be loaded by default.
|
| In order to keep the framework as light-weight as possible only the
| absolute minimal resources are loaded by default. For example,
| the database is not connected to automatically since no assumption
| is made regarding whether you intend to use it. This file lets
| you globally define which systems you would like loaded with every
| request.
|
| -------------------------------------------------------------------
| Instructions
| -------------------------------------------------------------------
|
| These are the things you can load automatically:
|
| 1. Packages
| 2. Libraries
| 3. Helper files
| 4. Custom config files
| 5. Language files
| 6. Models
|
*/
if (empty($autoload)) {
$autoload = array();
}
$autoload['sparks'] = array(
'assets/1.5.1'
);
/*
| -------------------------------------------------------------------
| Auto-load Packges
| -------------------------------------------------------------------
| Prototype:
|
| $autoload['packages'] = array(APPPATH.'third_party', '/usr/local/shared');
|
*/
$autoload['packages'] = array();
/*
| -------------------------------------------------------------------
| Auto-load Libraries
| -------------------------------------------------------------------
| These are the classes located in the system/libraries folder
| or in your application/libraries folder.
|
| Prototype:
|
| $autoload['libraries'] = array('database', 'session', 'xmlrpc');
*/
$autoload['libraries'] = array('database', 'session');
/*
| -------------------------------------------------------------------
| 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('model1', 'model2');
|
*/
$autoload['model'] = array();
/* End of file autoload.php */
/* Location: ./application/config/autoload.php */

View File

@@ -0,0 +1,370 @@
<?php
if (! defined('BASEPATH')) {
exit('No direct script access allowed');
}
if (empty($config)) {
$config = array();
}
/*
|--------------------------------------------------------------------------
| Base Site URL
|--------------------------------------------------------------------------
|
| URL to your CodeIgniter root. Typically this will be your base URL,
| WITH a trailing slash:
|
| http://example.com/
|
| If this is not set then CodeIgniter will guess the protocol, domain and
| path to your installation.
|
*/
$config['base_url'] = '';
/*
|--------------------------------------------------------------------------
| Index File
|--------------------------------------------------------------------------
|
| Typically this will be your index.php file, unless you've renamed it to
| something else. If you are using mod_rewrite to remove the page set this
| variable so that it is blank.
|
*/
$config['index_page'] = '';
/*
|--------------------------------------------------------------------------
| URI PROTOCOL
|--------------------------------------------------------------------------
|
| This item determines which server global should be used to retrieve the
| URI string. The default setting of 'AUTO' works for most servers.
| If your links do not seem to work, try one of the other delicious flavors:
|
| 'AUTO' Default - auto detects
| 'PATH_INFO' Uses the PATH_INFO
| 'QUERY_STRING' Uses the QUERY_STRING
| 'REQUEST_URI' Uses the REQUEST_URI
| 'ORIG_PATH_INFO' Uses the ORIG_PATH_INFO
|
*/
$config['uri_protocol'] = 'AUTO';
/*
|--------------------------------------------------------------------------
| URL suffix
|--------------------------------------------------------------------------
|
| This option allows you to add a suffix to all URLs generated by CodeIgniter.
| For more information please see the user guide:
|
| http://codeigniter.com/user_guide/general/urls.html
*/
$config['url_suffix'] = '';
/*
|--------------------------------------------------------------------------
| Default Language
|--------------------------------------------------------------------------
|
| This determines which set of language files should be used. Make sure
| there is an available translation if you intend to use something other
| than english.
|
*/
$config['language'] = 'english';
/*
|--------------------------------------------------------------------------
| Default Character Set
|--------------------------------------------------------------------------
|
| This determines which character set is used by default in various methods
| that require a character set to be provided.
|
*/
$config['charset'] = 'UTF-8';
/*
|--------------------------------------------------------------------------
| Enable/Disable System Hooks
|--------------------------------------------------------------------------
|
| If you would like to use the 'hooks' feature you must enable it by
| setting this variable to true (boolean). See the user guide for details.
|
*/
$config['enable_hooks'] = false;
/*
|--------------------------------------------------------------------------
| Class Extension Prefix
|--------------------------------------------------------------------------
|
| This item allows you to set the filename/classname prefix when extending
| native libraries. For more information please see the user guide:
|
| http://codeigniter.com/user_guide/general/core_classes.html
| http://codeigniter.com/user_guide/general/creating_libraries.html
|
*/
$config['subclass_prefix'] = 'MY_';
/*
|--------------------------------------------------------------------------
| Allowed URL Characters
|--------------------------------------------------------------------------
|
| This lets you specify with a regular expression which characters are permitted
| within your URLs. When someone tries to submit a URL with disallowed
| characters they will get a warning message.
|
| As a security measure you are STRONGLY encouraged to restrict URLs to
| as few characters as possible. By default only these are allowed: a-z 0-9~%.:_-
|
| Leave blank to allow all characters -- but only if you are insane.
|
| 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/
|
| 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.
|
| 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['allow_get_array'] = true;
$config['enable_query_strings'] = false;
$config['controller_trigger'] = 'c';
$config['function_trigger'] = 'm';
$config['directory_trigger'] = 'd'; // experimental not currently in use
/*
|--------------------------------------------------------------------------
| Error Logging Threshold
|--------------------------------------------------------------------------
|
| If you have enabled error logging, you can set an error threshold to
| determine what gets logged. Threshold options are:
| 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
|
| 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'] = 1;
/*
|--------------------------------------------------------------------------
| Error Logging Directory Path
|--------------------------------------------------------------------------
|
| Leave this BLANK unless you would like to set something other than the default
| application/logs/ folder. Use a full server path with trailing slash.
|
*/
$config['log_path'] = '';
/*
|--------------------------------------------------------------------------
| 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';
/*
|--------------------------------------------------------------------------
| Cache Directory Path
|--------------------------------------------------------------------------
|
| Leave this BLANK unless you would like to set something other than the default
| system/cache/ folder. Use a full server path with trailing slash.
|
*/
$config['cache_path'] = '';
/*
|--------------------------------------------------------------------------
| Encryption Key
|--------------------------------------------------------------------------
|
| If you use the Encryption class or the Session class you
| MUST set an encryption key. See the user guide for info.
|
*/
$config['encryption_key'] = '';
/*
|--------------------------------------------------------------------------
| Session Variables
|--------------------------------------------------------------------------
|
| 'sess_cookie_name' = the name you want for the cookie
| 'sess_expiration' = the number of SECONDS you want the session to last.
| by default sessions last 7200 seconds (two hours). Set to zero for no expiration.
| 'sess_expire_on_close' = Whether to cause the session to expire automatically
| when the browser window is closed
| 'sess_encrypt_cookie' = Whether to encrypt the cookie
| 'sess_use_database' = Whether to save the session data to a database
| 'sess_table_name' = The name of the session database table
| 'sess_match_ip' = Whether to match the user's IP address when reading the session data
| 'sess_match_useragent' = Whether to match the User Agent when reading the session data
| 'sess_time_to_update' = how many seconds between CI refreshing Session Information
|
*/
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 7200;
$config['sess_expire_on_close'] = false;
$config['sess_encrypt_cookie'] = false;
$config['sess_use_database'] = false;
$config['sess_table_name'] = 'ci_sessions';
$config['sess_match_ip'] = false;
$config['sess_match_useragent'] = true;
$config['sess_time_to_update'] = 300;
/*
|--------------------------------------------------------------------------
| Cookie Related Variables
|--------------------------------------------------------------------------
|
| 'cookie_prefix' = Set a 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' = Cookies will only be set if a secure HTTPS connection exists.
|
*/
$config['cookie_prefix'] = "";
$config['cookie_domain'] = "";
$config['cookie_path'] = "/";
$config['cookie_secure'] = false;
/*
|--------------------------------------------------------------------------
| Global XSS Filtering
|--------------------------------------------------------------------------
|
| Determines whether the XSS filter is always active when GET, POST or
| COOKIE data is encountered
|
*/
$config['global_xss_filtering'] = true;
/*
|--------------------------------------------------------------------------
| 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.
*/
$config['csrf_protection'] = false;
$config['csrf_token_name'] = 'csrf_test_name';
$config['csrf_cookie_name'] = 'csrf_cookie_name';
$config['csrf_expire'] = 7200;
/*
|--------------------------------------------------------------------------
| 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.
|
| 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 'gmt'. This pref tells the system whether to use
| your server's local time as the master 'now' reference, or convert it to
| GMT. 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)
|
*/
$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 the HTTP_X_FORWARDED_FOR
| header in order to properly identify the visitor's IP address.
| Comma-delimited, e.g. '10.0.1.200,10.0.1.201'
|
*/
$config['proxy_ips'] = '';
/* End of file config.php */
/* Location: ./application/config/config.php */

View File

@@ -0,0 +1,41 @@
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*
|--------------------------------------------------------------------------
| File and Directory Modes
|--------------------------------------------------------------------------
|
| These prefs are used when checking and setting modes when working
| with the file system. The defaults are fine on servers with proper
| security, but you may wish (or even need) to change the values in
| certain environments (Apache running a separate process for each
| user, PHP under CGI with Apache suEXEC, etc.). Octal values should
| always be used to set the mode correctly.
|
*/
define('FILE_READ_MODE', 0644);
define('FILE_WRITE_MODE', 0666);
define('DIR_READ_MODE', 0755);
define('DIR_WRITE_MODE', 0777);
/*
|--------------------------------------------------------------------------
| File Stream Modes
|--------------------------------------------------------------------------
|
| These modes are used when working with fopen()/popen()
|
*/
define('FOPEN_READ', 'rb');
define('FOPEN_READ_WRITE', 'r+b');
define('FOPEN_WRITE_CREATE_DESTRUCTIVE', 'wb'); // truncates existing file data, use with care
define('FOPEN_READ_WRITE_CREATE_DESTRUCTIVE', 'w+b'); // truncates existing file data, use with care
define('FOPEN_WRITE_CREATE', 'ab');
define('FOPEN_READ_WRITE_CREATE', 'a+b');
define('FOPEN_WRITE_CREATE_STRICT', 'xb');
define('FOPEN_READ_WRITE_CREATE_STRICT', 'x+b');
/* End of file constants.php */
/* Location: ./application/config/constants.php */

View File

@@ -0,0 +1,69 @@
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*
| -------------------------------------------------------------------
| DATABASE CONNECTIVITY SETTINGS
| -------------------------------------------------------------------
| This file will contain the settings needed to access your database.
|
| For complete instructions please consult the 'Database Connection'
| page of the User Guide.
|
| -------------------------------------------------------------------
| EXPLANATION OF VARIABLES
| -------------------------------------------------------------------
|
| ['hostname'] The hostname of your database server.
| ['username'] The username used to connect to the database
| ['password'] The password used to connect to the database
| ['database'] The name of the database you want to connect to
| ['dbdriver'] The database type. ie: mysql. Currently supported:
mysql, mysqli, postgre, odbc, mssql, sqlite, oci8
| ['dbprefix'] You can add an optional prefix, which will be added
| to the table name when using the Active Record class
| ['pconnect'] TRUE/FALSE - Whether to use a persistent connection
| ['db_debug'] TRUE/FALSE - Whether database errors should be displayed.
| ['cache_on'] TRUE/FALSE - Enables/disables query caching
| ['cachedir'] The path to the folder where cache files should be stored
| ['char_set'] The character set used in communicating with the database
| ['dbcollat'] The character collation used in communicating with the database
| NOTE: For MySQL and MySQLi databases, this setting is only used
| as a backup if your server is running PHP < 5.2.3 or MySQL < 5.0.7
| (and in table creation queries made with DB Forge).
| There is an incompatibility in PHP with mysql_real_escape_string() which
| can make your site vulnerable to SQL injection if you are using a
| multi-byte character set and are running versions lower than these.
| Sites using Latin-1 or UTF-8 database character set and collation are unaffected.
| ['swap_pre'] A default table prefix that should be swapped with the dbprefix
| ['autoinit'] Whether or not to automatically initialize the database.
| ['stricton'] TRUE/FALSE - forces 'Strict Mode' connections
| - good for ensuring strict SQL while developing
|
| The $active_group variable lets you choose which connection group to
| make active. By default there is only one group (the 'default' group).
|
| The $active_record variables lets you determine whether or not to load
| the active record class
*/
$db = array();
$active_group = 'default';
$active_record = TRUE;
$db['default']['hostname'] = 'localhost';
$db['default']['username'] = '';
$db['default']['password'] = '';
$db['default']['database'] = 'ekokumppanit';
$db['default']['dbdriver'] = 'mysql';
$db['default']['dbprefix'] = 'ystavakyla_';
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = '';
$db['default']['char_set'] = 'utf8';
$db['default']['dbcollat'] = 'utf8_general_ci';
$db['default']['swap_pre'] = '';
$db['default']['autoinit'] = TRUE;
$db['default']['stricton'] = FALSE;
/* End of file database.php */
/* Location: ./application/config/database.php */

View File

@@ -0,0 +1,15 @@
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
$_doctypes = array(
'xhtml11' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">',
'xhtml1-strict' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">',
'xhtml1-trans' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">',
'xhtml1-frame' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">',
'html5' => '<!DOCTYPE html>',
'html4-strict' => '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">',
'html4-trans' => '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">',
'html4-frame' => '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">'
);
/* End of file doctypes.php */
/* Location: ./application/config/doctypes.php */

View File

@@ -0,0 +1,64 @@
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*
| -------------------------------------------------------------------
| Foreign Characters
| -------------------------------------------------------------------
| This file contains an array of foreign characters for transliteration
| conversion used by the Text helper
|
*/
$foreign_characters = array(
'/ä|æ|ǽ/' => 'ae',
'/ö|œ/' => 'oe',
'/ü/' => 'ue',
'/Ä/' => 'Ae',
'/Ü/' => 'Ue',
'/Ö/' => 'Oe',
'/À|Á|Â|Ã|Ä|Å|Ǻ|Ā|Ă|Ą|Ǎ/' => 'A',
'/à|á|â|ã|å|ǻ|ā|ă|ą|ǎ|ª/' => 'a',
'/Ç|Ć|Ĉ|Ċ|Č/' => 'C',
'/ç|ć|ĉ|ċ|č/' => 'c',
'/Ð|Ď|Đ/' => 'D',
'/ð|ď|đ/' => 'd',
'/È|É|Ê|Ë|Ē|Ĕ|Ė|Ę|Ě/' => 'E',
'/è|é|ê|ë|ē|ĕ|ė|ę|ě/' => 'e',
'/Ĝ|Ğ|Ġ|Ģ/' => 'G',
'/ĝ|ğ|ġ|ģ/' => 'g',
'/Ĥ|Ħ/' => 'H',
'/ĥ|ħ/' => 'h',
'/Ì|Í|Î|Ï|Ĩ|Ī|Ĭ|Ǐ|Į|İ/' => 'I',
'/ì|í|î|ï|ĩ|ī|ĭ|ǐ|į|ı/' => 'i',
'/Ĵ/' => 'J',
'/ĵ/' => 'j',
'/Ķ/' => 'K',
'/ķ/' => 'k',
'/Ĺ|Ļ|Ľ|Ŀ|Ł/' => 'L',
'/ĺ|ļ|ľ|ŀ|ł/' => 'l',
'/Ñ|Ń|Ņ|Ň/' => 'N',
'/ñ|ń|ņ|ň|ʼn/' => 'n',
'/Ò|Ó|Ô|Õ|Ō|Ŏ|Ǒ|Ő|Ơ|Ø|Ǿ/' => 'O',
'/ò|ó|ô|õ|ō|ŏ|ǒ|ő|ơ|ø|ǿ|º/' => 'o',
'/Ŕ|Ŗ|Ř/' => 'R',
'/ŕ|ŗ|ř/' => 'r',
'/Ś|Ŝ|Ş|Š/' => 'S',
'/ś|ŝ|ş|š|ſ/' => 's',
'/Ţ|Ť|Ŧ/' => 'T',
'/ţ|ť|ŧ/' => 't',
'/Ù|Ú|Û|Ũ|Ū|Ŭ|Ů|Ű|Ų|Ư|Ǔ|Ǖ|Ǘ|Ǚ|Ǜ/' => 'U',
'/ù|ú|û|ũ|ū|ŭ|ů|ű|ų|ư|ǔ|ǖ|ǘ|ǚ|ǜ/' => 'u',
'/Ý|Ÿ|Ŷ/' => 'Y',
'/ý|ÿ|ŷ/' => 'y',
'/Ŵ/' => 'W',
'/ŵ/' => 'w',
'/Ź|Ż|Ž/' => 'Z',
'/ź|ż|ž/' => 'z',
'/Æ|Ǽ/' => 'AE',
'/ß/'=> 'ss',
'/IJ/' => 'IJ',
'/ij/' => 'ij',
'/Œ/' => 'OE',
'/ƒ/' => 'f'
);
/* End of file foreign_chars.php */
/* Location: ./application/config/foreign_chars.php */

View File

@@ -0,0 +1,16 @@
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*
| -------------------------------------------------------------------------
| Hooks
| -------------------------------------------------------------------------
| This file lets you define "hooks" to extend CI without hacking the core
| files. Please see the user guide for info:
|
| http://codeigniter.com/user_guide/general/hooks.html
|
*/
/* End of file hooks.php */
/* Location: ./application/config/hooks.php */

View File

@@ -0,0 +1,10 @@
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

View File

@@ -0,0 +1,41 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
/*
|--------------------------------------------------------------------------
| Enable/Disable Migrations
|--------------------------------------------------------------------------
|
| Migrations are disabled by default but should be enabled
| whenever you intend to do a schema migration.
|
*/
$config['migration_enabled'] = FALSE;
/*
|--------------------------------------------------------------------------
| Migrations version
|--------------------------------------------------------------------------
|
| This is used to set migration version that the file system should be on.
| If you run $this->migration->latest() this is the version that schema will
| be upgraded / downgraded to.
|
*/
$config['migration_version'] = 1;
/*
|--------------------------------------------------------------------------
| 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/';
/* End of file migration.php */
/* Location: ./application/config/migration.php */

View File

@@ -0,0 +1,106 @@
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*
| -------------------------------------------------------------------
| MIME TYPES
| -------------------------------------------------------------------
| This file contains an array of mime types. It is used by the
| Upload class to help identify allowed file types.
|
*/
$mimes = array( 'hqx' => 'application/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'),
'bin' => 'application/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' => 'application/x-photoshop',
'so' => 'application/octet-stream',
'sea' => 'application/octet-stream',
'dll' => 'application/octet-stream',
'oda' => 'application/oda',
'pdf' => array('application/pdf', 'application/x-download'),
'ai' => 'application/postscript',
'eps' => 'application/postscript',
'ps' => 'application/postscript',
'smi' => 'application/smil',
'smil' => 'application/smil',
'mif' => 'application/vnd.mif',
'xls' => array('application/excel', 'application/vnd.ms-excel', 'application/msexcel'),
'ppt' => array('application/powerpoint', 'application/vnd.ms-powerpoint'),
'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',
'php' => 'application/x-httpd-php',
'php4' => 'application/x-httpd-php',
'php3' => 'application/x-httpd-php',
'phtml' => 'application/x-httpd-php',
'phps' => 'application/x-httpd-php-source',
'js' => 'application/x-javascript',
'swf' => 'application/x-shockwave-flash',
'sit' => 'application/x-stuffit',
'tar' => 'application/x-tar',
'tgz' => array('application/x-tar', 'application/x-gzip-compressed'),
'xhtml' => 'application/xhtml+xml',
'xht' => 'application/xhtml+xml',
'zip' => array('application/x-zip', 'application/zip', 'application/x-zip-compressed'),
'mid' => 'audio/midi',
'midi' => 'audio/midi',
'mpga' => 'audio/mpeg',
'mp2' => 'audio/mpeg',
'mp3' => array('audio/mpeg', 'audio/mpg', 'audio/mpeg3', 'audio/mp3'),
'aif' => 'audio/x-aiff',
'aiff' => 'audio/x-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-windows-bmp'),
'gif' => 'image/gif',
'jpeg' => array('image/jpeg', 'image/pjpeg'),
'jpg' => array('image/jpeg', 'image/pjpeg'),
'jpe' => array('image/jpeg', 'image/pjpeg'),
'png' => array('image/png', 'image/x-png'),
'tiff' => 'image/tiff',
'tif' => 'image/tiff',
'css' => 'text/css',
'html' => 'text/html',
'htm' => 'text/html',
'shtml' => 'text/html',
'txt' => 'text/plain',
'text' => 'text/plain',
'log' => array('text/plain', 'text/x-log'),
'rtx' => 'text/richtext',
'rtf' => 'text/rtf',
'xml' => 'text/xml',
'xsl' => 'text/xml',
'mpeg' => 'video/mpeg',
'mpg' => 'video/mpeg',
'mpe' => 'video/mpeg',
'qt' => 'video/quicktime',
'mov' => 'video/quicktime',
'avi' => 'video/x-msvideo',
'movie' => 'video/x-sgi-movie',
'doc' => 'application/msword',
'docx' => array('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/zip'),
'xlsx' => array('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'application/zip'),
'word' => array('application/msword', 'application/octet-stream'),
'xl' => 'application/excel',
'eml' => 'message/rfc822',
'json' => array('application/json', 'text/json')
);
/* End of file mimes.php */
/* Location: ./application/config/mimes.php */

View File

@@ -0,0 +1,17 @@
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*
| -------------------------------------------------------------------------
| Profiler Sections
| -------------------------------------------------------------------------
| This file lets you determine whether or not various sections of Profiler
| data are displayed when the Profiler is enabled.
| Please see the user guide for info:
|
| http://codeigniter.com/user_guide/general/profiling.html
|
*/
/* End of file profiler.php */
/* Location: ./application/config/profiler.php */

View File

@@ -0,0 +1,58 @@
<?php
if (! defined('BASEPATH')) {
exit('No direct script access allowed');
}
/*
| -------------------------------------------------------------------------
| URI ROUTING
| -------------------------------------------------------------------------
| This file lets you re-map URI requests to specific controller functions.
|
| Typically there is a one-to-one relationship between a URL string
| and its corresponding controller class/method. The segments in a
| URL normally follow this pattern:
|
| example.com/class/method/id/
|
| In some instances, however, you may want to remap this relationship
| so that a different class/function is called than the one
| corresponding to the URL.
|
| Please see the user guide for complete details:
|
| http://codeigniter.com/user_guide/general/routing.html
|
| -------------------------------------------------------------------------
| RESERVED ROUTES
| -------------------------------------------------------------------------
|
| There area two reserved routes:
|
| $route['default_controller'] = 'welcome';
|
| This route indicates which controller class should be loaded if the
| URI contains no data. In the above example, the "welcome" class
| would be loaded.
|
| $route['404_override'] = 'errors/page_missing';
|
| This route will tell the Router what URI segments to use if those provided
| in the URL cannot be matched to a valid route.
|
*/
if (empty($route)) {
$route = array();
}
$route['default_controller'] = "welcome";
$route['404_override'] = 'error404';
$route['uusi'] = $route['default_controller']."/newCard";
$route['kaikki'] = $route['default_controller']."/ecards";
$route['ecards'] = $route['default_controller']."/ecards";
$route['ecards/(:any)'] = $route['default_controller']."/ecards/$1";
$route['info'] = $route['default_controller']."/info";
/* End of file routes.php */
/* Location: ./application/config/routes.php */

View File

@@ -0,0 +1,66 @@
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*
| -------------------------------------------------------------------
| SMILEYS
| -------------------------------------------------------------------
| This file contains an array of smileys for use with the emoticon helper.
| Individual images can be used to replace multiple simileys. For example:
| :-) and :) use the same image replacement.
|
| Please see user guide for more info:
| http://codeigniter.com/user_guide/helpers/smiley_helper.html
|
*/
$smileys = array(
// smiley image name width height alt
':-)' => 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', 'excaim'),
':question:' => array('question.gif', '19', '19', 'question') // no comma after last item
);
/* End of file smileys.php */
/* Location: ./application/config/smileys.php */

View File

@@ -0,0 +1,178 @@
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*
| -------------------------------------------------------------------
| USER AGENT TYPES
| -------------------------------------------------------------------
| This file contains four arrays of user agent data. It is used by the
| User Agent Class to help identify browser, platform, robot, and
| mobile device data. The array keys are used to identify the device
| and the array values are used to set the actual name of the item.
|
*/
$platforms = array (
'windows nt 6.0' => 'Windows Longhorn',
'windows nt 5.2' => 'Windows 2003',
'windows nt 5.0' => 'Windows 2000',
'windows nt 5.1' => 'Windows XP',
'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' => 'Unknown Windows OS',
'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'
);
// 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(
'Flock' => 'Flock',
'Chrome' => 'Chrome',
'Opera' => 'Opera',
'MSIE' => 'Internet Explorer',
'Internet Explorer' => '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'
);
$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",
'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",
'hiptop' => "Danger Hiptop",
'nec-' => "NEC",
'panasonic' => "Panasonic",
'philips' => "Philips",
'sagem' => "Sagem",
'sanyo' => "Sanyo",
'spv' => "SPV",
'zte' => "ZTE",
'sendo' => "Sendo",
// Operating Systems
'symbian' => "Symbian",
'SymbianOS' => "SymbianOS",
'elaine' => "Palm",
'palm' => "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",
// 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',
'slurp' => 'Inktomi Slurp',
'yahoo' => 'Yahoo',
'askjeeves' => 'AskJeeves',
'fastcrawler' => 'FastCrawler',
'infoseek' => 'InfoSeek Robot 1.0',
'lycos' => 'Lycos'
);
/* End of file user_agents.php */
/* Location: ./application/config/user_agents.php */

View File

@@ -0,0 +1,10 @@
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

View File

@@ -0,0 +1,107 @@
<?php
class Welcome extends CI_Controller
{
public function __construct()
{
parent::__construct();
$this->load->model('ecard_model', 'ecard');
}
public function index()
{
$data = array(
'page_title' => array( 'Etusivu', 'Ystäväkylä eKortti' ),
'page_classes' => array( 'frontpage' )
);
$this->load->view('_header', $data);
$this->load->view('welcome_message', $data);
$this->load->view('_footer', $data);
}
public function info()
{
$data = array(
'page_title' => array( 'Tietoa', 'Ystäväkylä eKortti' ),
'page_classes' => array( 'info' )
);
$this->load->view('_header', $data);
$this->load->view('info', $data);
$this->load->view('_footer', $data);
}
public function newCard()
{
$data = array(
'page_title' => array( 'Uusi eKortti', 'Ystäväkylä eKortti' ),
'page_classes' => array( 'new_card' ),
'images' => array(
"http://placekitten.com/800/550",
"http://placekitten.com/g/800/550",
"http://placekitten.com/800/551",
"http://placekitten.com/g/800/551",
"http://placekitten.com/800/552",
"http://placekitten.com/g/800/552"
)
);
$this->load->view('_header', $data);
$this->load->view('new', $data);
$this->load->view('_footer', $data);
}
public function ecards($card_id = null)
{
$data = array(
'page_classes' => array( 'ecards' )
);
if (empty($card_id)) {
$data['ecards'] = $this->ecard->get_all();
$data['page_title'] = array( 'Listaa kaikki kortit', 'Ystäväkylä eKortti' );
$data['page_classes'][] = 'show_all';
$this->load->view('_header', $data);
$this->load->view('show_all', $data);
$this->load->view('_footer', $data);
} else {
if (strlen($card_id) != 32) {
redirect("ecards");
}
$data['ecard'] = $this->ecard->get_by('hash', $card_id);
$data['page_title'] = array( 'eKortti', 'Ystäväkylä eKortti' );
if (empty($data['ecard'])) {
$data['ecard'] = new stdClass();
$data['ecard']->id = $card_id;
$data['ecard']->response = "error";
$data['ecard']->response_text = "No card found with that id";
}
$data['page_classes'][] = 'show_one';
$this->load->view('_header', $data);
$this->load->view('show_one', $data);
$this->load->view('_footer', $data);
}
# code...
}
public function upload()
{
# code...
}
}
/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */

View File

@@ -0,0 +1,107 @@
<?php
class Yllapito extends CI_Controller
{
private $user;
public function __construct()
{
parent::__construct();
$this->load->model('ecard_model', 'ecard');
$this->load->model('erkanaauth_model', 'erkana');
$this->user = $this->erkana->getUser();
}
public function index()
{
if (empty($this->user)) {
redirect("/yllapito/kirjaudu");
}
$data = array(
'page_title' => array( 'Etusivu', 'Ystäväkylä eKortti' ),
'page_classes' => array( 'frontpage' ),
'user' => $this->user,
'messages' => $this->session->flashdata('messages')
);
$this->load->view('_header', $data);
$this->load->view('yllapito/dashboard', $data);
$this->load->view('_footer', $data);
}
public function kirjaudu()
{
// POST
$login = $this->input->post();
if ($login) {
$user = $this->input->post('username');
$pass = $this->input->post('password');
// Hash the password
$pass = $this->passwordhash($pass);
$test = array(
'username' => $user,
'password' => $pass // Hashed password
);
$this->erkana->try_login($test);
if (($user = $this->erkana->getUser())) {
$this->db->update(
'users',
array(
'last_login' => date("Y-m-d H:i:s")
),
"id = ". $user->id
);
redirect("yllapito");
} else {
$this->session->set_flashdata(
'error',
'Kirjautuminen epäonnistui'
);
redirect("yllapito/kirjaudu");
}
}
// GET
if (! empty($this->user)) {
redirect("yllapito");
}
$data = array(
'page_title' => array( 'Kirjaudu', 'Ystäväkylä eKortti' ),
'page_classes' => array( 'login' ),
'user' => $this->user,
'error' => $this->session->flashdata('error')
);
$this->load->view('_header', $data);
$this->load->view('yllapito/login', $data);
$this->load->view('_footer', $data);
}
public function logout()
{
$this->erkana->logout();
redirect("yllapito");
}
public function makePassword($password = null)
{
echo $this->passwordhash($password);
}
private function passwordhash($password = null)
{
return hash(
'ripemd160',
$password . $this->config->item('encryption_key')
);
}
}

View File

@@ -0,0 +1,917 @@
<?php
/**
* A base model with a series of CRUD functions (powered by CI's query builder),
* validation-in-model support, event callbacks and more.
*
* @link http://github.com/jamierumbelow/codeigniter-base-model
* @copyright Copyright (c) 2012, Jamie Rumbelow <http://jamierumbelow.net>
*/
class MY_Model extends CI_Model
{
/* --------------------------------------------------------------
* VARIABLES
* ------------------------------------------------------------ */
/**
* This model's default database table. Automatically
* guessed by pluralising the model name.
*/
protected $_table;
/**
* Specify a database group to manually connect this model
* to the specified DB. You can pass either the group name
* as defined in application/config/database.php, or a
* config array of the same format (basically the same thing
* you can pass to $this->load->database()). If left empty,
* the default DB will be used.
*/
protected $_db_group;
/**
* The database connection object. Will be set to the default
* connection unless $this->_db_group is specified. This allows
* individual models to use different DBs without overwriting
* CI's global $this->db connection.
*/
public $_database;
/**
* This model's default primary key or unique identifier.
* Used by the get(), update() and delete() functions.
*/
protected $primary_key = 'id';
/**
* Support for soft deletes and this model's 'deleted' key
*/
protected $soft_delete = FALSE;
protected $soft_delete_key = 'deleted';
protected $_temporary_with_deleted = FALSE;
/**
* The various callbacks available to the model. Each are
* simple lists of method names (methods will be run on $this).
*/
protected $before_create = array();
protected $after_create = array();
protected $before_update = array();
protected $after_update = array();
protected $before_get = array();
protected $after_get = array();
protected $before_delete = array();
protected $after_delete = array();
protected $callback_parameters = array();
/**
* Protected, non-modifiable attributes
*/
protected $protected_attributes = array();
/**
* Relationship arrays. Use flat strings for defaults or string
* => array to customise the class name and primary key
*/
protected $belongs_to = array();
protected $has_many = array();
protected $_with = array();
/**
* An array of validation rules. This needs to be the same format
* as validation rules passed to the Form_validation library.
*/
protected $validate = array();
/**
* Optionally skip the validation. Used in conjunction with
* skip_validation() to skip data validation for any future calls.
*/
protected $skip_validation = FALSE;
/**
* By default we return our results as objects. If we need to override
* this, we can, or, we could use the `as_array()` and `as_object()` scopes.
*/
protected $return_type = 'object';
protected $_temporary_return_type = NULL;
/* --------------------------------------------------------------
* GENERIC METHODS
* ------------------------------------------------------------ */
/**
* Initialise the model, tie into the CodeIgniter superobject and
* try our best to guess the table name.
*/
public function __construct()
{
parent::__construct();
$this->load->helper('inflector');
$this->_set_database();
$this->_fetch_table();
array_unshift($this->before_create, 'protect_attributes');
array_unshift($this->before_update, 'protect_attributes');
$this->_temporary_return_type = $this->return_type;
}
/* --------------------------------------------------------------
* CRUD INTERFACE
* ------------------------------------------------------------ */
/**
* Fetch a single record based on the primary key. Returns an object.
*/
public function get($primary_value)
{
$this->trigger('before_get');
if ($this->soft_delete && $this->_temporary_with_deleted !== TRUE)
{
$this->_database->where($this->soft_delete_key, FALSE);
}
$row = $this->_database->where($this->primary_key, $primary_value)
->get($this->_table)
->{$this->_return_type()}();
$this->_temporary_return_type = $this->return_type;
$row = $this->trigger('after_get', $row);
$this->_with = array();
return $row;
}
/**
* Fetch a single record based on an arbitrary WHERE call. Can be
* any valid value to $this->_database->where().
*/
public function get_by()
{
$where = func_get_args();
$this->_set_where($where);
if ($this->soft_delete && $this->_temporary_with_deleted !== TRUE)
{
$this->_database->where($this->soft_delete_key, FALSE);
}
$this->trigger('before_get');
$row = $this->_database->get($this->_table)
->{$this->_return_type()}();
$this->_temporary_return_type = $this->return_type;
$row = $this->trigger('after_get', $row);
$this->_with = array();
return $row;
}
/**
* Fetch an array of records based on an array of primary values.
*/
public function get_many($values)
{
if ($this->soft_delete && $this->_temporary_with_deleted !== TRUE)
{
$this->_database->where($this->soft_delete_key, FALSE);
}
$this->_database->where_in($this->primary_key, $values);
return $this->get_all();
}
/**
* Fetch an array of records based on an arbitrary WHERE call.
*/
public function get_many_by()
{
$where = func_get_args();
$this->_set_where($where);
if ($this->soft_delete && $this->_temporary_with_deleted !== TRUE)
{
$this->_database->where($this->soft_delete_key, FALSE);
}
return $this->get_all();
}
/**
* Fetch all the records in the table. Can be used as a generic call
* to $this->_database->get() with scoped methods.
*/
public function get_all()
{
$this->trigger('before_get');
if ($this->soft_delete && $this->_temporary_with_deleted !== TRUE)
{
$this->_database->where($this->soft_delete_key, FALSE);
}
$result = $this->_database->get($this->_table)
->{$this->_return_type(1)}();
$this->_temporary_return_type = $this->return_type;
foreach ($result as $key => &$row)
{
$row = $this->trigger('after_get', $row, ($key == count($result) - 1));
}
$this->_with = array();
return $result;
}
/**
* Insert a new row into the table. $data should be an associative array
* of data to be inserted. Returns newly created ID.
*/
public function insert($data, $skip_validation = FALSE)
{
$valid = TRUE;
if ($skip_validation === FALSE)
{
$data = $this->validate($data);
}
if ($data !== FALSE)
{
$data = $this->trigger('before_create', $data);
$this->_database->insert($this->_table, $data);
$insert_id = $this->_database->insert_id();
$this->trigger('after_create', $insert_id);
return $insert_id;
}
else
{
return FALSE;
}
}
/**
* Insert multiple rows into the table. Returns an array of multiple IDs.
*/
public function insert_many($data, $skip_validation = FALSE)
{
$ids = array();
foreach ($data as $key => $row)
{
$ids[] = $this->insert($row, $skip_validation, ($key == count($data) - 1));
}
return $ids;
}
/**
* Updated a record based on the primary value.
*/
public function update($primary_value, $data, $skip_validation = FALSE)
{
$valid = TRUE;
$data = $this->trigger('before_update', $data);
if ($skip_validation === FALSE)
{
$data = $this->validate($data);
}
if ($data !== FALSE)
{
$result = $this->_database->where($this->primary_key, $primary_value)
->set($data)
->update($this->_table);
$this->trigger('after_update', array($data, $result));
return $result;
}
else
{
return FALSE;
}
}
/**
* Update many records, based on an array of primary values.
*/
public function update_many($primary_values, $data, $skip_validation = FALSE)
{
$data = $this->trigger('before_update', $data);
if ($skip_validation === FALSE)
{
$data = $this->validate($data);
}
if ($data !== FALSE)
{
$result = $this->_database->where_in($this->primary_key, $primary_values)
->set($data)
->update($this->_table);
$this->trigger('after_update', array($data, $result));
return $result;
}
else
{
return FALSE;
}
}
/**
* Updated a record based on an arbitrary WHERE clause.
*/
public function update_by()
{
$args = func_get_args();
$data = array_pop($args);
$this->_set_where($args);
$data = $this->trigger('before_update', $data);
if ($this->validate($data) !== FALSE)
{
$result = $this->_database->set($data)
->update($this->_table);
$this->trigger('after_update', array($data, $result));
return $result;
}
else
{
return FALSE;
}
}
/**
* Update all records
*/
public function update_all($data)
{
$data = $this->trigger('before_update', $data);
$result = $this->_database->set($data)
->update($this->_table);
$this->trigger('after_update', array($data, $result));
return $result;
}
/**
* Delete a row from the table by the primary value
*/
public function delete($id)
{
$this->trigger('before_delete', $id);
$this->_database->where($this->primary_key, $id);
if ($this->soft_delete)
{
$result = $this->_database->update($this->_table, array( $this->soft_delete_key => TRUE ));
}
else
{
$result = $this->_database->delete($this->_table);
}
$this->trigger('after_delete', $result);
return $result;
}
/**
* Delete a row from the database table by an arbitrary WHERE clause
*/
public function delete_by()
{
$where = func_get_args();
$this->_set_where($where);
$where = $this->trigger('before_delete', $where);
if ($this->soft_delete)
{
$result = $this->_database->update($this->_table, array( $this->soft_delete_key => TRUE ));
}
else
{
$result = $this->_database->delete($this->_table);
}
$this->trigger('after_delete', $result);
return $result;
}
/**
* Delete many rows from the database table by multiple primary values
*/
public function delete_many($primary_values)
{
$primary_values = $this->trigger('before_delete', $primary_values);
$this->_database->where_in($this->primary_key, $primary_values);
if ($this->soft_delete)
{
$result = $this->_database->update($this->_table, array( $this->soft_delete_key => TRUE ));
}
else
{
$result = $this->_database->delete($this->_table);
}
$this->trigger('after_delete', $result);
return $result;
}
/**
* Truncates the table
*/
public function truncate()
{
$result = $this->_database->truncate($this->_table);
return $result;
}
/* --------------------------------------------------------------
* RELATIONSHIPS
* ------------------------------------------------------------ */
public function with($relationship)
{
$this->_with[] = $relationship;
if (!in_array('relate', $this->after_get))
{
$this->after_get[] = 'relate';
}
return $this;
}
public function relate($row)
{
foreach ($this->belongs_to as $key => $value)
{
if (is_string($value))
{
$relationship = $value;
$options = array( 'primary_key' => $value . '_id', 'model' => $value . '_model' );
}
else
{
$relationship = $key;
$options = $value;
}
if (in_array($relationship, $this->_with))
{
$this->load->model($options['model']);
if (is_object($row))
{
$row->{$relationship} = $this->{$options['model']}->get($row->{$options['primary_key']});
}
else
{
$row[$relationship] = $this->{$options['model']}->get($row[$options['primary_key']]);
}
}
}
foreach ($this->has_many as $key => $value)
{
if (is_string($value))
{
$relationship = $value;
$options = array( 'primary_key' => singular($this->_table) . '_id', 'model' => singular($value) . '_model' );
}
else
{
$relationship = $key;
$options = $value;
}
if (in_array($relationship, $this->_with))
{
$this->load->model($options['model']);
if (is_object($row))
{
$row->{$relationship} = $this->{$options['model']}->get_many_by($options['primary_key'], $row->{$this->primary_key});
}
else
{
$row[$relationship] = $this->{$options['model']}->get_many_by($options['primary_key'], $row[$this->primary_key]);
}
}
}
return $row;
}
/* --------------------------------------------------------------
* UTILITY METHODS
* ------------------------------------------------------------ */
/**
* Retrieve and generate a form_dropdown friendly array
*/
function dropdown()
{
$args = func_get_args();
if(count($args) == 2)
{
list($key, $value) = $args;
}
else
{
$key = $this->primary_key;
$value = $args[0];
}
$this->trigger('before_dropdown', array( $key, $value ));
if ($this->soft_delete && $this->_temporary_with_deleted !== TRUE)
{
$this->_database->where($this->soft_delete_key, FALSE);
}
$result = $this->_database->select(array($key, $value))
->get($this->_table)
->result();
$options = array();
foreach ($result as $row)
{
$options[$row->{$key}] = $row->{$value};
}
$options = $this->trigger('after_dropdown', $options);
return $options;
}
/**
* Fetch a count of rows based on an arbitrary WHERE call.
*/
public function count_by()
{
$where = func_get_args();
$this->_set_where($where);
return $this->_database->count_all_results($this->_table);
}
/**
* Fetch a total count of rows, disregarding any previous conditions
*/
public function count_all()
{
return $this->_database->count_all($this->_table);
}
/**
* Tell the class to skip the insert validation
*/
public function skip_validation()
{
$this->skip_validation = TRUE;
return $this;
}
/**
* Get the skip validation status
*/
public function get_skip_validation()
{
return $this->skip_validation;
}
/**
* Return the next auto increment of the table. Only tested on MySQL.
*/
public function get_next_id()
{
return (int) $this->_database->select('AUTO_INCREMENT')
->from('information_schema.TABLES')
->where('TABLE_NAME', $this->_table)
->where('TABLE_SCHEMA', $this->_database->database)->get()->row()->AUTO_INCREMENT;
}
/**
* Getter for the table name
*/
public function table()
{
return $this->_table;
}
/* --------------------------------------------------------------
* GLOBAL SCOPES
* ------------------------------------------------------------ */
/**
* Return the next call as an array rather than an object
*/
public function as_array()
{
$this->_temporary_return_type = 'array';
return $this;
}
/**
* Return the next call as an object rather than an array
*/
public function as_object()
{
$this->_temporary_return_type = 'object';
return $this;
}
/**
* Don't care about soft deleted rows on the next call
*/
public function with_deleted()
{
$this->_temporary_with_deleted = TRUE;
return $this;
}
/* --------------------------------------------------------------
* OBSERVERS
* ------------------------------------------------------------ */
/**
* MySQL DATETIME created_at and updated_at
*/
public function created_at($row)
{
if (is_object($row))
{
$row->created_at = date('Y-m-d H:i:s');
}
else
{
$row['created_at'] = date('Y-m-d H:i:s');
}
return $row;
}
public function updated_at($row)
{
if (is_object($row))
{
$row->updated_at = date('Y-m-d H:i:s');
}
else
{
$row['updated_at'] = date('Y-m-d H:i:s');
}
return $row;
}
/**
* Serialises data for you automatically, allowing you to pass
* through objects and let it handle the serialisation in the background
*/
public function serialize($row)
{
foreach ($this->callback_parameters as $column)
{
$row[$column] = serialize($row[$column]);
}
return $row;
}
public function unserialize($row)
{
foreach ($this->callback_parameters as $column)
{
if (is_array($row))
{
$row[$column] = unserialize($row[$column]);
}
else
{
$row->$column = unserialize($row->$column);
}
}
return $row;
}
/**
* Protect attributes by removing them from $row array
*/
public function protect_attributes($row)
{
foreach ($this->protected_attributes as $attr)
{
if (is_object($row))
{
unset($row->$attr);
}
else
{
unset($row[$attr]);
}
}
return $row;
}
/* --------------------------------------------------------------
* QUERY BUILDER DIRECT ACCESS METHODS
* ------------------------------------------------------------ */
/**
* A wrapper to $this->_database->order_by()
*/
public function order_by($criteria, $order = 'ASC')
{
if ( is_array($criteria) )
{
foreach ($criteria as $key => $value)
{
$this->_database->order_by($key, $value);
}
}
else
{
$this->_database->order_by($criteria, $order);
}
return $this;
}
/**
* A wrapper to $this->_database->limit()
*/
public function limit($limit, $offset = 0)
{
$this->_database->limit($limit, $offset);
return $this;
}
/* --------------------------------------------------------------
* INTERNAL METHODS
* ------------------------------------------------------------ */
/**
* Trigger an event and call its observers. Pass through the event name
* (which looks for an instance variable $this->event_name), an array of
* parameters to pass through and an optional 'last in interation' boolean
*/
public function trigger($event, $data = FALSE, $last = TRUE)
{
if (isset($this->$event) && is_array($this->$event))
{
foreach ($this->$event as $method)
{
if (strpos($method, '('))
{
preg_match('/([a-zA-Z0-9\_\-]+)(\(([a-zA-Z0-9\_\-\., ]+)\))?/', $method, $matches);
$method = $matches[1];
$this->callback_parameters = explode(',', $matches[3]);
}
$data = call_user_func_array(array($this, $method), array($data, $last));
}
}
return $data;
}
/**
* Run validation on the passed data
*/
public function validate($data)
{
if($this->skip_validation)
{
return $data;
}
if(!empty($this->validate))
{
foreach($data as $key => $val)
{
$_POST[$key] = $val;
}
$this->load->library('form_validation');
if(is_array($this->validate))
{
$this->form_validation->set_rules($this->validate);
if ($this->form_validation->run() === TRUE)
{
return $data;
}
else
{
return FALSE;
}
}
else
{
if ($this->form_validation->run($this->validate) === TRUE)
{
return $data;
}
else
{
return FALSE;
}
}
}
else
{
return $data;
}
}
/**
* Guess the table name by pluralising the model name
*/
private function _fetch_table()
{
if ($this->_table == NULL)
{
$this->_table = plural(preg_replace('/(_m|_model)?$/', '', strtolower(get_class($this))));
}
}
/**
* Establish the database connection.
*/
private function _set_database()
{
// Was a DB group specified by the user?
if ($this->_db_group !== NULL)
{
$this->_database = $this->load->database($this->_db_group, TRUE, TRUE);
}
// No DB group specified, use the default connection.
else
{
// Has the default connection been loaded yet?
if ( ! isset($this->db) OR ! is_object($this->db))
{
$this->load->database('', FALSE, TRUE);
}
$this->_database = $this->db;
}
}
/**
* Set WHERE parameters, cleverly
*/
protected function _set_where($params)
{
if (count($params) == 1)
{
$this->_database->where($params[0]);
}
else
{
$this->_database->where($params[0], $params[1]);
}
}
/**
* Return the method name for the current return type
*/
protected function _return_type($multi = FALSE)
{
$method = ($multi) ? 'result' : 'row';
return $this->_temporary_return_type == 'array' ? $method . '_array' : $method;
}
}

View File

@@ -0,0 +1,10 @@
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

View File

@@ -0,0 +1,30 @@
<?php
$ci = &get_instance();
$data = array(
"user" => $ci->erkana->getUser()
);
$ci->load->view("_header", $data);
if (!isset($heading)) {
$heading = "Otsikko";
}
if (!isset($message)) {
$message = "Viesti";
}
?>
<div class="row">
<div class="small-12 large-12 columns" id="adminmenu">
<div class="panel">
<h2><?php echo $heading; ?></h2>
<?php echo $message; ?>
</div>
</div>
</div>
<?php $ci->load->view("_footer", $data);

View File

@@ -0,0 +1,62 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Database Error</title>
<style type="text/css">
::selection{ background-color: #E13300; color: white; }
::moz-selection{ background-color: #E13300; color: white; }
::webkit-selection{ background-color: #E13300; color: white; }
body {
background-color: #fff;
margin: 40px;
font: 13px/20px normal Helvetica, Arial, sans-serif;
color: #4F5155;
}
a {
color: #003399;
background-color: transparent;
font-weight: normal;
}
h1 {
color: #444;
background-color: transparent;
border-bottom: 1px solid #D0D0D0;
font-size: 19px;
font-weight: normal;
margin: 0 0 14px 0;
padding: 14px 15px 10px 15px;
}
code {
font-family: Consolas, Monaco, Courier New, Courier, monospace;
font-size: 12px;
background-color: #f9f9f9;
border: 1px solid #D0D0D0;
color: #002166;
display: block;
margin: 14px 0 14px 0;
padding: 12px 10px 12px 10px;
}
#container {
margin: 10px;
border: 1px solid #D0D0D0;
-webkit-box-shadow: 0 0 8px #D0D0D0;
}
p {
margin: 12px 15px 12px 15px;
}
</style>
</head>
<body>
<div id="container">
<h1><?php echo $heading; ?></h1>
<?php echo $message; ?>
</div>
</body>
</html>

View File

@@ -0,0 +1,62 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Error</title>
<style type="text/css">
::selection{ background-color: #E13300; color: white; }
::moz-selection{ background-color: #E13300; color: white; }
::webkit-selection{ background-color: #E13300; color: white; }
body {
background-color: #fff;
margin: 40px;
font: 13px/20px normal Helvetica, Arial, sans-serif;
color: #4F5155;
}
a {
color: #003399;
background-color: transparent;
font-weight: normal;
}
h1 {
color: #444;
background-color: transparent;
border-bottom: 1px solid #D0D0D0;
font-size: 19px;
font-weight: normal;
margin: 0 0 14px 0;
padding: 14px 15px 10px 15px;
}
code {
font-family: Consolas, Monaco, Courier New, Courier, monospace;
font-size: 12px;
background-color: #f9f9f9;
border: 1px solid #D0D0D0;
color: #002166;
display: block;
margin: 14px 0 14px 0;
padding: 12px 10px 12px 10px;
}
#container {
margin: 10px;
border: 1px solid #D0D0D0;
-webkit-box-shadow: 0 0 8px #D0D0D0;
}
p {
margin: 12px 15px 12px 15px;
}
</style>
</head>
<body>
<div id="container">
<h1><?php echo $heading; ?></h1>
<?php echo $message; ?>
</div>
</body>
</html>

View File

@@ -0,0 +1,10 @@
<div style="border:1px solid #990000;padding-left:20px;margin:0 0 10px 0;">
<h4>A PHP Error was encountered</h4>
<p>Severity: <?php echo $severity; ?></p>
<p>Message: <?php echo $message; ?></p>
<p>Filename: <?php echo $filepath; ?></p>
<p>Line Number: <?php echo $line; ?></p>
</div>

View File

@@ -0,0 +1,10 @@
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

View File

@@ -0,0 +1,10 @@
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

View File

@@ -0,0 +1,10 @@
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

10
application/index.html Normal file
View File

@@ -0,0 +1,10 @@
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

View File

@@ -0,0 +1,10 @@
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

View File

@@ -0,0 +1,10 @@
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

View File

@@ -0,0 +1,10 @@
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

View File

@@ -0,0 +1,20 @@
<?php
/**
* Ecard
*/
class Ecard_model extends MY_Model
{
public $before_create = array( 'timestamps' );
public function __construct()
{
parent::__construct();
}
protected function timestamps($book)
{
$book['created_at'] = $book['updated_at'] = date('Y-m-d H:i:s');
return $book;
}
}

View File

@@ -0,0 +1,87 @@
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
class Erkanaauth_model extends CI_Model {
var $db_table = 'users';
var $db_userid = 'id';
function __construct()
{
// Call the Model constructor
parent::__construct();
log_message('debug', 'Authorization class initialized (model Erkanaauth).');
}
/**
* Attempt to login using the given condition
*
* Accepts an associative array as input, containing login conditions
* Example:
* $conditions = array
* (
* 'email'=>$email,
* 'password'=>dohash($password)
* );
* $this->erkanaauth->try_login($conditions));
*
* @access public
* @param array login conditions
* @return mixed boolean:false or object with user record
*/
function try_login($condition = array())
{
$query = $this->db->get_where($this->db_table, $condition, 1, 0);
if ($query->num_rows != 1) return FALSE;
$row = $query->row();
$this->session->set_userdata(array('user_id'=>$row->id));
return $row;
}
/**
* Multipurpose: Check logged state and have the current user info
*
* Copied from http://codeigniter.com/forums/viewthread/63423/P30/:
* getUser() now returns a user's record and can be
* used to determine login status as well as retrieving
* user information. Right now it doesn’t support roles
* (so if you use that system, add in a JOIN to the method below)
* but it will when I actually release this version
*
* @access public
* @param int the user id, defaults to session user_id
* @return mixed boolean:false or object with user record
*/
function getUser($id = FALSE)
{
if ($id == FALSE) $id = $this->session->userdata('user_id');
if ($id == FALSE) return FALSE;
$condition = array(($this->db_table .'.' .$this->db_userid) =>$id);
$query = $this->db->get_where($this->db_table, $condition, 1, 0);
$row = ($query->num_rows() == 1) ? $query->row() : FALSE;
return $row;
}
/**
* Logs a user out
*
* Example: $this->erkanaauth->logout()
*
* @access public
* @return void
*/
function logout()
{
$this->session->set_userdata(array('user_id'=>FALSE));
}
}
?>

View File

@@ -0,0 +1,10 @@
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

10
application/third_party/index.html vendored Normal file
View File

@@ -0,0 +1,10 @@
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

View File

@@ -0,0 +1,25 @@
<footer class="row">
<div class="large-12 columns">
<div class="panel">
<a href="<?php echo site_url("yllapito"); ?>" class="loginlink">&pi;</a>
&copy; Ystäväkylä-hanke, Ekokumppanit Oy, Ismo Vuorinen 2013
</div>
</div>
</footer>
<script src="http://cdnjs.cloudflare.com/ajax/libs/foundation/4.1.6/js/vendor/jquery.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/foundation/4.1.6/js/vendor/custom.modernizr.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/foundation/4.1.6/js/foundation.min.js"></script>
<script src="http://rvera.github.io/image-picker/image-picker/image-picker.min.js"></script>
<script src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.min.js"></script>
<script src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/additional-methods.min.js"></script>
<script src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/localization/messages_fi.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.10.3/css/base/jquery.ui.all.min.css">
<script src="<?php echo base_url("/assets/scripts.js"); ?>"></script>
<!-- {elapsed_time} -->
</body>
</html>

View File

@@ -0,0 +1,139 @@
<?php
if (empty($page_classes)) {
$page_classes = array('page_not_set');
}
if (empty($page_title)) {
$page_title = array('Ystäväkylä');
}
?><!DOCTYPE html>
<!--[if IE 8]> <html class="no-js lt-ie9" lang="fi"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="fi"> <!--<![endif]-->
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width" />
<link rel="icon" href="<?php echo site_url('/favicon.ico'); ?>">
<title><?php echo implode(" &raquo; ", $page_title); ?></title>
<?php
assets_css(array(
'normalize.min.css',
'foundation.min.css',
'style.css'
));
?>
</head>
<body class="<?php echo implode($page_classes); ?>">
<div id="topmenu" class="row">
<div class="large-12 columns">
<nav class="top-bar">
<ul class="title-area">
<li class="name">
<h1><a href="<?php echo site_url(); ?>">Ystäväkylä eKortti</a></h1>
</li>
<li class="toggle-topbar menu-icon"><a href="#"><span>Menu</span></a></li>
</ul>
<section class="top-bar-section">
<ul class="left">
<li class="divider"></li>
<li><a class="active" href="<?php echo site_url("uusi"); ?>">Luo omasi!</a></li>
<li class="divider"></li>
<li><a href="<?php echo site_url("kaikki"); ?>">Listaa kaikki</a></li>
<li class="divider"></li>
<li class="has-dropdown">
<a href="<?php echo site_url("info"); ?>">Tietoa</a>
<ul class="dropdown">
<li><a href="<?php echo site_url("info"); ?>#rekisteri">Rekisteriseloste</a></li>
<li><a href="<?php echo site_url("info"); ?>#yhteystiedot">Yhteystiedot</a></li>
</ul>
</li>
</ul>
<?php
if (isset($user) and ! empty($user)) {
?>
<ul class="left">
<li class="has-dropdown adminmenu">
<a href="<?php echo site_url("yllapito"); ?>">Ylläpito</a>
<ul class="dropdown">
<li class="has-dropdown">
<a href="<?php echo site_url("yllapito/kortit"); ?>">Hallitse kortteja</a>
<ul class="dropdown">
<li>
<a href="<?php echo site_url("yllapito/ecards/moderate");?>">
<span class="right label round">0</span>
Jonossa
</a>
</li>
<li>
<a href="<?php echo site_url("yllapito/ecards/public");?>">
<span class="right label round">0</span>
Julkaistut
</a>
</li>
<li>
<a href="<?php echo site_url("yllapito/ecards/private");?>">
<span class="right label round">0</span>
Privaatit
</a>
</li>
<li>
<a href="<?php echo site_url("yllapito/ecards/deleted");?>">
<span class="right label round">0</span>
Hylätyt
</a>
</li>
</ul>
</li>
<li class="has-dropdown">
<a href="<?php echo site_url("yllapito/users"); ?>">Hallitse käyttäjiä</a>
<ul class="dropdown">
<li>
<a href="<?php echo site_url("yllapito/users/add");?>">
Lisää käyttäjä
</a>
</li>
<li>
<a href="<?php echo site_url("yllapito/users/list");?>">
Listaa käyttäjät
</a>
</li>
</ul>
</li>
<li class="divider"></li>
<li>
<a class="logout" href="<?php echo site_url("yllapito/logout"); ?>">Kirjaudu ulos</a>
</li>
</ul>
</li>
</ul>
<?php
}
?>
<ul class="right">
<li><a href="http://www.ystavakyla.fi">Takaisin ystavakyla.fi -sivuille</a></li>
</ul>
</section>
</nav>
</div>
</div>
<div class="row headerlogo">
<div class="large-12 columns">
<a href="<?php
echo site_url();
?>"><img src="<?php
echo Assets::img('logo.png');
?>" alt="Ystäväkylä"></a>
</div>
</div>

View File

@@ -0,0 +1,33 @@
<div class="large-12 columns">
<div class="panel">
<ul class="small-block-grid-2 large-block-grid-5">
<?php
$t_start = "1302000000";
$t_end = time();
if (empty($amount)) {
$amount = 5;
}
for ($i=0; $i < $amount; $i++) {
$url = site_url('/ecards/' . md5($i));
$url = '<a href="'.$url.'" title="'.$i.'">';
?>
<li class="image-panel">
<?php echo $url; ?>
<img src="http://placekitten.com/800/500" alt="placeholder+image">
<em><?php echo date("d.m.Y \k\l\o H.i", rand($t_start, $t_end)); ?></em>
</a>
</li>
<?php
}
?>
</ul>
</div>
</div>

View File

@@ -0,0 +1,10 @@
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

View File

@@ -0,0 +1,58 @@
<div class="row">
<div class="large-12 small-12 columns">
<div class="panel">
<h2 id="info">Tietoa eKortista</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
<h2 id="yhteystiedot">Yhteystiedot</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
<h2 id="rekisteriseloste">Rekisteriseloste</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div>
</div>
</div>

197
application/views/new.php Normal file
View File

@@ -0,0 +1,197 @@
<div class="row">
<div class="large-12 small-12 columns">
<div class="panel">
<h2>Luo uusi eKortti!</h2>
<p>
Suunnittele oma eKorttisi ja lähetä se ystävällesi!
Samalla voit osallistua arvontaan josta voit voittaa huikean hienoja palkintoja.
</p>
</div>
</div>
</div>
<div class="row">
<div class="large-6 small-12 columns">
<div class="panel">
<form id="ecard_form">
<h2>Tiedot</h2>
<!-- Sender information -->
<div class="row">
<div class="large-12 small-12">
<div class="row">
<div class="small-12 large-3 columns">
<label for="sender_name" class="right">Nimenne</label>
</div>
<div class="small-12 large-9 columns">
<input required type="text" id="sender_name"
name="sender_name" placeholder="Lähettäjän nimi">
</div>
</div>
<div class="row">
<div class="small-12 large-3 columns">
<label for="sender_email" class="right">Email-osoitteenne</label>
</div>
<div class="small-12 large-9 columns">
<input required type="email" id="sender_email"
name="sender_email" placeholder="Lähettäjän email">
</div>
</div>
</div>
</div>
<!-- Receiver information -->
<div class="row">
<div class="large-12 small-12">
<div class="row">
<div class="small-12 large-3 columns">
<label for="receiver_name" class="right">Vastaanottaja</label>
</div>
<div class="small-12 large-9 columns">
<input required type="text" id="receiver_name"
name="receiver_name" placeholder="Vastaanottajan nimi">
</div>
</div>
<div class="row">
<div class="small-12 large-3 columns">
<label for="receiver_email" class="right">Vastaanottajan email</label>
</div>
<div class="small-12 large-9 columns">
<input required type="email" id="receiver_email"
name="receiver_email" placeholder="Vastaanottajan email">
</div>
</div>
</div>
</div>
<!-- Picture -->
<div class="row">
<div class="small-12 large-3 columns">
<label for="select_image" class="right">Valitse kortin taustakuva</label>
</div>
<div class="small-12 large-9 columns">
<select name="select_image" id="select_image" class="image-picker">
<?php
if (! empty($images)) {
foreach ($images as $i => $image) {
?> <option data-img-src='<?php echo
$image;
?>' value='<?php
echo $i;
?>'>Cute Kitten <?=$i;?></option><?php
echo "\n";
}
}
?>
</select>
</div>
</div>
<!-- Hello -->
<div class="row">
<div class="small-12 large-3 columns">
<label for="message_title" class="right">Otsikko</label>
</div>
<div class="small-12 large-9 columns">
<input type="text" maxlength="200" id="message_title"
name="message_title" placeholder="Moikka!">
</div>
</div>
<div class="row">
<div class="small-12 large-3 columns">
<label for="message_text" class="right">Viestinne</label>
</div>
<div class="small-12 large-9 columns">
<textarea required id="message_text" name="message_text"
placeholder="Terveiset täältä internetistä"></textarea>
</div>
</div>
<!-- Hidden -->
<input type="hidden" id="sizeOf_message_text_w"
name="sizeOf_message_text_w" value="">
<input type="hidden" id="sizeOf_message_text_h"
name="sizeOf_message_text_h" value="">
<input type="hidden" id="sizeOf_message_title_w"
name="sizeOf_message_title_w" value="">
<input type="hidden" id="sizeOf_message_title_h"
name="sizeOf_message_title_h" value="">
<input type="hidden" id="placeOf_message_text_y"
name="placeOf_message_text_y" value="">
<input type="hidden" id="placeOf_message_text_x"
name="placeOf_message_text_x" value="">
<input type="hidden" id="placeOf_message_title_y"
name="placeOf_message_title_y" value="">
<input type="hidden" id="placeOf_message_title_x"
name="placeOf_message_title_x" value="">
<div class="row">
<div class="small-12 large-3 columns">
<label for="participate" class="right">Osallistutko arvontaan?</label>
</div>
<div class="small-12 large-9 columns" style="padding-top:5px;padding-bottom: 10px;">
<select name="participate" id="participate">
<option value="yes">Kyllä, haluan osallistua</option>
<option value="no">En halua osallistua</option>
</select>
</div>
</div>
<div class="row">
<div class="small-12 large-3 columns">
<label for="publiccard" class="right">Listaaminen</label>
</div>
<div class="small-12 large-9 columns" style="padding-top:5px;padding-bottom: 10px;">
<select name="publiccard" id="publiccard">
<option value="yes">Kyllä, korttini saa näkyä julkisessa listauksessa</option>
<option value="no">En halua, että korttini listataan</option>
</select>
</div>
</div>
<div class="row">
<div class="small-12 large-3 columns">&nbsp;</div>
<div class="small-12 large-9 columns">
<input type="submit" id="submit" class="button" value="Lähetä eKorttisi!" name="submit">
</div>
</div>
</form>
</div>
</div>
<div class="large-6 small-12 columns">
<div class="panel previewpanelclear">
<h2>Esikatselu</h2>
<div id="previewpanel">
<div id="message_title_preview">Moikka!</div>
<div id="message_text_preview">Terveisiä täältä internetistä!</div>
<img id="previewimage" src="http://dummyimage.com/800x600/4d494d/686a82.gif&text=placeholder+image">
</div>
</div>
<div class="panel">
<p>Tiedot kerätään vain postikorttien lähettämiseen ja halutessasi arvontaan osallistumista varten.</p>
</div>
</div>
</div>

View File

@@ -0,0 +1,26 @@
<?php
$cards = rand(10, 200);
$private = rand(4,100);
$public = $cards-$private;
if( $public < 4 ) {
$public = rand(10, 200);
$private = $private + $public;
$cards = $public + $private;
}
?>
<div class="row">
<div class="large-12 columns">
<div class="panel">
<h2>Tässä kaikki Ystäväkylän sähköpostikortit!</h2>
<p>Postikortit ovat järjestetty luomisjärjestykseen, uusimmat ensimmäiseksi. Tällä hetkellä postikortteja on kaikkiaan <strong><?=$cards;?></strong> kappaletta joista näytetään julkisesti <strong><?=$public;?></strong> kappaletta. Yksityisiä kortteja on <strong><?=$private;?></strong> kappaletta.</p>
</div>
</div>
<?php $this->load->view('_partial_cardlist.php', array('amount' => $public)); ?>
</div>

View File

@@ -0,0 +1,22 @@
<div class="row">
<div class="large-12 columns">
<div class="panel">
<?php
if( $ecard and $ecard->response == "200" ) {
?>
<h2>Postikortti #<?php echo $ecard->id;?></h2>
<?php
} else {
?>
<h2>Tunnuksella ei löytynyt ainuttakaan korttia</h2>
<p>Sähköpostikortti on joko poistettu järjestelmästä, tai sitten seurasit rikkinäistä linkkiä.</p>
<p></p>
<?php
}
?>
<pre><?php var_export($ecard); ?></pre>
</div>
</div>
</div>

View File

@@ -0,0 +1,32 @@
<div class="row">
<div class="large-12 columns">
<div class="panel">
<h2>Tervetuloa Ystäväkylän ePostikorttiin!</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div>
</div>
<?php $this->load->view('_partial_cardlist.php', array('amount' => 5)); ?>
</div>

View File

@@ -0,0 +1,15 @@
<div class="row">
<div class="large-12 columns">
<div class="panel">
<pre><?php
if (empty($user)) {
$user = new stdClass();
}
var_export($user);
?></pre>
</div>
</div>
</div>

View File

@@ -0,0 +1,83 @@
<div class="row">
<div class="large-12 small-12 large-centered columns">
<div class="panel">
<div class="row">
<div class="large-6 small-12 large-centered columns">
<h2>Kirjaudu sisään</h2>
<?php
if (empty($error)) {
$error = null;
}
if (! empty($error)) { ?>
<div data-alert class="alert-box alert">
<?php echo $error; ?>
</div>
<?php
}
?>
<form id="loginform" method="post">
<div class="row">
<div class="large-12 small-12">
<div class="row">
<div class="small-3 large-3 columns">
<label for="username"
class="right">Tunnus</label>
</div>
<div class="small-9 large-9 columns">
<input
required
type="text"
id="username"
name="username"
class="expand"
value="ismo.vuorinen@tampere.fi"
>
</div>
</div>
<div class="row">
<div class="small-3 columns">
<label for="password"
class="right">Salasana</label>
</div>
<div class="small-9 columns">
<input
required
type="password"
id="password"
name="password"
placeholder=""
class="expand"
value="aasi"
>
</div>
</div>
</div>
</div>
<div class="row">
<div class="small-3 large-3 columns">&nbsp;</div>
<div class="small-9 large-9 columns">
<input type="submit" id="submit"
class="button expand" value="Kirjaudu"
name="submit">
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>