diff --git a/.gitignore b/.gitignore index 599468937..b27451708 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .htaccess +bin /nbproject/ /vendor/* !/vendor/FHC-vendor diff --git a/application/cache/index.html b/application/cache/index.html new file mode 100755 index 000000000..b702fbc39 --- /dev/null +++ b/application/cache/index.html @@ -0,0 +1,11 @@ + + +
+Directory access is forbidden.
+ + + diff --git a/application/config/autoload.php b/application/config/autoload.php new file mode 100755 index 000000000..817617a9b --- /dev/null +++ b/application/config/autoload.php @@ -0,0 +1,131 @@ + 'ua'); +*/ +//$autoload['libraries'] = array(); +$autoload['libraries'] = array('database'); + +/* +| ------------------------------------------------------------------- +| 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'); +*/ +$autoload['drivers'] = array(); + +/* +| ------------------------------------------------------------------- +| Auto-load Helper Files +| ------------------------------------------------------------------- +| Prototype: +| +| $autoload['helper'] = array('url', 'file'); +*/ +//$autoload['helper'] = array(); +$autoload['helper'] = array('url'); + +/* +| ------------------------------------------------------------------- +| 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 100755 index 000000000..fba741d58 --- /dev/null +++ b/application/config/config.php @@ -0,0 +1,504 @@ +]+$/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/ +| +| 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'; + +/* +|-------------------------------------------------------------------------- +| 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. +| +| http://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. +| +| '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. +| +| This is particularly useful for portability between UNIX-based OSes, +| (usually \n) and Windows (\r\n). +| +*/ +$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 100755 index 000000000..48283e223 --- /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' => DB_HOST, + 'username' => DB_USER, + 'password' => DB_PASSWORD, + 'database' => DB_NAME, + 'dbdriver' => 'postgre', + 'dbprefix' => '', + 'pconnect' => DB_CONNECT_PERSISTENT, + '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 +); + +$db['wawi'] = array( + 'dsn' => '', + 'hostname' => DB_HOST, + 'username' => DB_USER, + 'password' => DB_PASSWORD, + 'database' => DB_NAME, + 'dbschema' => 'wawi', + 'dbdriver' => 'postgre', + 'dbprefix' => '', + 'pconnect' => DB_CONNECT_PERSISTENT, + '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 100755 index 000000000..59a7991e3 --- /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 100755 index 000000000..ac406e3d4 --- /dev/null +++ b/application/config/foreign_chars.php @@ -0,0 +1,103 @@ + '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', + '/Ķ|Κ|К/' => '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', + '/Ź|Ż|Ž|Ζ|З/' => 'Z', + '/ź|ż|ž|ζ|з/' => 'z', + '/Æ|Ǽ/' => 'AE', + '/ß/' => 'ss', + '/IJ/' => 'IJ', + '/ij/' => 'ij', + '/Œ/' => 'OE', + '/ƒ/' => 'f', + '/ξ/' => 'ks', + '/π/' => 'p', + '/β/' => 'v', + '/μ/' => 'm', + '/ψ/' => '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/grocery_crud.php b/application/config/grocery_crud.php new file mode 100644 index 000000000..57caddd15 --- /dev/null +++ b/application/config/grocery_crud.php @@ -0,0 +1,35 @@ + + + +Directory access is forbidden.
+ + + diff --git a/application/config/memcached.php b/application/config/memcached.php new file mode 100755 index 000000000..55949a66c --- /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 100755 index 000000000..840fa7a40 --- /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'] = 20160101010103; + +/* +|-------------------------------------------------------------------------- +| Migration Type +|-------------------------------------------------------------------------- +| +| Migration file names may be based on a sequential identifier or on +| a timestamp. Options are: +| +| 'sequential' = Sequential migration naming (001_add_blog.php) +| 'timestamp' = Timestamp migration naming (20121031104401_add_blog.php) +| Use timestamp format YYYYMMDDHHIISS. +| +| Note: If this configuration value is missing the Migration library +| defaults to 'sequential' for backward compatibility with CI2. +| +*/ +$config['migration_type'] = 'timestamp'; + +/* +|-------------------------------------------------------------------------- +| Migrations table +|-------------------------------------------------------------------------- +| +| This is the name of the table that will store the current migrations state. +| When migrations runs it will store in a database table which migration +| level the system is at. It then compares the migration level in this +| table to the $config['migration_version'] if they are not the same it +| will migrate up. This must be set. +| +*/ +$config['migration_table'] = 'ci_migrations'; + +/* +|-------------------------------------------------------------------------- +| Auto Migrate To Latest +|-------------------------------------------------------------------------- +| +| If this is set to TRUE when you load the migrations class and have +| $config['migration_enabled'] set to TRUE the system will auto migrate +| to your latest migration (whatever $config['migration_version'] is +| set to). This way you do not have to call migrations anywhere else +| in your code to have the latest migration. +| +*/ +$config['migration_auto_latest'] = FALSE; + +/* +|-------------------------------------------------------------------------- +| 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 100755 index 000000000..1f591ba6b --- /dev/null +++ b/application/config/mimes.php @@ -0,0 +1,158 @@ + 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'), + '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' => 'video/mp4', + 'webm' => 'video/webm', + 'aac' => 'audio/x-acc', + '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' => 'audio/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', + '7zip' => array('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') +); diff --git a/application/config/pagination.php b/application/config/pagination.php new file mode 100644 index 000000000..229036a0f --- /dev/null +++ b/application/config/pagination.php @@ -0,0 +1,37 @@ +"; + print_r($output); + echo ""; + die(); + + $this->_example_output($output); + } + + function _example_output($output = null) + + { + $this->load->view('our_template.php',$output); + } +} + +/* End of file main.php */ +/* Location: ./application/controllers/main.php */ diff --git a/application/controllers/Migrate.php b/application/controllers/Migrate.php new file mode 100644 index 000000000..b29fd6f65 --- /dev/null +++ b/application/controllers/Migrate.php @@ -0,0 +1,16 @@ +load->library('migration'); + + if ($this->migration->current() === FALSE) + { + show_error($this->migration->error_string()); + } + } + +} diff --git a/application/controllers/Pages.php b/application/controllers/Pages.php new file mode 100755 index 000000000..3fade84dd --- /dev/null +++ b/application/controllers/Pages.php @@ -0,0 +1,7 @@ +load->model('person_model'); + } + + public function index() + { + $data['person'] = $this->person_model->get_personen(); + $data['title'] = 'Personen Archiv'; + + $this->load->view('templates/header', $data); + $this->load->view('person/index', $data); + $this->load->view('templates/footer'); + } + + public function view($slug = NULL) + { + $data['person_item'] = $this->person_model->get_personen($slug); + if (empty($data['person_item'])) + { + show_404(); + } + + $data['title'] = $data['person_item']->titelpre; + + $this->load->view('templates/header', $data); + $this->load->view('person/view', $data); + $this->load->view('templates/footer'); + } +} diff --git a/application/controllers/Rest_server.php b/application/controllers/Rest_server.php new file mode 100644 index 000000000..698bca3bd --- /dev/null +++ b/application/controllers/Rest_server.php @@ -0,0 +1,40 @@ + ZipComp: First Compute Request +* ZipCmd <-- ZipComp: First Compute Response +* +* ZipCmd -> ZipComp: Second Compute Request +* ZipCmd <-- ZipComp: Second Compute Response +* +* @enduml +* --> +* +* @return some value on success. +*/ + +defined('BASEPATH') OR exit('No direct script access allowed'); + +/** + * @class Rest_server + * @brief Rest Server Controller + * + * A more detailed class description. +*/ +class Rest_server extends CI_Controller { + + public function index() + { + $this->load->helper('url'); + + $this->load->view('rest_server'); + } +} diff --git a/application/controllers/Studiengang.php b/application/controllers/Studiengang.php new file mode 100644 index 000000000..e4a4765c0 --- /dev/null +++ b/application/controllers/Studiengang.php @@ -0,0 +1,167 @@ +load->model('studiengang_model'); + $this->load->library('form_validation'); + } + + public function index() + { + $keyword = ''; + $this->load->library('pagination'); + + $config['base_url'] = base_url() . 'studiengang/index/'; + $config['total_rows'] = $this->studiengang_model->total_rows(); + $config['per_page'] = 10; + $config['uri_segment'] = 3; + $config['suffix'] = '.html'; + $config['first_url'] = base_url() . 'studiengang.html'; + $this->pagination->initialize($config); + + $start = $this->uri->segment(3, 0); + $studiengang = $this->studiengang_model->index_limit($config['per_page'], $start); + + $data = array( + 'studiengang_data' => $studiengang, + 'keyword' => $keyword, + 'pagination' => $this->pagination->create_links(), + 'total_rows' => $config['total_rows'], + 'start' => $start, + ); + + $this->load->view('tbl_studiengang_list', $data); + } + + public function search() + { + $keyword = $this->uri->segment(3, $this->input->post('keyword', TRUE)); + $this->load->library('pagination'); + + if ($this->uri->segment(2)=='search') { + $config['base_url'] = base_url() . 'studiengang/search/' . $keyword; + } else { + $config['base_url'] = base_url() . 'studiengang/index/'; + } + + $config['total_rows'] = $this->studiengang_model->search_total_rows($keyword); + $config['per_page'] = 10; + $config['uri_segment'] = 4; + $config['suffix'] = '.html'; + $config['first_url'] = base_url() . 'studiengang/search/'.$keyword.'.html'; + $this->pagination->initialize($config); + + $start = $this->uri->segment(4, 0); + $studiengang = $this->studiengang_model->search_index_limit($config['per_page'], $start, $keyword); + + $data = array( + 'studiengang_data' => $studiengang, + 'keyword' => $keyword, + 'pagination' => $this->pagination->create_links(), + 'total_rows' => $config['total_rows'], + 'start' => $start, + ); + $this->load->view('tbl_studiengang_list', $data); + } + + public function read($id) + { + $row = $this->studiengang_model->get_by_id($id); + if ($row) { + $data = array( + ); + $this->load->view('tbl_studiengang_read', $data); + } else { + $this->session->set_flashdata('message', 'Record Not Found'); + redirect(site_url('studiengang')); + } + } + + public function create() + { + $data = array( + 'button' => 'Create', + 'action' => site_url('studiengang/create_action'), + ); + $this->load->view('tbl_studiengang_form', $data); + } + + public function create_action() + { + $this->_rules(); + + if ($this->form_validation->run() == FALSE) { + $this->create(); + } else { + $data = array( + ); + + $this->studiengang_model->insert($data); + $this->session->set_flashdata('message', 'Create Record Success'); + redirect(site_url('studiengang')); + } + } + + public function update($id) + { + $row = $this->studiengang_model->get_by_id($id); + + if ($row) { + $data = array( + 'button' => 'Update', + 'action' => site_url('studiengang/update_action'), + ); + $this->load->view('tbl_studiengang_form', $data); + } else { + $this->session->set_flashdata('message', 'Record Not Found'); + redirect(site_url('studiengang')); + } + } + + public function update_action() + { + $this->_rules(); + + if ($this->form_validation->run() == FALSE) { + $this->update($this->input->post('', TRUE)); + } else { + $data = array( + ); + + $this->studiengang_model->update($this->input->post('', TRUE), $data); + $this->session->set_flashdata('message', 'Update Record Success'); + redirect(site_url('studiengang')); + } + } + + public function delete($id) + { + $row = $this->studiengang_model->get_by_id($id); + + if ($row) { + $this->studiengang_model->delete($id); + $this->session->set_flashdata('message', 'Delete Record Success'); + redirect(site_url('studiengang')); + } else { + $this->session->set_flashdata('message', 'Record Not Found'); + redirect(site_url('studiengang')); + } + } + + public function _rules() + { + + $this->form_validation->set_rules('', '', 'trim'); + $this->form_validation->set_error_delimiters('', ''); + } + +}; + +/* End of file Studiengang.php */ +/* Location: ./application/controllers/Studiengang.php */ \ No newline at end of file diff --git a/application/controllers/Welcome.php b/application/controllers/Welcome.php new file mode 100755 index 000000000..34535ef05 --- /dev/null +++ b/application/controllers/Welcome.php @@ -0,0 +1,25 @@ + + * @see http://codeigniter.com/user_guide/general/urls.html + */ + public function index() + { + $this->load->view('welcome_message'); + } +} diff --git a/application/controllers/index.html b/application/controllers/index.html new file mode 100755 index 000000000..b702fbc39 --- /dev/null +++ b/application/controllers/index.html @@ -0,0 +1,11 @@ + + + +
Directory access is forbidden.
+ + + diff --git a/application/controllers/rdf/Basic.php b/application/controllers/rdf/Basic.php new file mode 100644 index 000000000..b6fc1a32d --- /dev/null +++ b/application/controllers/rdf/Basic.php @@ -0,0 +1,66 @@ +load->library(array('rdf')); + $this->load->helper(array('form', 'url')); + + } + public function index() + { + + $this->load->library('Rdf'); + + $d['title'] = ''; + + + $d['content']= $this->load->view('rdf/basic',$d,true); + $this->load->view('home',$d); + } + public function sparql() + { + + $this->load->library('Rdf'); + + $d['title'] = ''; + + + $d['content']= $this->load->view('rdf/basic_sparql',$d,true); + $this->load->view('home',$d); + } + public function foafinfo() + { + + $this->load->library('Rdf'); + + + + $d['title'] = ''; + + + $d['content']= $this->load->view('rdf/foafinfo',$d,true); + $this->load->view('home',$d); + } + public function foafmaker() + { + + $d['title'] = ''; + + + $d['content']= $this->load->view('rdf/foafmaker',$d,true); + $this->load->view('home',$d); + } + public function converter() + { + + $d['title'] = ''; + + $d['content']= $this->load->view('rdf/converter',$d,true); + $this->load->view('home',$d); + } +} diff --git a/application/core/index.html b/application/core/index.html new file mode 100755 index 000000000..b702fbc39 --- /dev/null +++ b/application/core/index.html @@ -0,0 +1,11 @@ + + + +Directory access is forbidden.
+ + + diff --git a/application/helpers/index.html b/application/helpers/index.html new file mode 100755 index 000000000..b702fbc39 --- /dev/null +++ b/application/helpers/index.html @@ -0,0 +1,11 @@ + + + +Directory access is forbidden.
+ + + diff --git a/application/hooks/index.html b/application/hooks/index.html new file mode 100755 index 000000000..b702fbc39 --- /dev/null +++ b/application/hooks/index.html @@ -0,0 +1,11 @@ + + + +Directory access is forbidden.
+ + + diff --git a/application/index.html b/application/index.html new file mode 100755 index 000000000..b702fbc39 --- /dev/null +++ b/application/index.html @@ -0,0 +1,11 @@ + + + +Directory access is forbidden.
+ + + diff --git a/application/language/english/index.html b/application/language/english/index.html new file mode 100755 index 000000000..b702fbc39 --- /dev/null +++ b/application/language/english/index.html @@ -0,0 +1,11 @@ + + + +Directory access is forbidden.
+ + + diff --git a/application/language/index.html b/application/language/index.html new file mode 100755 index 000000000..b702fbc39 --- /dev/null +++ b/application/language/index.html @@ -0,0 +1,11 @@ + + + +Directory access is forbidden.
+ + + diff --git a/application/libraries/Grocery_CRUD.php b/application/libraries/Grocery_CRUD.php new file mode 100755 index 000000000..53df38ed8 --- /dev/null +++ b/application/libraries/Grocery_CRUD.php @@ -0,0 +1,5585 @@ + + */ + +// ------------------------------------------------------------------------ + +/** + * grocery Field Types + * + * The types of the fields and the default reactions + * + * @package grocery CRUD + * @author John Skoumbourdis| ".$column->display_as." | "; + } + $string_to_print .= "
|---|
| ".$this->_trim_print_string($row->{$column->field_name})." | "; + } + $string_to_print .= "
'.$this->l('delete_error_message').'
'; + + echo json_encode(array('success' => $delete_result ,'error_message' => $error_message)); + } + else + { + $success_message = ''.$this->l('delete_success_message').'
'; + + echo json_encode(array('success' => true , 'success_message' => $success_message)); + } + $this->set_echo_and_die(); + } + + protected function get_success_message_at_list($field_info = null) + { + if($field_info !== null && isset($field_info->success_message) && $field_info->success_message) + { + if(!empty($field_info->primary_key) && !$this->unset_edit) + { + return $this->l('insert_success_message')." ".$this->l('form_edit')." {$this->subject} "; + } + else + { + return $this->l('insert_success_message'); + } + } + else + { + return null; + } + } + + protected function insert_layout($insert_result = false) + { + @ob_end_clean(); + if($insert_result === false) + { + echo json_encode(array('success' => false)); + } + else + { + $success_message = ''.$this->l('insert_success_message'); + + if(!$this->unset_back_to_list && !empty($insert_result) && !$this->unset_edit) + { + $success_message .= " ".$this->l('form_edit')." {$this->subject} "; + + if (!$this->_is_ajax()) { + $success_message .= $this->l('form_or'); + } + } + + if(!$this->unset_back_to_list && !$this->_is_ajax()) + { + $success_message .= " ".$this->l('form_go_back_to_list').""; + } + + $success_message .= '
'; + + echo json_encode(array( + 'success' => true , + 'insert_primary_key' => $insert_result, + 'success_message' => $success_message, + 'success_list_url' => $this->getListSuccessUrl($insert_result) + )); + } + $this->set_echo_and_die(); + } + + protected function validation_layout($validation_result) + { + @ob_end_clean(); + echo json_encode($validation_result); + $this->set_echo_and_die(); + } + + protected function upload_layout($upload_result, $field_name) + { + @ob_end_clean(); + if($upload_result !== false && !is_string($upload_result) && empty($upload_result[0]->error)) + { + echo json_encode( + (object)array( + 'success' => true, + 'files' => $upload_result + )); + } + else + { + $result = (object)array('success' => false); + if(is_string($upload_result)) + $result->message = $upload_result; + if(!empty($upload_result[0]->error)) + $result->message = $upload_result[0]->error; + + echo json_encode($result); + } + + $this->set_echo_and_die(); + } + + protected function delete_file_layout($upload_result) + { + @ob_end_clean(); + if($upload_result !== false) + { + echo json_encode( (object)array( 'success' => true ) ); + } + else + { + echo json_encode((object)array('success' => false)); + } + + $this->set_echo_and_die(); + } + + public function set_css($css_file) + { + $this->css_files[sha1($css_file)] = base_url().$css_file; + } + + public function set_js($js_file) + { + $this->js_files[sha1($js_file)] = base_url().$js_file; + } + + public function set_js_lib($js_file) + { + $this->js_lib_files[sha1($js_file)] = base_url().$js_file; + $this->js_files[sha1($js_file)] = base_url().$js_file; + } + + public function set_js_config($js_file) + { + $this->js_config_files[sha1($js_file)] = base_url().$js_file; + $this->js_files[sha1($js_file)] = base_url().$js_file; + } + + public function is_IE7() + { + return isset($_SERVER['HTTP_USER_AGENT']) + && (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 7') !== false) + ? true : false; + } + + public function get_css_files() + { + return $this->css_files; + } + + public function get_js_files() + { + return $this->js_files; + } + + public function get_js_lib_files() + { + return $this->js_lib_files; + } + + public function get_js_config_files() + { + return $this->js_config_files; + } + + /** + * Load Javascripts + **/ + protected function load_js_fancybox() + { + $this->set_css($this->default_css_path.'/jquery_plugins/fancybox/jquery.fancybox.css'); + + $this->set_js_lib($this->default_javascript_path.'/jquery_plugins/jquery.fancybox-1.3.4.js'); + $this->set_js_lib($this->default_javascript_path.'/jquery_plugins/jquery.easing-1.3.pack.js'); + } + + protected function load_js_chosen() + { + $this->set_css($this->default_css_path.'/jquery_plugins/chosen/chosen.css'); + $this->set_js_lib($this->default_javascript_path.'/jquery_plugins/jquery.chosen.min.js'); + } + + protected function load_js_jqueryui() + { + $this->set_css($this->default_css_path.'/ui/simple/'.grocery_CRUD::JQUERY_UI_CSS); + $this->set_js_lib($this->default_javascript_path.'/jquery_plugins/ui/'.grocery_CRUD::JQUERY_UI_JS); + } + + protected function load_js_uploader() + { + $this->set_css($this->default_css_path.'/ui/simple/'.grocery_CRUD::JQUERY_UI_CSS); + $this->set_css($this->default_css_path.'/jquery_plugins/file_upload/file-uploader.css'); + $this->set_css($this->default_css_path.'/jquery_plugins/file_upload/jquery.fileupload-ui.css'); + + $this->set_js_lib($this->default_javascript_path.'/jquery_plugins/ui/'.grocery_CRUD::JQUERY_UI_JS); + $this->set_js_lib($this->default_javascript_path.'/jquery_plugins/tmpl.min.js'); + $this->set_js_lib($this->default_javascript_path.'/jquery_plugins/load-image.min.js'); + + $this->set_js_lib($this->default_javascript_path.'/jquery_plugins/jquery.iframe-transport.js'); + $this->set_js_lib($this->default_javascript_path.'/jquery_plugins/jquery.fileupload.js'); + $this->set_js_config($this->default_javascript_path.'/jquery_plugins/config/jquery.fileupload.config.js'); + } + + protected function get_layout() + { + $js_files = $this->get_js_files(); + $css_files = $this->get_css_files(); + + $js_lib_files = $this->get_js_lib_files(); + $js_config_files = $this->get_js_config_files(); + + if ($this->unset_jquery) { + unset($js_files[sha1($this->default_javascript_path.'/'.grocery_CRUD::JQUERY)]); + } + + if ($this->unset_jquery_ui) { + unset($css_files[sha1($this->default_css_path.'/ui/simple/'.grocery_CRUD::JQUERY_UI_CSS)]); + unset($js_files[sha1($this->default_javascript_path.'/jquery_plugins/ui/'.grocery_CRUD::JQUERY_UI_JS)]); + } + + if ($this->unset_bootstrap) { + unset($js_files[sha1($this->default_theme_path.'/bootstrap/js/bootstrap/dropdown.js')]); + unset($js_files[sha1($this->default_theme_path.'/bootstrap/js/bootstrap/modal.js')]); + unset($js_files[sha1($this->default_theme_path.'/bootstrap/js/bootstrap/dropdown.min.js')]); + unset($js_files[sha1($this->default_theme_path.'/bootstrap/js/bootstrap/modal.min.js')]); + unset($css_files[sha1($this->default_theme_path.'/bootstrap/css/bootstrap/bootstrap.css')]); + unset($css_files[sha1($this->default_theme_path.'/bootstrap/css/bootstrap/bootstrap.min.css')]); + } + + if($this->echo_and_die === false) + { + /** Initialize JavaScript variables */ + $js_vars = array( + 'default_javascript_path' => base_url().$this->default_javascript_path, + 'default_css_path' => base_url().$this->default_css_path, + 'default_texteditor_path' => base_url().$this->default_texteditor_path, + 'default_theme_path' => base_url().$this->default_theme_path, + 'base_url' => base_url() + ); + $this->_add_js_vars($js_vars); + + return (object)array( + 'js_files' => $js_files, + 'js_lib_files' => $js_lib_files, + 'js_config_files' => $js_config_files, + 'css_files' => $css_files, + 'output' => $this->views_as_string, + ); + } + elseif($this->echo_and_die === true) + { + echo $this->views_as_string; + die(); + } + } + + protected function update_layout($update_result = false, $state_info = null) + { + @ob_end_clean(); + if($update_result === false) + { + echo json_encode(array('success' => $update_result)); + } + else + { + $success_message = ''.$this->l('update_success_message'); + if(!$this->unset_back_to_list && !$this->_is_ajax()) + { + $success_message .= " ".$this->l('form_go_back_to_list').""; + } + $success_message .= '
'; + + echo json_encode(array( + 'success' => true , + 'insert_primary_key' => $update_result, + 'success_message' => $success_message, + 'success_list_url' => $this->getListSuccessUrl($state_info->primary_key) + )); + } + $this->set_echo_and_die(); + } + + protected function get_integer_input($field_info,$value) + { + $this->set_js_lib($this->default_javascript_path.'/jquery_plugins/jquery.numeric.min.js'); + $this->set_js_config($this->default_javascript_path.'/jquery_plugins/config/jquery.numeric.config.js'); + $extra_attributes = ''; + if(!empty($field_info->db_max_length)) + $extra_attributes .= "maxlength='{$field_info->db_max_length}'"; + $input = ""; + return $input; + } + + protected function get_true_false_input($field_info,$value) + { + $this->set_css($this->default_css_path.'/jquery_plugins/uniform/uniform.default.css'); + $this->set_js_lib($this->default_javascript_path.'/jquery_plugins/jquery.uniform.min.js'); + $this->set_js_config($this->default_javascript_path.'/jquery_plugins/config/jquery.uniform.config.js'); + + $value_is_null = empty($value) && $value !== '0' && $value !== 0 ? true : false; + + $input = ""; + + return $input; + } + + protected function get_string_input($field_info,$value) + { + $value = !is_string($value) ? '' : str_replace('"',""",$value); + + $extra_attributes = ''; + if(!empty($field_info->db_max_length)) + $extra_attributes .= "maxlength='{$field_info->db_max_length}'"; + $input = ""; + return $input; + } + + protected function get_text_input($field_info,$value) + { + if($field_info->extras == 'text_editor') + { + $editor = $this->config->default_text_editor; + switch ($editor) { + case 'ckeditor': + $this->set_js_lib($this->default_texteditor_path.'/ckeditor/ckeditor.js'); + $this->set_js_lib($this->default_texteditor_path.'/ckeditor/adapters/jquery.js'); + $this->set_js_config($this->default_javascript_path.'/jquery_plugins/config/jquery.ckeditor.config.js'); + break; + + case 'tinymce': + $this->set_js_lib($this->default_texteditor_path.'/tiny_mce/jquery.tinymce.js'); + $this->set_js_config($this->default_javascript_path.'/jquery_plugins/config/jquery.tine_mce.config.js'); + break; + + case 'markitup': + $this->set_css($this->default_texteditor_path.'/markitup/skins/markitup/style.css'); + $this->set_css($this->default_texteditor_path.'/markitup/sets/default/style.css'); + + $this->set_js_lib($this->default_texteditor_path.'/markitup/jquery.markitup.js'); + $this->set_js_config($this->default_javascript_path.'/jquery_plugins/config/jquery.markitup.config.js'); + break; + } + + $class_name = $this->config->text_editor_type == 'minimal' ? 'mini-texteditor' : 'texteditor'; + + $input = ""; + } + else + { + $input = ""; + } + return $input; + } + + protected function get_datetime_input($field_info,$value) + { + $this->set_css($this->default_css_path.'/ui/simple/'.grocery_CRUD::JQUERY_UI_CSS); + $this->set_css($this->default_css_path.'/jquery_plugins/jquery.ui.datetime.css'); + $this->set_css($this->default_css_path.'/jquery_plugins/jquery-ui-timepicker-addon.css'); + $this->set_js_lib($this->default_javascript_path.'/jquery_plugins/ui/'.grocery_CRUD::JQUERY_UI_JS); + $this->set_js_lib($this->default_javascript_path.'/jquery_plugins/jquery-ui-timepicker-addon.js'); + + if($this->language !== 'english') + { + include($this->default_config_path.'/language_alias.php'); + if(array_key_exists($this->language, $language_alias)) + { + $i18n_date_js_file = $this->default_javascript_path.'/jquery_plugins/ui/i18n/datepicker/jquery.ui.datepicker-'.$language_alias[$this->language].'.js'; + if(file_exists($i18n_date_js_file)) + { + $this->set_js_lib($i18n_date_js_file); + } + + $i18n_datetime_js_file = $this->default_javascript_path.'/jquery_plugins/ui/i18n/timepicker/jquery-ui-timepicker-'.$language_alias[$this->language].'.js'; + if(file_exists($i18n_datetime_js_file)) + { + $this->set_js_lib($i18n_datetime_js_file); + } + } + } + + $this->set_js_config($this->default_javascript_path.'/jquery_plugins/config/jquery-ui-timepicker-addon.config.js'); + + if(!empty($value) && $value != '0000-00-00 00:00:00' && $value != '1970-01-01 00:00:00'){ + list($year,$month,$day) = explode('-',substr($value,0,10)); + $date = date($this->php_date_format, mktime(0,0,0,$month,$day,$year)); + $datetime = $date.substr($value,10); + } + else + { + $datetime = ''; + } + $input = " + ".$this->l('form_button_clear')." + ({$this->ui_date_format}) hh:mm:ss"; + return $input; + } + + protected function get_hidden_input($field_info,$value) + { + if($field_info->extras !== null && $field_info->extras != false) + $value = $field_info->extras; + $input = ""; + return $input; + } + + protected function get_password_input($field_info,$value) + { + $value = !is_string($value) ? '' : $value; + + $extra_attributes = ''; + if(!empty($field_info->db_max_length)) + $extra_attributes .= "maxlength='{$field_info->db_max_length}'"; + $input = ""; + return $input; + } + + protected function get_date_input($field_info,$value) + { + $this->set_css($this->default_css_path.'/ui/simple/'.grocery_CRUD::JQUERY_UI_CSS); + $this->set_js_lib($this->default_javascript_path.'/jquery_plugins/ui/'.grocery_CRUD::JQUERY_UI_JS); + + if($this->language !== 'english') + { + include($this->default_config_path.'/language_alias.php'); + if(array_key_exists($this->language, $language_alias)) + { + $i18n_date_js_file = $this->default_javascript_path.'/jquery_plugins/ui/i18n/datepicker/jquery.ui.datepicker-'.$language_alias[$this->language].'.js'; + if(file_exists($i18n_date_js_file)) + { + $this->set_js_lib($i18n_date_js_file); + } + } + } + + $this->set_js_config($this->default_javascript_path.'/jquery_plugins/config/jquery.datepicker.config.js'); + + if(!empty($value) && $value != '0000-00-00' && $value != '1970-01-01') + { + list($year,$month,$day) = explode('-',substr($value,0,10)); + $date = date($this->php_date_format, mktime(0,0,0,$month,$day,$year)); + } + else + { + $date = ''; + } + + $input = " + ".$this->l('form_button_clear')." (".$this->ui_date_format.")"; + return $input; + } + + protected function get_dropdown_input($field_info,$value) + { + $this->load_js_chosen(); + $this->set_js_config($this->default_javascript_path.'/jquery_plugins/config/jquery.chosen.config.js'); + + $select_title = str_replace('{field_display_as}',$field_info->display_as,$this->l('set_relation_title')); + + $input = ""; + return $input; + } + + protected function get_enum_input($field_info,$value) + { + $this->load_js_chosen(); + $this->set_js_config($this->default_javascript_path.'/jquery_plugins/config/jquery.chosen.config.js'); + + $select_title = str_replace('{field_display_as}',$field_info->display_as,$this->l('set_relation_title')); + + $input = ""; + return $input; + } + + protected function get_readonly_input($field_info, $value) + { + $read_only_value = " "; + + if (!empty($value) && !is_array($value)) { + $read_only_value = $value; + } elseif (is_array($value)) { + $all_values = array_values($value); + $read_only_value = implode(", ",$all_values); + } + + return '
+ * $crud->set_crud_url_path(site_url('example/index'));
+ *
+ *
+ * @param string $crud_url_path
+ * @param string $list_url_path
+ * @return grocery_CRUD
+ */
+ public function set_crud_url_path($crud_url_path, $list_url_path = null)
+ {
+ $this->crud_url_path = $crud_url_path;
+
+ //If the list_url_path is empty so we are guessing that the list_url_path
+ //will be the same with crud_url_path
+ $this->list_url_path = !empty($list_url_path) ? $list_url_path : $crud_url_path;
+
+ return $this;
+ }
+
+ /**
+ *
+ * Set a subject to understand what type of CRUD you use.
+ * ----------------------------------------------------------------------------------------------
+ * Subject_plural: Sets the subject to its plural form. For example the plural
+ * of "Customer" is "Customers", "Product" is "Products"... e.t.c.
+ * @example In this CRUD we work with the table db_categories. The $subject will be the 'Category'
+ * and the $subject_plural will be 'Categories'
+ * @param string $subject
+ * @param string $subject_plural
+ * @return grocery_CRUD
+ */
+ public function set_subject($subject, $subject_plural = null)
+ {
+ $this->subject = $subject;
+ $this->subject_plural = $subject_plural === null ? $subject : $subject_plural;
+
+ return $this;
+ }
+
+ /**
+ *
+ * Enter description here ...
+ * @param $title
+ * @param $image_url
+ * @param $url
+ * @param $css_class
+ * @param $url_callback
+ */
+ public function add_action( $label, $image_url = '', $link_url = '', $css_class = '', $url_callback = null)
+ {
+ $unique_id = substr($label,0,1).substr(md5($label.$link_url),-8); //The unique id is used for class name so it must begin with a string
+
+ $this->actions[$unique_id] = (object)array(
+ 'label' => $label,
+ 'image_url' => $image_url,
+ 'link_url' => $link_url,
+ 'css_class' => $css_class,
+ 'url_callback' => $url_callback,
+ 'url_has_http' => substr($link_url,0,7) == 'http://' || substr($link_url,0,8) == 'https://' ? true : false
+ );
+
+ return $this;
+ }
+
+ /**
+ *
+ * Set a simple 1-n foreign key relation
+ * @param string $field_name
+ * @param string $related_table
+ * @param string $related_title_field
+ * @param mixed $where_clause
+ * @param string $order_by
+ * @return Grocery_CRUD
+ */
+ public function set_relation($field_name , $related_table, $related_title_field, $where_clause = null, $order_by = null)
+ {
+ $this->relation[$field_name] = array($field_name, $related_table,$related_title_field, $where_clause, $order_by);
+ return $this;
+ }
+
+ /**
+ *
+ * Sets a relation with n-n relationship.
+ * @param string $field_name
+ * @param string $relation_table
+ * @param string $selection_table
+ * @param string $primary_key_alias_to_this_table
+ * @param string $primary_key_alias_to_selection_table
+ * @param string $title_field_selection_table
+ * @param string $priority_field_relation_table
+ * @param mixed $where_clause
+ * @return Grocery_CRUD
+ */
+ public function set_relation_n_n($field_name, $relation_table, $selection_table, $primary_key_alias_to_this_table, $primary_key_alias_to_selection_table , $title_field_selection_table , $priority_field_relation_table = null, $where_clause = null)
+ {
+ $this->relation_n_n[$field_name] =
+ (object)array(
+ 'field_name' => $field_name,
+ 'relation_table' => $relation_table,
+ 'selection_table' => $selection_table,
+ 'primary_key_alias_to_this_table' => $primary_key_alias_to_this_table,
+ 'primary_key_alias_to_selection_table' => $primary_key_alias_to_selection_table ,
+ 'title_field_selection_table' => $title_field_selection_table ,
+ 'priority_field_relation_table' => $priority_field_relation_table,
+ 'where_clause' => $where_clause
+ );
+
+ return $this;
+ }
+
+ /**
+ *
+ * Transform a field to an upload field
+ *
+ * @param string $field_name
+ * @param string $upload_path
+ * @return Grocery_CRUD
+ */
+ public function set_field_upload($field_name, $upload_dir = '', $allowed_file_types = '')
+ {
+ $upload_dir = !empty($upload_dir) && substr($upload_dir,-1,1) == '/'
+ ? substr($upload_dir,0,-1)
+ : $upload_dir;
+ $upload_dir = !empty($upload_dir) ? $upload_dir : 'assets/uploads/files';
+
+ /** Check if the upload Url folder exists. If not then throw an exception **/
+ if (!is_dir(FCPATH.$upload_dir)) {
+ throw new Exception("It seems that the folder \"".FCPATH.$upload_dir."\" for the field name
+ \"".$field_name."\" doesn't exists. Please create the folder and try again.");
+ }
+
+ $this->upload_fields[$field_name] = (object) array(
+ 'field_name' => $field_name,
+ 'upload_path' => $upload_dir,
+ 'allowed_file_types' => $allowed_file_types,
+ 'encrypted_field_name' => $this->_unique_field_name($field_name));
+ return $this;
+ }
+}
+
+if(defined('CI_VERSION'))
+{
+ $ci = &get_instance();
+ $ci->load->library('Form_validation');
+
+ class grocery_CRUD_Form_validation extends CI_Form_validation{
+
+ public $CI;
+ public $_field_data = array();
+ public $_config_rules = array();
+ public $_error_array = array();
+ public $_error_messages = array();
+ public $_error_prefix = ''; + public $_error_suffix = '
'; + public $error_string = ''; + public $_safe_form_data = FALSE; + } +} + +/* + * jQuery File Upload Plugin PHP Example 5.5 + * https://github.com/blueimp/jQuery-File-Upload + * + * Copyright 2010, Sebastian Tschan + * https://blueimp.net + * + * Licensed under the MIT license: + * http://www.opensource.org/licenses/MIT + */ + +class UploadHandler +{ + private $options; + public $default_config_path = null; + + function __construct($options=null) { + $this->options = array( + 'script_url' => $this->getFullUrl().'/'.basename(__FILE__), + 'upload_dir' => dirname(__FILE__).'/files/', + 'upload_url' => $this->getFullUrl().'/files/', + 'param_name' => 'files', + // The php.ini settings upload_max_filesize and post_max_size + // take precedence over the following max_file_size setting: + 'max_file_size' => null, + 'min_file_size' => 1, + 'accept_file_types' => '/.+$/i', + 'max_number_of_files' => null, + // Set the following option to false to enable non-multipart uploads: + 'discard_aborted_uploads' => true, + // Set to true to rotate images based on EXIF meta data, if available: + 'orient_image' => false, + 'image_versions' => array( + // Uncomment the following version to restrict the size of + // uploaded images. You can also add additional versions with + // their own upload directories: + /* + 'large' => array( + 'upload_dir' => dirname(__FILE__).'/files/', + 'upload_url' => dirname($_SERVER['PHP_SELF']).'/files/', + 'max_width' => 1920, + 'max_height' => 1200 + ), + + 'thumbnail' => array( + 'upload_dir' => dirname(__FILE__).'/thumbnails/', + 'upload_url' => $this->getFullUrl().'/thumbnails/', + 'max_width' => 80, + 'max_height' => 80 + ) + */ + ) + ); + if ($options) { + // Or else for PHP >= 5.3.0 use: $this->options = array_replace_recursive($this->options, $options); + foreach($options as $option_name => $option) + { + $this->options[$option_name] = $option; + } + } + } + + function getFullUrl() { + return + (isset($_SERVER['HTTPS']) ? 'https://' : 'http://'). + (isset($_SERVER['REMOTE_USER']) ? $_SERVER['REMOTE_USER'].'@' : ''). + (isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : ($_SERVER['SERVER_NAME']. + (isset($_SERVER['HTTPS']) && $_SERVER['SERVER_PORT'] === 443 || + $_SERVER['SERVER_PORT'] === 80 ? '' : ':'.$_SERVER['SERVER_PORT']))). + substr($_SERVER['SCRIPT_NAME'],0, strrpos($_SERVER['SCRIPT_NAME'], '/')); + } + + private function get_file_object($file_name) { + $file_path = $this->options['upload_dir'].$file_name; + if (is_file($file_path) && $file_name[0] !== '.') { + $file = new stdClass(); + $file->name = $file_name; + $file->size = filesize($file_path); + $file->url = $this->options['upload_url'].rawurlencode($file->name); + foreach($this->options['image_versions'] as $version => $options) { + if (is_file($options['upload_dir'].$file_name)) { + $file->{$version.'_url'} = $options['upload_url'] + .rawurlencode($file->name); + } + } + $file->delete_url = $this->options['script_url'] + .'?file='.rawurlencode($file->name); + $file->delete_type = 'DELETE'; + return $file; + } + return null; + } + + private function get_file_objects() { + return array_values(array_filter(array_map( + array($this, 'get_file_object'), + scandir($this->options['upload_dir']) + ))); + } + + private function create_scaled_image($file_name, $options) { + $file_path = $this->options['upload_dir'].$file_name; + $new_file_path = $options['upload_dir'].$file_name; + list($img_width, $img_height) = @getimagesize($file_path); + if (!$img_width || !$img_height) { + return false; + } + $scale = min( + $options['max_width'] / $img_width, + $options['max_height'] / $img_height + ); + if ($scale > 1) { + $scale = 1; + } + $new_width = $img_width * $scale; + $new_height = $img_height * $scale; + $new_img = @imagecreatetruecolor($new_width, $new_height); + switch (strtolower(substr(strrchr($file_name, '.'), 1))) { + case 'jpg': + case 'jpeg': + $src_img = @imagecreatefromjpeg($file_path); + $write_image = 'imagejpeg'; + break; + case 'gif': + @imagecolortransparent($new_img, @imagecolorallocate($new_img, 0, 0, 0)); + $src_img = @imagecreatefromgif($file_path); + $write_image = 'imagegif'; + break; + case 'png': + @imagecolortransparent($new_img, @imagecolorallocate($new_img, 0, 0, 0)); + @imagealphablending($new_img, false); + @imagesavealpha($new_img, true); + $src_img = @imagecreatefrompng($file_path); + $write_image = 'imagepng'; + break; + default: + $src_img = $image_method = null; + } + $success = $src_img && @imagecopyresampled( + $new_img, + $src_img, + 0, 0, 0, 0, + $new_width, + $new_height, + $img_width, + $img_height + ) && $write_image($new_img, $new_file_path); + // Free up memory (imagedestroy does not delete files): + @imagedestroy($src_img); + @imagedestroy($new_img); + return $success; + } + + private function has_error($uploaded_file, $file, $error) { + if ($error) { + switch($error) { + case UPLOAD_ERR_INI_SIZE: + return 'The uploaded file exceeds the upload_max_filesize directive in php.ini.'; + break; + case UPLOAD_ERR_PARTIAL: + return 'The uploaded file was only partially uploaded.'; + break; + case UPLOAD_ERR_NO_FILE: + return 'No file was uploaded.'; + break; + case UPLOAD_ERR_CANT_WRITE: + return 'Failed to write file to disk.'; + break; + case UPLOAD_ERR_EXTENSION: + return 'File upload stopped by extension.'; + break; + default: + return $error; + break; + } + } + if (!preg_match($this->options['accept_file_types'], $file->name)) { + return 'acceptFileTypes'; + } + if ($uploaded_file && is_uploaded_file($uploaded_file)) { + $file_size = filesize($uploaded_file); + } else { + $file_size = $_SERVER['CONTENT_LENGTH']; + } + + if ($this->options['max_file_size'] && ( + $file_size > $this->options['max_file_size'] || + $file->size > $this->options['max_file_size']) + ) { + return 'maxFileSize'; + } + if ($this->options['min_file_size'] && + $file_size < $this->options['min_file_size']) { + return 'minFileSize'; + } + if (is_int($this->options['max_number_of_files']) && ( + count($this->get_file_objects()) >= $this->options['max_number_of_files']) + ) { + return 'maxNumberOfFiles'; + } + return $error; + } + + private function trim_file_name($name, $type) { + // Remove path information and dots around the filename, to prevent uploading + // into different directories or replacing hidden system files. + // Also remove control characters and spaces (\x00..\x20) around the filename: + $file_name = trim(basename(stripslashes($name)), ".\x00..\x20"); + // Add missing file extension for known image types: + if (strpos($file_name, '.') === false && + preg_match('/^image\/(gif|jpe?g|png)/', $type, $matches)) { + $file_name .= '.'.$matches[1]; + } + + //Ensure that we don't have disallowed characters and add a unique id just to ensure that the file name will be unique + $file_name = substr(uniqid(),-5).'-'.$this->_transliterate_characters($file_name); + + //all the characters has to be lowercase + $file_name = strtolower($file_name); + + return $file_name; + } + + private function _transliterate_characters($file_name) + { + include($this->default_config_path.'/translit_chars.php'); + if ( isset($translit_characters)) + { + $file_name = preg_replace(array_keys($translit_characters), array_values($translit_characters), $file_name); + } + + $file_name = preg_replace("/([^a-zA-Z0-9\.\-\_]+?){1}/i", '-', $file_name); + $file_name = str_replace(" ", "-", $file_name); + + return preg_replace('/\-+/', '-', trim($file_name, '-')); + } + + private function orient_image($file_path) { + $exif = exif_read_data($file_path); + $orientation = intval(@$exif['Orientation']); + if (!in_array($orientation, array(3, 6, 8))) { + return false; + } + $image = @imagecreatefromjpeg($file_path); + switch ($orientation) { + case 3: + $image = @imagerotate($image, 180, 0); + break; + case 6: + $image = @imagerotate($image, 270, 0); + break; + case 8: + $image = @imagerotate($image, 90, 0); + break; + default: + return false; + } + $success = imagejpeg($image, $file_path); + // Free up memory (imagedestroy does not delete files): + @imagedestroy($image); + return $success; + } + + private function handle_file_upload($uploaded_file, $name, $size, $type, $error) { + $file = new stdClass(); + $file->name = $this->trim_file_name($name, $type); + $file->size = intval($size); + $file->type = $type; + $error = $this->has_error($uploaded_file, $file, $error); + if (!$error && $file->name) { + $file_path = $this->options['upload_dir'].$file->name; + $append_file = !$this->options['discard_aborted_uploads'] && + is_file($file_path) && $file->size > filesize($file_path); + clearstatcache(); + if ($uploaded_file && is_uploaded_file($uploaded_file)) { + // multipart/formdata uploads (POST method uploads) + if ($append_file) { + file_put_contents( + $file_path, + fopen($uploaded_file, 'r'), + FILE_APPEND + ); + } else { + move_uploaded_file($uploaded_file, $file_path); + } + } else { + // Non-multipart uploads (PUT method support) + file_put_contents( + $file_path, + fopen('php://input', 'r'), + $append_file ? FILE_APPEND : 0 + ); + } + $file_size = filesize($file_path); + if ($file_size === $file->size) { + if ($this->options['orient_image']) { + $this->orient_image($file_path); + } + $file->url = $this->options['upload_url'].rawurlencode($file->name); + foreach($this->options['image_versions'] as $version => $options) { + if ($this->create_scaled_image($file->name, $options)) { + $file->{$version.'_url'} = $options['upload_url'] + .rawurlencode($file->name); + } + } + } else if ($this->options['discard_aborted_uploads']) { + unlink($file_path); + $file->error = "It seems that this user doesn't have permissions to upload to this folder"; + } + $file->size = $file_size; + $file->delete_url = $this->options['script_url'] + .'?file='.rawurlencode($file->name); + $file->delete_type = 'DELETE'; + } else { + $file->error = $error; + } + return $file; + } + + public function get() { + $file_name = isset($_REQUEST['file']) ? + basename(stripslashes($_REQUEST['file'])) : null; + if ($file_name) { + $info = $this->get_file_object($file_name); + } else { + $info = $this->get_file_objects(); + } + header('Content-type: application/json'); + echo json_encode($info); + } + + public function post() { + if (isset($_REQUEST['_method']) && $_REQUEST['_method'] === 'DELETE') { + return $this->delete(); + } + $upload = isset($_FILES[$this->options['param_name']]) ? + $_FILES[$this->options['param_name']] : null; + $info = array(); + if ($upload && is_array($upload['tmp_name'])) { + foreach ($upload['tmp_name'] as $index => $value) { + $info[] = $this->handle_file_upload( + $upload['tmp_name'][$index], + isset($_SERVER['HTTP_X_FILE_NAME']) ? + $_SERVER['HTTP_X_FILE_NAME'] : $upload['name'][$index], + isset($_SERVER['HTTP_X_FILE_SIZE']) ? + $_SERVER['HTTP_X_FILE_SIZE'] : $upload['size'][$index], + isset($_SERVER['HTTP_X_FILE_TYPE']) ? + $_SERVER['HTTP_X_FILE_TYPE'] : $upload['type'][$index], + $upload['error'][$index] + ); + } + } elseif ($upload || isset($_SERVER['HTTP_X_FILE_NAME'])) { + $info[] = $this->handle_file_upload( + isset($upload['tmp_name']) ? $upload['tmp_name'] : null, + isset($_SERVER['HTTP_X_FILE_NAME']) ? + $_SERVER['HTTP_X_FILE_NAME'] : $upload['name'], + isset($_SERVER['HTTP_X_FILE_SIZE']) ? + $_SERVER['HTTP_X_FILE_SIZE'] : $upload['size'], + isset($_SERVER['HTTP_X_FILE_TYPE']) ? + $_SERVER['HTTP_X_FILE_TYPE'] : $upload['type'], + isset($upload['error']) ? $upload['error'] : null + ); + } + header('Vary: Accept'); + + $redirect = isset($_REQUEST['redirect']) ? + stripslashes($_REQUEST['redirect']) : null; + if ($redirect) { + header('Location: '.sprintf($redirect, rawurlencode($json))); + return; + } + if (isset($_SERVER['HTTP_ACCEPT']) && + (strpos($_SERVER['HTTP_ACCEPT'], 'application/json') !== false)) { + header('Content-type: application/json'); + } else { + header('Content-type: text/plain'); + } + return $info; + } + + public function delete() { + $file_name = isset($_REQUEST['file']) ? + basename(stripslashes($_REQUEST['file'])) : null; + $file_path = $this->options['upload_dir'].$file_name; + $success = is_file($file_path) && $file_name[0] !== '.' && unlink($file_path); + if ($success) { + foreach($this->options['image_versions'] as $version => $options) { + $file = $options['upload_dir'].$file_name; + if (is_file($file)) { + unlink($file); + } + } + } + header('Content-type: application/json'); + echo json_encode($success); + } + +} diff --git a/application/libraries/Rdf.php b/application/libraries/Rdf.php new file mode 100644 index 000000000..76e200fc3 --- /dev/null +++ b/application/libraries/Rdf.php @@ -0,0 +1,18 @@ +image_moo->load("file")->resize(64,40)->save("thumb")->resize(640,480)->save("medium"); + * if ($this->image_moo->errors) print $this->image_moo->display_errors(); + * + * COLOURS! + * Any function that can take a colour as a parameter can take "#RGB", "#RRGGBB" or an array(R,G,B) + * + * image manipulation functions + * ----------------------------------------------------------------------------- + * load($x) - Loads an image file specified by $x - JPG, PNG, GIF supported + * save($x) - Saved the manipulated image (if applicable) to file $x - JPG, PNG, GIF supported + * save_pa($prepend="", $append="", $overwrite=FALSE) - Saves using the original image name but with prepend and append text, e.g. load('moo.jpg')->save_pa('pre_','_app') would save as filename pre_moo_app.jpg + * save_dynamic($filename="") - Saves as a stream output, use filename to return png/jpg/gif etc., default is jpeg + * resize($x,$y,$pad=FALSE) - Proportioanlly resize original image using the bounds $x and $y, if padding is set return image is as defined centralised using BG colour + * resize_crop($x,$y) - Proportioanlly resize original image using the bounds $x and $y but cropped to fill dimensions + * stretch($x,$y) - Take the original image and stretch it to fill new dimensions $x $y + * crop($x1,$y1,$x2,$y2) - Crop the original image using Top left, $x1,$y1 to bottom right $x2,y2. New image size =$x2-x1 x $y2-y1 + * rotate($angle) - Rotates the work image by X degrees, normally 90,180,270 can be any angle.Excess filled with background colour + * load_watermark($filename, $transparent_x=0, $transparent_y=0) - Loads the specified file as the watermark file, if using PNG32/24 use x,y to specify direct positions of colour to use as index + * make_watermark_text($text, $fontfile, $size=16, $colour="#ffffff", $angle=0) - Creates a text watermark + * watermark($position, $offset=8, $abs=FALSE) - Use the loaded watermark, or created text to place a watermark. $position works like NUM PAD key layout, e.g. 7=Top left, 3=Bottom right $offset is the padding/indentation, if $abs is true then use $positiona and $offset as direct values to watermark placement + * border($width,$colour="#000") - Draw a border around the output image X pixels wide in colour specified + * border_3d($width,$rot=0,$opacity=30) - Draw a 3d border (opaque) around the current image $width wise in 0-3 rot positions, $opacity allows you to change how much it effects the picture + * filter($function, $arg1=NULL, $arg2=NULL, $arg3=NULL, $arg4=NULL) -Runs the standard imagefilter GD2 command, see http://www.php.net/manual/en/function.imagefilter.php for details + * round($radius,$invert=FALSE,$corners(array[top left, top right, bottom right, bottom left of true or False)="") default is all on and normal rounding + * shadow($size=4, $direction=3, $colour="#444") - Size in pixels, note that the image will increase by this size, so resize(400,400)->shadoe(4) will give an image 404 pixels in size, Direction works on teh keypad basis like the watermark, so 3 is bottom right, $color if the colour of the shadow. + * ----------------------------------------------------------------------------- + * image helper functions + * display_errors($open = '', $close = '
') - Display errors as Ci standard style + * set_jpeg_quality($x) - quality to wrte jpeg files in for save, default 75 (1-100) + * set_watermark_transparency($x) - the opacity of the watermark 1-100, 1-just about see, 100=solid + * check_gd() - Run to see if you server can use this library + * clear_temp() - Call to clear the temp changes using the master image again + * clear() - Clears all images in memory + * ----------------------------------------------------------------------------- + * + * KNOWN BUGS + * make_watermark_text does not deal with rotation angle correctly, box is cropped + * + * TO DO + * + * THANKS + * Matja for poiting out the save_pa bug (should of tested it!) + * Cahva for posting yet another bug in the save_pa (Man I can be silly sometimes!) + * Cole spotting the resize flaw and providing a fix + * + */ + +class Image_moo +{ + // image vars + private $main_image=""; + private $watermark_image; + private $temp_image; + private $jpeg_quality=75; + private $background_colour="#ffffff"; + private $watermark_method; + + // other + private $filename=""; + + // watermark stuff, opacity + private $watermark_transparency=50; + + // reported errors + public $errors=FALSE; + private $error_msg = array(); + + // image info + public $width=0; + public $height=0; + + function Image_moo() + //---------------------------------------------------------------------------------------------------------- + // create stuff here as needed + //---------------------------------------------------------------------------------------------------------- + { + log_message('debug', "Image Moo Class Initialized"); + } + + private function _clear_errors() + //---------------------------------------------------------------------------------------------------------- + // load a resource + //---------------------------------------------------------------------------------------------------------- + { + $this->error_msg = array(); + } + + private function set_error($msg) + //---------------------------------------------------------------------------------------------------------- + // Set an error message + //---------------------------------------------------------------------------------------------------------- + { + $this->errors = TRUE; + $this->error_msg[] = $msg; + } + + public function display_errors($open = '', $close = '
') + //---------------------------------------------------------------------------------------------------------- + // returns the errors formatted as needed, same as CI doed + //---------------------------------------------------------------------------------------------------------- + { + $str = ''; + foreach ($this->error_msg as $val) + { + $str .= $open.$val.$close; + } + return $str; + } + + public function check_gd() + //---------------------------------------------------------------------------------------------------------- + // verification util to see if you can use image_moo + //---------------------------------------------------------------------------------------------------------- + { + if ( ! extension_loaded('gd')) + { + if ( ! dl('gd.so')) + { + $this->set_error('GD library does not appear to be loaded'); + return FALSE; + } + } + if (function_exists('gd_info')) + { + $gdarray = @gd_info(); + $versiontxt = ereg_replace('[[:alpha:][:space:]()]+', '', $gdarray['GD Version']); + $versionparts=explode('.',$versiontxt); + if ($versionparts[0]=="2") + { + return TRUE; + } + else + { + $this->set_error('Requires GD2, this reported as '.$versiontxt); + return FALSE; + } + } + else + { + $this->set_error('Could not verify GD version'); + return FALSE; + } + } + + private function _check_image() + //---------------------------------------------------------------------------------------------------------- + // checks that we have an image loaded + //---------------------------------------------------------------------------------------------------------- + { + if (!is_resource($this->main_image)) + { + $this->set_error("No main image loaded!"); + return FALSE; + } + else + { + return TRUE; + } + } + + function save_dynamic($filename="") + //---------------------------------------------------------------------------------------------------------- + // Saves the temp image as a dynamic image + // e.g. direct output to the browser + //---------------------------------------------------------------------------------------------------------- + { + // validate we loaded a main image + if (!$this->_check_image()) return $this; + + // if no operations, copy it for temp save + $this->_copy_to_temp_if_needed(); + + // ok, lets go! + if ($filename=="") $filename=rand(1000,999999).".jpg"; // send as jpeg + $ext = strtoupper(pathinfo($filename, PATHINFO_EXTENSION)); + header("Content-disposition: filename=$filename;"); + header('Content-transfer-Encoding: binary'); + header('Last-modified: '.gmdate('D, d M Y H:i:s')); + switch ($ext) + { + case "GIF" : + header("Content-type: image/gif"); + imagegif($this->temp_image); + return $this; + break; + case "JPG" : + case "JPEG" : + header("Content-type: image/jpeg"); + imagejpeg($this->temp_image, NULL, $this->jpeg_quality); + return $this; + break; + case "PNG" : + header("Content-type: image/png"); + imagepng($this->temp_image); + return $this; + break; + } + $this->set_error('Unable to save, extension not GIF/JPEG/JPG/PNG'); + return $this; + } + + function save_pa($prepend="", $append="", $overwrite=FALSE) + //---------------------------------------------------------------------------------------------------------- + // Saves the temp image as the filename specified, + // overwrite = true of false + //---------------------------------------------------------------------------------------------------------- + { + // validate we loaded a main image + if (!$this->_check_image()) return $this; + + // get current file parts + $parts=pathinfo($this->filename); + + // save + $this->save($parts["dirname"].'/'.$prepend.$parts['filename'].$append.'.'.$parts["extension"], $overwrite); + + return $this; + } + + function save($filename,$overwrite=FALSE) + //---------------------------------------------------------------------------------------------------------- + // Saves the temp image as the filename specified, + // overwrite = true of false + //---------------------------------------------------------------------------------------------------------- + { + // validate we loaded a main image + if (!$this->_check_image()) return $this; + + // if no operations, copy it for temp save + $this->_copy_to_temp_if_needed(); + + // check if it already exists + if (!$overwrite) + { + // don't overwrite, so check for file + if (file_exists($filename)) + { + $this->set_error('File exists, overwrite is FALSE, could not save over file '.$filename); + return $this; + } + } + + // find out the type of file to save + $ext = strtoupper(pathinfo($filename, PATHINFO_EXTENSION)); + switch ($ext) + { + case "GIF" : + imagegif($this->temp_image, $filename); + return $this; + break; + case "JPG" : + case "JPEG" : + imagejpeg($this->temp_image, $filename, $this->jpeg_quality); + return $this; + break; + case "PNG" : + imagepng($this->temp_image, $filename); + return $this; + break; + } + + // invalid filetype?! + $this->set_error('Do no know what '.$ext.' filetype is in filename '.$filename); + return $this; + } + + private function _load_image($filename) + //---------------------------------------------------------------------------------------------------------- + // private function to load a resource + //---------------------------------------------------------------------------------------------------------- + { + // check the request file can be located + if (!file_exists($filename)) + { + $this->set_error('Could not locate file '.$filename); + return FALSE; + } + + // get image info about this file + $image_info=getimagesize($filename); + + // load file depending on mimetype + switch ($image_info["mime"]) + { + case "image/gif" : + return imagecreatefromgif($filename); + break; + case "image/jpeg" : + return imagecreatefromjpeg($filename); + break; + case "image/png" : + return imagecreatefrompng($filename); + break; + } + + // invalid filetype?! + $this->set_error('Unable to load '.$filename.' filetype '.$image_info["mime"].'not recognised'); + return FALSE; + } + + public function load($filename) + //---------------------------------------------------------------------------------------------------------- + // Load an image, public function + //---------------------------------------------------------------------------------------------------------- + { + // new image, reset error messages + $this->_clear_errors(); + + // remove temporary image stored + $this->clear_temp(); + + // save filename + $this->filename=$filename; + + // reset width and height + $this->width = 0; + $this->height = 0; + + // load it + $this->main_image = $this->_load_image($filename); + + // no error, then get the dminesions set + if ($this->main_image <> FALSE) + { + $this->width = imageSX($this->main_image); + $this->height = imageSY($this->main_image); + } + + // return the object + return $this; + } + + public function load_watermark($filename, $transparent_x=NULL, $transparent_y=NULL) + //---------------------------------------------------------------------------------------------------------- + // Load an image, public function + //---------------------------------------------------------------------------------------------------------- + { + if(is_resource($this->watermark_image)) imagedestroy($this->watermark_image); + $this->watermark_image = $this->_load_image($filename); + + if(is_resource($this->watermark_image)) + { + $this->watermark_method = 1; + if(($transparent_x <> NULL) AND ($transparent_y <> NULL)) + { + // get the top left corner colour allocation + $tpcolour = imagecolorat($this->watermark_image, $transparent_x, $transparent_y); + + // set this as the transparent colour + imagecolortransparent($this->watermark_image, $tpcolour); + + // $set diff method + $this->watermark_method = 2; + } + } + + // return this object + return $this; + } + + public function set_watermark_transparency($transparency=50) + //---------------------------------------------------------------------------------------------------------- + // Sets the quality that jpeg will be saved at + //---------------------------------------------------------------------------------------------------------- + { + $this->watermark_transparency = $transparency; + return $this; + } + + public function set_background_colour($colour="#ffffff") + //---------------------------------------------------------------------------------------------------------- + // Sets teh background colour to use on rotation and padding for resize + //---------------------------------------------------------------------------------------------------------- + { + $this->background_colour = $this->_html2rgb($colour); + return $this; + } + + public function set_jpeg_quality($quality=75) + //---------------------------------------------------------------------------------------------------------- + // Sets the quality that jpeg will be saved at + //---------------------------------------------------------------------------------------------------------- + { + $this->jpeg_quality = $quality; + return $this; + } + + private function _copy_to_temp_if_needed() + //---------------------------------------------------------------------------------------------------------- + // If temp image is empty, e.g. not resized or done anything then just copy main image + //---------------------------------------------------------------------------------------------------------- + { + if (!is_resource($this->temp_image)) + { + // create a temp based on new dimensions + $this->temp_image = imagecreatetruecolor($this->width, $this->height); + + // check it + if(!is_resource($this->temp_image)) + { + $this->set_error('Unable to create temp image sized '.$this->width.' x '.$this->height); + return FALSE; + } + + // copy image to temp workspace + imagecopy($this->temp_image, $this->main_image, 0, 0, 0, 0, $this->width, $this->height); + } + } + + public function clear() + //---------------------------------------------------------------------------------------------------------- + // clear everything! + //---------------------------------------------------------------------------------------------------------- + { + if(is_resource($this->main_image)) imagedestroy($this->main_image); + if(is_resource($this->watermark_image)) imagedestroy($this->watermark_image); + if(is_resource($this->temp_image)) imagedestroy($this->temp_image); + return $this; + } + + public function clear_temp() + //---------------------------------------------------------------------------------------------------------- + // you may want to revert back to teh original image to work on, e.g. watermark, this clears temp + //---------------------------------------------------------------------------------------------------------- + { + if(is_resource($this->temp_image)) imagedestroy($this->temp_image); + return $this; + } + + public function resize_crop($mw,$mh) + //---------------------------------------------------------------------------------------------------------- + // take main image and resize to tempimage using EXACT boundaries mw,mh (max width and max height) + // this is proportional and crops the image centrally to fit + //---------------------------------------------------------------------------------------------------------- + { + if (!$this->_check_image()) return $this; + + // clear temp image + $this->clear_temp(); + + // create a temp based on new dimensions + $this->temp_image = imagecreatetruecolor($mw,$mh); + + // check it + if(!is_resource($this->temp_image)) + { + $this->set_error('Unable to create temp image sized '.$mw.' x '.$mh); + return $this; + } + + // work out best positions for copy + $wx=$this->width / $mw; + $wy=$this->height / $mh; + if ($wx >= $wy) + { + // use full height + $sy = 0; + $sy2 = $this->height; + + // calcs + $calc_width = $mw * $wy; + $sx = ($this->width - $calc_width) / 2; + $sx2 = $calc_width; + } + else + { + // use full width + $sx = 0; + $sx2 = $this->width; + + // calcs + $calc_height = $mh * $wx; + $sy = ($this->height - $calc_height) / 2; + $sy2 = $calc_height; + } + + // copy section + imagecopyresampled($this->temp_image, $this->main_image, 0, 0, $sx, $sy, $mw, $mh, $sx2, $sy2); + return $this; + } + + public function resize($mw, $mh, $pad=FALSE) + //---------------------------------------------------------------------------------------------------------- + // take main image and resize to tempimage using boundaries mw,mh (max width or max height) + // this is proportional, pad to true will set it in the middle of area size + //---------------------------------------------------------------------------------------------------------- + { + if (!$this->_check_image()) return $this; + + // calc new dimensions + if( $this->width > $mw || $this->height > $mh ) { +// if( $this->width > $this->height ) { could calc wronf - Cole Thorsen swapped to his suggestion + if( ($this->width / $this->height) > ($mw / $mh) ) { + $tnw = $mw; + $tnh = $tnw * $this->height / $this->width; + } else { + $tnh = $mh; + $tnw = $tnh * $this->width / $this->height; + } + } else { + $tnw = $this->width; + $tnh = $this->height; + } + // clear temp image + $this->clear_temp(); + + // create a temp based on new dimensions + if ($pad) + { + $tx = $mw; + $ty = $mh; + $px = ($mw - $tnw) / 2; + $py = ($mh - $tnh) / 2; + } + else + { + $tx = $tnw; + $ty = $tnh; + $px = 0; + $py = 0; + } + $this->temp_image = imagecreatetruecolor($tx,$ty); + + // check it + if(!is_resource($this->temp_image)) + { + $this->set_error('Unable to create temp image sized '.$tx.' x '.$ty); + return $this; + } + + // if padding, fill background + if ($pad) + { + $col = $this->_html2rgb($this->background_colour); + $bg = imagecolorallocate($this->temp_image, $col[0], $col[1], $col[2]); + imagefilledrectangle($this->temp_image, 0, 0, $tx, $ty, $bg); + } + + // copy resized + imagecopyresampled($this->temp_image, $this->main_image, $px, $py, 0, 0, $tnw, $tnh, $this->width, $this->height); + return $this; + } + + public function stretch($mw,$mh) + //---------------------------------------------------------------------------------------------------------- + // take main image and resize to tempimage using boundaries mw,mh (max width or max height) + // does not retain proportions + //---------------------------------------------------------------------------------------------------------- + { + if (!$this->_check_image()) return $this; + + // clear temp image + $this->clear_temp(); + + // create a temp based on new dimensions + $this->temp_image = imagecreatetruecolor($mw, $mh); + + // check it + if(!is_resource($this->temp_image)) + { + $this->set_error('Unable to create temp image sized '.$mh.' x '.$mw); + return $this; + } + + // copy resized (stethced, proportions not kept); + imagecopyresampled($this->temp_image, $this->main_image, 0, 0, 0, 0, $mw, $mh, $this->width, $this->height); + return $this; + } + + public function crop($x1, $y1, $x2, $y2) + //---------------------------------------------------------------------------------------------------------- + // crop the main image to temp image using coords + //---------------------------------------------------------------------------------------------------------- + { + if (!$this->_check_image()) return $this; + + // clear temp image + $this->clear_temp(); + + // check dimensions + if ($x1 < 0 || $y1 < 0 || $x2 - $x1 > $this->width || $y2 - $y1 > $this->height) + { + $this->set_error('Invalid crop dimensions, either - passed or width/heigh too large '.$x1.'/'.$y1.' x '.$x2.'/'.$y2); + return $this; + } + + // create a temp based on new dimensions + $this->temp_image = imagecreatetruecolor($x2-$x1, $y2-$y1); + + // check it + if(!is_resource($this->temp_image)) + { + $this->set_error('Unable to create temp image sized '.$x2-$x1.' x '.$y2-$y1); + return $this; + } + + // copy cropped portion + imagecopy($this->temp_image, $this->main_image, 0, 0, $x1, $y1, $x2 - $x1, $y2 - $y1); + return $this; + } + + private function _html2rgb($colour) + //---------------------------------------------------------------------------------------------------------- + // convert #aa0011 to a php colour array + //---------------------------------------------------------------------------------------------------------- + { + if (is_array($colour)) + { + if (count($colour)==3) return $colour; // rgb sent as an array so use it + $this->set_error('Colour error, array sent not 3 elements, expected array(r,g,b)'); + return false; + } + if ($colour[0] == '#') + $colour = substr($colour, 1); + + if (strlen($colour) == 6) + { + list($r, $g, $b) = array($colour[0].$colour[1], + $colour[2].$colour[3], + $colour[4].$colour[5]); + } + elseif (strlen($colour) == 3) + { + list($r, $g, $b) = array($colour[0].$colour[0], $colour[1].$colour[1], $colour[2].$colour[2]); + } + else + { + $this->set_error('Colour error, value sent not #RRGGBB or RRGGBB, and not array(r,g,b)'); + return false; + } + + $r = hexdec($r); $g = hexdec($g); $b = hexdec($b); + + return array($r, $g, $b); + } + + public function rotate($angle) + //---------------------------------------------------------------------------------------------------------- + // rotate an image bu 0 / 90 / 180 / 270 degrees + //---------------------------------------------------------------------------------------------------------- + { + // validate we loaded a main image + if (!$this->_check_image()) return $this; + + // if no operations, copy it for temp save + $this->_copy_to_temp_if_needed(); + + // set the colour + $col = $this->_html2rgb($$this->background_colour); + $bg = imagecolorallocate($this->temp_image, $col[0], $col[1], $col[2]); + + // rotate as needed + $this->temp_image = imagerotate($this->temp_image, $angle, $bg); + return $this; + } + + public function make_watermark_text($text, $fontfile, $size=16, $colour="#ffffff", $angle=0) + //---------------------------------------------------------------------------------------------------------- + // create an image from text that can be applied as a watermark + // text is the text to write, $fontile is a ttf file that will be used $size=font size, $colour is the colour of text + //---------------------------------------------------------------------------------------------------------- + { + // check font file can be found + if (!file_exists($fontfile)) + { + $this->set_error('Could not locate font file "'.$fontfile.'"'); + return $this; + } + + // validate we loaded a main image + if (!$this->_check_image()) + { + $remove = TRUE; + // no image loaded so make temp image to use + $this->main_image = imagecreatetruecolor(1000,1000); + } + else + { + $remove = FALSE; + } + + // work out text dimensions + $bbox = imageftbbox($size, $angle, $fontfile, $text); + $bw = abs($bbox[4] - $bbox[0]) + 1; + $bh = abs($bbox[1] - $bbox[5]) + 1; + $bl = $bbox[1]; + + // use this to create watermark image + if(is_resource($this->watermark_image)) imagedestroy($this->watermark_image); + $this->watermark_image = imagecreatetruecolor($bw, $bh); + + // set colours + $col = $this->_html2rgb($colour); + $font_col = imagecolorallocate($this->watermark_image, $col[0], $col[1], $col[2]); + $bg_col = imagecolorallocate($this->watermark_image, 127, 128, 126); + + // set method to use + $this->watermark_method = 2; + + // create bg + imagecolortransparent($this->watermark_image, $bg_col); + imagefilledrectangle($this->watermark_image, 0,0, $bw, $bh, $bg_col); + + // write text to watermark + imagefttext($this->watermark_image, $size, $angle, 0, $bh-$bl, $font_col, $fontfile, $text); + + if ($remove) imagedestroy($this->main_image); + return $this; + } + + public function watermark($position, $offset=8, $abs=FALSE) + //---------------------------------------------------------------------------------------------------------- + // add a watermark to the image + // position works like a keypad e.g. + // 7 8 9 + // 4 5 6 + // 1 2 3 + // offset moves image inwards by x pixels + // if abs is set then $position, $offset = direct placement coords + //---------------------------------------------------------------------------------------------------------- + { + // validate we loaded a main image + if (!$this->_check_image()) return $this; + + // validate we have a watermark + if(!is_resource($this->watermark_image)) + { + $this->set_error("Can't watermark image, no watermark loaded/created"); + return $this; + } + + // if no operations, copy it for temp save + $this->_copy_to_temp_if_needed(); + + // get watermark width + $wm_w = imageSX($this->watermark_image); + $wm_h = imageSY($this->watermark_image); + + // get temp widths + $temp_w = imageSX($this->temp_image); + $temp_h = imageSY($this->temp_image); + + // check watermark will fit! + if ($wm_w > $temp_w || $wm_h > $temp_h) + { + $this->set_error("Watermark is larger than image. WM: $wm_w x $wm_h Temp image: $temp_w x $temp_h"); + return $this; + } + + if ($abs) + { + // direct placement + $dest_x = $position; + $dest_y = $offset; + } + else + { + // do X position + switch ($position) + { + // x left + case "7": + case "4": + case "1": + $dest_x = $offset; + break; + // x middle + case "8": + case "5": + case "2": + $dest_x = ($temp_w - $wm_w) /2 ; + break; + // x right + case "9": + case "6": + case "3": + $dest_x = $temp_w - $offset - $wm_w; + break; + default: + $dest_x = $offset; + $this->set_error("Watermark position $position not in vlaid range 7,8,9 - 4,5,6 - 1,2,3"); + } + // do y position + switch ($position) + { + // y top + case "7": + case "8": + case "9": + $dest_y = $offset; + break; + // y middle + case "4": + case "5": + case "6": + $dest_y = ($temp_h - $wm_h) /2 ; + break; + // y bottom + case "1": + case "2": + case "3": + $dest_y = $temp_h - $offset - $wm_h; + break; + default: + $dest_y = $offset; + $this->set_error("Watermark position $position not in vlaid range 7,8,9 - 4,5,6 - 1,2,3"); + } + + } + + // copy over temp image to desired location + if ($this->watermark_method == 1) + { + // use back methods to do this, taken from php help files + //$this->imagecopymerge_alpha($this->temp_image, $this->watermark_image, $dest_x, $dest_y, 0, 0, $wm_w, $wm_h, $this->watermark_transparency); + + $opacity=$this->watermark_transparency; + + // creating a cut resource + $cut = imagecreatetruecolor($wm_w, $wm_h); + + // copying that section of the background to the cut + imagecopy($cut, $this->temp_image, 0, 0, $dest_x, $dest_y, $wm_w, $wm_h); + + // inverting the opacity + $opacity = 100 - $opacity; + + // placing the watermark now + imagecopy($cut, $this->watermark_image, 0, 0, 0, 0, $wm_w, $wm_h); + imagecopymerge($this->temp_image, $cut, $dest_x, $dest_y, 0, 0, $wm_w, $wm_h, $opacity); + + } + else + { + // use normal with selected transparency colour + imagecopymerge($this->temp_image, $this->watermark_image, $dest_x, $dest_y, 0, 0, $wm_w, $wm_h, $this->watermark_transparency); + } + + return $this; + } + + public function border($width=5,$colour="#000") + //---------------------------------------------------------------------------------------------------------- + // add a solidborder frame, coloured $colour to the image + //---------------------------------------------------------------------------------------------------------- + { + // validate we loaded a main image + if (!$this->_check_image()) return $this; + + // if no operations, copy it for temp save + $this->_copy_to_temp_if_needed(); + + // get colour set for temp image + $col = $this->_html2rgb($colour); + $border_col = imagecolorallocate($this->temp_image, $col[0], $col[1], $col[2]); + + // get temp widths + $temp_w = imageSX($this->temp_image); + $temp_h = imageSY($this->temp_image); + + // do border + for($x=0;$x<$width;$x++) + { + imagerectangle($this->temp_image, $x, $x, $temp_w-$x-1, $temp_h-$x-1, $border_col); + } + + // return object + return $this; + } + + public function border_3d($width=5,$rot=0,$opacity=30) + //---------------------------------------------------------------------------------------------------------- + // overlay a black white border to make it look 3d + //---------------------------------------------------------------------------------------------------------- + { + // validate we loaded a main image + if (!$this->_check_image()) return $this; + + // if no operations, copy it for temp save + $this->_copy_to_temp_if_needed(); + + // get temp widths + $temp_w = imageSX($this->temp_image); + $temp_h = imageSY($this->temp_image); + + // create temp canvas to merge + $border_image = imagecreatetruecolor($temp_w, $temp_h); + + // create colours + $black = imagecolorallocate($border_image, 0, 0, 0); + $white = imagecolorallocate($border_image, 255, 255, 255); + switch ($rot) + { + case 1 : + $cols=array($white,$black,$white,$black); + break; + case 2 : + $cols=array($black,$black,$white,$white); + break; + case 3 : + $cols=array($black,$white,$black,$white); + break; + default : + $cols=array($white,$white,$black,$black); + } + $bg_col = imagecolorallocate($border_image, 127, 128, 126); + + // create bg + imagecolortransparent($border_image, $bg_col); + imagefilledrectangle($border_image, 0,0, $temp_w, $temp_h, $bg_col); + + // do border + for($x=0;$x<$width;$x++) + { + // top + imageline($border_image, $x, $x, $temp_w-$x-1, $x, $cols[0]); + // left + imageline($border_image, $x, $x, $x, $temp_w-$x-1, $cols[1]); + // bottom + imageline($border_image, $x, $temp_h-$x-1, $temp_w-1-$x, $temp_h-$x-1, $cols[3]); + // right + imageline($border_image, $temp_w-$x-1, $x, $temp_w-$x-1, $temp_h-$x-1, $cols[2]); + } + + // merg with temp image + imagecopymerge($this->temp_image, $border_image, 0, 0, 0, 0, $temp_w, $temp_h, $opacity); + + // clean up + imagedestroy($border_image); + + // return object + return $this; + } + + public function shadow($size=4, $direction=3, $colour="#444") + //---------------------------------------------------------------------------------------------------------- + // add a shadow to an image, this will INCREASE the size of the image + //---------------------------------------------------------------------------------------------------------- + { + // validate we loaded a main image + if (!$this->_check_image()) return $this; + + // if no operations, copy it for temp save + $this->_copy_to_temp_if_needed(); + + // get the current size + $sx = imagesx($this->temp_image); + $sy = imagesy($this->temp_image); + + // new image + $bu_image = imagecreatetruecolor($sx, $sy); + + // check it + if(!is_resource($bu_image)) + { + $this->set_error('Unable to create shadow temp image sized '.$this->width.' x '.$this->height); + return FALSE; + } + + // copy the current image to memory + imagecopy($bu_image, $this->temp_image, 0, 0, 0, 0, $sx, $sy); + + imagedestroy($this->temp_image); + $this->temp_image = imagecreatetruecolor($sx+$size, $sy+$size); + + // fill background colour + $col = $this->_html2rgb($this->background_colour); + $bg = imagecolorallocate($this->temp_image, $col[0], $col[1], $col[2]); + imagefilledrectangle($this->temp_image, 0, 0, $sx+$size, $sy+$size, $bg); + + // work out position + // do X position + switch ($direction) + { + // x left + case "7": + case "4": + case "1": + $sh_x = 0; + $pic_x = $size; + break; + // x middle + case "8": + case "5": + case "2": + $sh_x = $size / 2; + $pic_x = $size / 2; + break; + // x right + case "9": + case "6": + case "3": + $sh_x = $size; + $pic_x = 0; + break; + default: + $sh_x = $size; + $pic_x = 0; + $this->set_error("Shadow position $position not in vlaid range 7,8,9 - 4,5,6 - 1,2,3"); + } + // do y position + switch ($direction) + { + // y top + case "7": + case "8": + case "9": + $sh_y = 0; + $pic_y = $size; + break; + // y middle + case "4": + case "5": + case "6": + $sh_y = $size / 2; + $pic_y = $size / 2; + break; + // y bottom + case "1": + case "2": + case "3": + $sh_y = $size; + $pic_y = 0; + break; + default: + $sh_y = $size; + $pic_y = 0; + $this->set_error("Shadow position $position not in vlaid range 7,8,9 - 4,5,6 - 1,2,3"); + } + + // create the shadow + $shadowcolour = $this->_html2rgb($colour); + $shadow = imagecolorallocate($this->temp_image, $shadowcolour[0], $shadowcolour[1], $shadowcolour[2]); + imagefilledrectangle($this->temp_image, $sh_x, $sh_y, $sh_x+$sx-1, $sh_y+$sy-1, $shadow); + + // copy current image to correct location + imagecopy($this->temp_image, $bu_image, $pic_x, $pic_y, 0, 0, $sx, $sy); + + // clean up and desstroy temp image + imagedestroy($bu_image); + + //return object + return $this; + } + + public function filter($function, $arg1=NULL, $arg2=NULL, $arg3=NULL, $arg4=NULL) + //---------------------------------------------------------------------------------------------------------- + // allows you to use the inbulit gd2 image filters + //---------------------------------------------------------------------------------------------------------- + { + // validate we loaded a main image + if (!$this->_check_image()) return $this; + + // if no operations, copy it for temp save + $this->_copy_to_temp_if_needed(); + + if (!imagefilter($this->temp_image, $function, $arg1, $arg2, $arg3, $arg4)) + { + $this->set_error("Filter $function failed"); + } + + // return object + return $this; + } + + public function round($radius=5,$invert=False,$corners="") + //---------------------------------------------------------------------------------------------------------- + // adds rounded corners to the output + // using a quarter and rotating as you can end up with odd roudning if you draw a whole and use parts + //---------------------------------------------------------------------------------------------------------- + { + // validate we loaded a main image + if (!$this->_check_image()) return $this; + + // if no operations, copy it for temp save + $this->_copy_to_temp_if_needed(); + + // check input + if ($corners=="") $corners=array(True,True,True,True); + if (!is_array($corners) || count($corners)<>4) + { + $this->set_error("Round failed, expected an array of 4 items round(radius,tl,tr,br,bl)"); + return $this; + } + + // create corner + $corner = imagecreatetruecolor($radius, $radius); + + // turn on aa make it nicer + imageantialias($corner, true); + $col = $this->_html2rgb($this->background_colour); + + // use bg col for corners + $bg = imagecolorallocate($corner, $col[0], $col[1], $col[2]); + + // create our transparent colour + $xparent = imagecolorallocate($corner, 127, 128, 126); + imagecolortransparent($corner, $xparent); + if ($invert) + { + // fill and clear bits + imagefilledrectangle($corner, 0, 0, $radius, $radius, $xparent); + imagefilledellipse($corner, 0, 0, ($radius * 2)-1, ($radius * 2)-1, $bg); + } + else + { + // fill and clear bits + imagefilledrectangle($corner, 0, 0, $radius, $radius, $bg); + imagefilledellipse($corner, $radius, $radius, ($radius * 2) , ($radius * 2) , $xparent); + } + + // get temp widths + $temp_w = imageSX($this->temp_image); + $temp_h = imageSY($this->temp_image); + + // do corners + if ($corners[0]) imagecopymerge($this->temp_image, $corner, 0, 0, 0, 0, $radius, $radius, 100); + $corner = imagerotate($corner, 270, 0); + if ($corners[1]) imagecopymerge($this->temp_image, $corner, $temp_w-$radius, 0, 0, 0, $radius, $radius, 100); + $corner = imagerotate($corner, 270, 0); + if ($corners[2]) imagecopymerge($this->temp_image, $corner, $temp_w-$radius, $temp_h-$radius, 0, 0, $radius, $radius, 100); + $corner = imagerotate($corner, 270, 0); + if ($corners[3]) imagecopymerge($this->temp_image, $corner, 0, $temp_h-$radius, 0, 0, $radius, $radius, 100); + + // return object + return $this; + } + + +} +/* End of file image_moo.php */ +/* Location: .system/application/libraries/image_moo.php */ \ No newline at end of file diff --git a/application/libraries/index.html b/application/libraries/index.html new file mode 100755 index 000000000..b702fbc39 --- /dev/null +++ b/application/libraries/index.html @@ -0,0 +1,11 @@ + + + +Directory access is forbidden.
+ + + diff --git a/application/logs/index.html b/application/logs/index.html new file mode 100755 index 000000000..b702fbc39 --- /dev/null +++ b/application/logs/index.html @@ -0,0 +1,11 @@ + + + +Directory access is forbidden.
+ + + diff --git a/application/migrations/20160101010100_init.php b/application/migrations/20160101010100_init.php new file mode 100644 index 000000000..7e6d91d84 --- /dev/null +++ b/application/migrations/20160101010100_init.php @@ -0,0 +1,19 @@ +db->query('CREATE SCHEMA IF NOT EXISTS gis;'); + + } + + public function down() + { + //$this->db->query('DROP SCHEMA IF EXISTS gis;'); + } +} + diff --git a/application/migrations/20160101010101_pk_migrations.php b/application/migrations/20160101010101_pk_migrations.php new file mode 100644 index 000000000..78a5451a5 --- /dev/null +++ b/application/migrations/20160101010101_pk_migrations.php @@ -0,0 +1,21 @@ +db->table_exists('ci_migrations')) + { + $this->db->query('ALTER TABLE ci_migrations ADD CONSTRAINT pk_migrations PRIMARY KEY(version);'); + } + } + + public function down() + { + $this->db->query('ALTER TABLE ci_migrations DROP CONSTRAINT pk_migrations;'); + } +} + diff --git a/application/migrations/20160101010102_add_apikey.php b/application/migrations/20160101010102_add_apikey.php new file mode 100644 index 000000000..58632c167 --- /dev/null +++ b/application/migrations/20160101010102_add_apikey.php @@ -0,0 +1,51 @@ +dbforge->add_field(array( + 'apikey_id' => array( + 'type' => 'INT', + 'constraint' => 5, + 'unsigned' => TRUE, + 'auto_increment' => TRUE + ), + 'key' => array( + 'type' => 'VARCHAR', + 'constraint' => '100', + ), + 'level' => array( + 'type' => 'INT', + 'null' => TRUE, + ), + 'ignore_limits' => array( + 'type' => 'INT', + 'null' => TRUE, + ), + 'date_created' => array( + 'type' => 'DATE', + 'null' => TRUE, + 'default' => 'now()' + ) + )); + $this->dbforge->add_key('apikey_id', TRUE); + if (!$this->db->table_exists('ci_apikey')) + { + $this->dbforge->create_table('ci_apikey'); + } + + if (!$this->db->simple_query("INSERT INTO ci_apikey (key) VALUES ('aufnahme@fhcomplete.org');")) + { + echo "Error DB-Insert!"; + } + } + + public function down() + { + $this->dbforge->drop_table('ci_apikey'); + } +} + diff --git a/application/migrations/20160101010103_create_basedb.php b/application/migrations/20160101010103_create_basedb.php new file mode 100644 index 000000000..43b244c67 --- /dev/null +++ b/application/migrations/20160101010103_create_basedb.php @@ -0,0 +1,33 @@ +load->helper('file'); + $sqlfile = read_file('./system/fhcomplete3.0.sql'); + + if (!$this->db->simple_query($sqlfile)) + { + echo "Error creating Basis DB-Schema!"; + } + } + + public function down() + { + $this->db->simple_query('DROP SCHEMA addon;'); + $this->db->simple_query('DROP SCHEMA bis;'); + $this->db->simple_query('DROP SCHEMA campus;'); + $this->db->simple_query('DROP SCHEMA fue;'); + $this->db->simple_query('DROP SCHEMA kommune;'); + $this->db->simple_query('DROP SCHEMA lehre;'); + $this->db->simple_query('DROP SCHEMA reports;'); + $this->db->simple_query('DROP SCHEMA sync;'); + $this->db->simple_query('DROP SCHEMA system;'); + $this->db->simple_query('DROP SCHEMA testtool;'); + $this->db->simple_query('DROP SCHEMA wawi;'); + } +} + diff --git a/application/models/Person_model.php b/application/models/Person_model.php new file mode 100644 index 000000000..9ff4f17e5 --- /dev/null +++ b/application/models/Person_model.php @@ -0,0 +1,20 @@ +load->database(); + } + + public function get_personen($person_id = FALSE) + { + if ($person_id === FALSE) + { + $query = $this->db->get_where('public.tbl_person', array('vorname' => 'Christian')); + return $query->result_object(); + } + + $query = $this->db->get_where('public.tbl_person', array('person_id' => $person_id)); + return $query->row_object(); + } +} diff --git a/application/models/Studiengang_model.php b/application/models/Studiengang_model.php new file mode 100644 index 000000000..d280a89dd --- /dev/null +++ b/application/models/Studiengang_model.php @@ -0,0 +1,83 @@ +db->order_by($this->id, $this->order); + return $this->db->get($this->table)->result(); + } + + // get data by id + function get_by_id($id) + { + $this->db->where($this->id, $id); + return $this->db->get($this->table)->row(); + } + + // get total rows + function total_rows() { + $this->db->from($this->table); + return $this->db->count_all_results(); + } + + // get data with limit + function index_limit($limit, $start = 0) { + $this->db->order_by($this->id, $this->order); + $this->db->limit($limit, $start); + return $this->db->get($this->table)->result(); + } + + // get search total rows + function search_total_rows($keyword = NULL) { + $this->db->like('', $keyword); + $this->db->from($this->table); + return $this->db->count_all_results(); + } + + // get search data with limit + function search_index_limit($limit, $start = 0, $keyword = NULL) { + $this->db->order_by($this->id, $this->order); + $this->db->like('', $keyword); + $this->db->limit($limit, $start); + return $this->db->get($this->table)->result(); + } + + // insert data + function insert($data) + { + $this->db->insert($this->table, $data); + } + + // update data + function update($id, $data) + { + $this->db->where($this->id, $id); + $this->db->update($this->table, $data); + } + + // delete data + function delete($id) + { + $this->db->where($this->id, $id); + $this->db->delete($this->table); + } + +} + +/* End of file Studiengang_model.php */ +/* Location: ./application/models/Studiengang_model.php */ \ No newline at end of file diff --git a/application/models/grocery_CRUD_model.php b/application/models/grocery_CRUD_model.php new file mode 100755 index 000000000..af811f619 --- /dev/null +++ b/application/models/grocery_CRUD_model.php @@ -0,0 +1,582 @@ + + */ + +// ------------------------------------------------------------------------ + +/** + * Grocery CRUD Model + * + * + * @package grocery CRUD + * @author John SkoumbourdisDirectory access is forbidden.
+ + + diff --git a/application/third_party/index.html b/application/third_party/index.html new file mode 100755 index 000000000..b702fbc39 --- /dev/null +++ b/application/third_party/index.html @@ -0,0 +1,11 @@ + + + +Directory access is forbidden.
+ + + diff --git a/application/views/errors/cli/error_404.php b/application/views/errors/cli/error_404.php new file mode 100755 index 000000000..6984b61e9 --- /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 100755 index 000000000..6984b61e9 --- /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 100755 index 000000000..b702fbc39 --- /dev/null +++ b/application/views/errors/cli/index.html @@ -0,0 +1,11 @@ + + + +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 100755 index 000000000..756ea9d62 --- /dev/null +++ b/application/views/errors/html/error_404.php @@ -0,0 +1,64 @@ + + + + +Type:
+Message:
+Filename: getFile(); ?>
+Line Number: getLine(); ?>
+ + + +Backtrace:
+ getTrace() as $error): ?> + + + +
+ File:
+ Line:
+ Function:
+
Severity:
+Message:
+Filename:
+Line Number:
+ + + +Backtrace:
+ + + + +
+ File:
+ Line:
+ Function:
+
Directory access is forbidden.
+ + + diff --git a/application/views/errors/index.html b/application/views/errors/index.html new file mode 100755 index 000000000..b702fbc39 --- /dev/null +++ b/application/views/errors/index.html @@ -0,0 +1,11 @@ + + + +Directory access is forbidden.
+ + + diff --git a/application/views/example.php b/application/views/example.php new file mode 100644 index 000000000..1241c352b --- /dev/null +++ b/application/views/example.php @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + +© Copyright 2014 -
Created By : Slamet Nurhadi
Page rendered in {elapsed_time} seconds
Directory access is forbidden.
+ + + diff --git a/application/views/person/cli/view.php b/application/views/person/cli/view.php new file mode 100644 index 000000000..2163914d8 --- /dev/null +++ b/application/views/person/cli/view.php @@ -0,0 +1,4 @@ +titelpre,"\n"; +echo $person_item->vorname,' '; +echo $person_item->nachname; diff --git a/application/views/person/index.php b/application/views/person/index.php new file mode 100644 index 000000000..576c094a4 --- /dev/null +++ b/application/views/person/index.php @@ -0,0 +1,11 @@ + + + + +| No | +Action | +
|---|---|
| + | + ),'Read'); + echo ' | '; + echo anchor(site_url('studiengang/update/'.$studiengang->),'Update'); + echo ' | '; + echo anchor(site_url('studiengang/delete/'.$studiengang->),'Delete','onclick="javasciprt: return confirm(\'Are You Sure ?\')"'); + ?> + | +
| Cancel |