aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClaude <longneck@scratchbook.ch>2019-11-24 11:58:37 +0100
committerClaude <longneck@scratchbook.ch>2019-11-24 11:58:37 +0100
commit26cd691cea0057de666a05db3a1fc4ae9dba5edf (patch)
tree8e4e99d2e5db98c7d70fa60e2ad3b8c1e6f69bb1
parentc687068fd45ac7a9d1b8a7f4467ae68f5fa032f3 (diff)
downloadstikked-fit-26cd691cea0057de666a05db3a1fc4ae9dba5edf.tar.gz
stikked-fit-26cd691cea0057de666a05db3a1fc4ae9dba5edf.tar.bz2
stikked-fit-26cd691cea0057de666a05db3a1fc4ae9dba5edf.zip
apply new code formatter
phpfmt using PSR-2 coding style
-rw-r--r--doc/DEVELOPMENT.md6
-rw-r--r--docker/stikked.php114
-rw-r--r--htdocs/application/config/ace_languages.php151
-rw-r--r--htdocs/application/config/auth_ldap.php46
-rw-r--r--htdocs/application/config/autoload.php35
-rw-r--r--htdocs/application/config/codemirror_languages.php1147
-rw-r--r--htdocs/application/config/config.php155
-rw-r--r--htdocs/application/config/constants.php57
-rw-r--r--htdocs/application/config/database.php146
-rw-r--r--htdocs/application/config/doctypes.php24
-rw-r--r--htdocs/application/config/foreign_chars.php109
-rw-r--r--htdocs/application/config/geshi_languages.php489
-rw-r--r--htdocs/application/config/hooks.php13
-rw-r--r--htdocs/application/config/migration.php79
-rw-r--r--htdocs/application/config/mimes.php347
-rw-r--r--htdocs/application/config/profiler.php13
-rw-r--r--htdocs/application/config/routes.php15
-rw-r--r--htdocs/application/config/smileys.php99
-rw-r--r--htdocs/application/config/stikked.php.dist114
-rw-r--r--htdocs/application/config/user_agents.php306
-rw-r--r--htdocs/application/controllers/Api.php398
-rw-r--r--htdocs/application/controllers/Auth.php193
-rw-r--r--htdocs/application/controllers/Backup.php71
-rw-r--r--htdocs/application/controllers/Iphone.php53
-rw-r--r--htdocs/application/controllers/Main.php1912
-rw-r--r--htdocs/application/controllers/Spamadmin.php290
-rw-r--r--htdocs/application/controllers/Theme_assets.php410
-rw-r--r--htdocs/application/controllers/Unittest.php99
-rw-r--r--htdocs/application/core/MY_Loader.php379
-rw-r--r--htdocs/application/helpers/captcha_helper.php813
-rw-r--r--htdocs/application/helpers/json_helper.php96
-rw-r--r--htdocs/application/helpers/language_helper.php90
-rw-r--r--htdocs/application/helpers/recaptcha_helper.php304
-rw-r--r--htdocs/application/models/Languages.php103
-rw-r--r--htdocs/application/models/Pastes.php1978
-rw-r--r--htdocs/index.php259
36 files changed, 5130 insertions, 5783 deletions
diff --git a/doc/DEVELOPMENT.md b/doc/DEVELOPMENT.md
index 4100351..d9d21e7 100644
--- a/doc/DEVELOPMENT.md
+++ b/doc/DEVELOPMENT.md
@@ -2,9 +2,5 @@ You want to improve Stikked? Always welcome! Send us your pull request and you w
Some guidelines:
-* For PHP only files (not views/themes), please run the PHP Beautifier (http://pear.php.net/package/PHP_Beautifier) with the following parameters:
-```
-php_beautifier --indent_tabs -l "IndentStyles(style=bsd) ArrayNested() NewLines(before=function:T_CLASS:if,after=T_COMMENT) ListClassFunction()"
-```
-* Optionally, use https://phpbeautifier.com/ with "Allman style" formatting for smaller segments of PHP-only code
+* Coding style: PSR-2. For PHP files (not views/themes), please run phpfmt (https://marketplace.visualstudio.com/items?itemName=kokororin.vscode-phpfmt).
* Other people may modify your contribution. Don't take that personal; we all want to improve Stikked. Your input is always welcome!
diff --git a/docker/stikked.php b/docker/stikked.php
index 879dd06..fb5fb65 100644
--- a/docker/stikked.php
+++ b/docker/stikked.php
@@ -1,11 +1,13 @@
-<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
+<?php if (!defined('BASEPATH')) {
+ exit('No direct script access allowed');
+}
/**
* Site Name
*
* The name of your site
*
-*/
+ */
$config['site_name'] = 'Stikked';
/**
@@ -13,7 +15,7 @@ $config['site_name'] = 'Stikked';
*
* Set the base URL of Stikked. WITH trailing slash!
*
-*/
+ */
$config['base_url'] = 'http://localhost/';
/**
@@ -22,7 +24,7 @@ $config['base_url'] = 'http://localhost/';
* Credentials for your database
* The database structure will be created automatically
*
-*/
+ */
$config['db_hostname'] = 'mysql';
$config['db_database'] = 'stikked';
$config['db_username'] = 'stikked';
@@ -39,7 +41,7 @@ $config['db_password'] = 'stikked';
* Use underscore as suffix to easily see the tables.
* example: $config['db_prefix'] = 'stikked_';
* use $config['db_prefix'] = ''; if you don't want to use table prefix.
-*/
+ */
$config['db_prefix'] = '';
/**
@@ -49,7 +51,7 @@ $config['db_prefix'] = '';
* Folder name in htdocs/themes/
* Currently: default, bootstrap, gabdark, gabdark3, geocities, snowkat, stikkedizr, cleanwhite, i386
*
-*/
+ */
$config['theme'] = 'default';
/**
@@ -57,7 +59,7 @@ $config['theme'] = 'default';
*
* Whether or not to display the QR code
*
-*/
+ */
$config['qr_enabled'] = true;
/**
@@ -70,7 +72,7 @@ $config['qr_enabled'] = true;
* CodeMirror: ~300kb JS
* ACE: >800kb JS
*
-*/
+ */
$config['js_editor'] = ''; // codemirror, ace, ''
/**
@@ -80,7 +82,7 @@ $config['js_editor'] = ''; // codemirror, ace, ''
* Translate Stikked to your own language, see htdocs/application/language files
* Currently: english, german, swissgerman, spanish, norwegian, danish, portuguese, turkish, french, japanese, polish, russian, chinese-simplified, chinese-traditional, indonesia
*
-*/
+ */
$config['language'] = 'english';
/**
@@ -88,7 +90,7 @@ $config['language'] = 'english';
*
* htdocs/static/asset/ folder must be writeable
*
-*/
+ */
$config['combine_assets'] = false;
/**
@@ -98,7 +100,7 @@ $config['combine_assets'] = false;
* Format: http://php.net/manual/en/function.strtotime.php
* Examples: '+10 seconds', '+1 year', '-1 week'
*
-*/
+ */
$config['content_expiration'] = '-1 week';
/**
@@ -155,11 +157,10 @@ $config['cron_key'] = '';
* polr_url: Your own instance of polr URL-shortener (Download: https://github.com/cydrobolt/polr)
* polr_api: Your polr api key
*
-**/
+ **/
$config['url_shortening_use'] = 'off';
$config['random_url_engines'] = 'googl,bitly'; // Used only in random mode, read comment above for more info
-
// Yourls
$config['yourls_url'] = '';
$config['yourls_signature'] = '';
@@ -178,13 +179,12 @@ $config['bitly_url_api'] = '';
$config['polr_url'] = '';
$config['polr_api'] = '';
-
/**
* Credentials for the backup URL
*
* Basic auth user & pass for the backup URL, accessible via http://yoursite.com/backup
*
-**/
+ **/
$config['backup_user'] = '';
$config['backup_pass'] = '';
@@ -193,7 +193,7 @@ $config['backup_pass'] = '';
*
* Number of pastes per page, on the recent pastes listings.
*
-**/
+ **/
$config['per_page'] = 15;
/**
@@ -202,7 +202,7 @@ $config['per_page'] = 15;
* Require a key to interact with the API.
* Append to all API requests: ?apikey=[yourkey]
*
-**/
+ **/
$config['apikey'] = '';
/**
@@ -215,7 +215,7 @@ $config['apikey'] = '';
* This is useful to maintain a restrictive blocklist
* for spammers and bypass it using the apikey.
*
-**/
+ **/
$config['soft_api'] = false;
/**
@@ -230,7 +230,7 @@ $config['soft_api'] = false;
* disable_shorturl: "Create Shorturl" option will be disabled
* disallow_search_engines: displays a robots.txt that forbids indexing
*
-**/
+ **/
$config['private_only'] = false;
$config['enable_captcha'] = true;
$config['recaptcha_publickey'] = '';
@@ -257,7 +257,7 @@ $config['spamadmin_pass'] = '';
* 40320 (1 month)
* 483840 (1 year)
* 0 (keep forever)
-**/
+ **/
$config['default_expiration'] = 0;
/**
@@ -265,7 +265,7 @@ $config['default_expiration'] = 0;
*
* Preselected language. See application/config/geshi_languages.php for valid values (array keys)
*
-**/
+ **/
$config['default_language'] = 'text';
/**
@@ -276,7 +276,7 @@ $config['default_language'] = 'text';
* Set to random for a random paste to be generated
* NOTE: if changed only pastes from then on will be updated.
*
-**/
+ **/
$config['unknown_poster'] = 'random';
/**
@@ -285,7 +285,7 @@ $config['unknown_poster'] = 'random';
* What name is to be set for untitled pastes.
* DO NOT SET BLANK
* NOTE: if changed only pastes from then on will be updated.
-**/
+ **/
$config['unknown_title'] = 'Untitled';
/**
@@ -294,7 +294,7 @@ $config['unknown_title'] = 'Untitled';
* Weather to require LDAP authenticaiton or not.
* Set to either 'true' to require authentication or 'false' not to.
* NOTE: if changed, set LDAP settings in auth_ldap.php
-**/
+ **/
$config['require_auth'] = false;
/**
@@ -304,7 +304,7 @@ $config['require_auth'] = false;
* Variable $id: the paste_id
* Example: 'http://example.com/$id'
*
-**/
+ **/
$config['displayurl_override'] = '';
/**
@@ -313,36 +313,36 @@ $config['displayurl_override'] = '';
* Words used for when unknown_poster is set to random
*
*
-**/
+ **/
$config['nouns'] = array('Hornbill', 'Elephant', 'Bison', 'Lion', 'Camel', 'Sheep',
-'Monkey', 'Prairie Dog', 'Plover', 'Tapir', 'Capybara', 'Cheetah', 'Flamingo', 'Peccary', 'Eider', 'Porcupine', 'Pelican', 'Dove', 'Crane', 'Tortoise', 'Agouti',
-'Tamarin', 'Pheasant', 'Owl', 'Gibbon', 'Goose', 'Baboon', 'Hamerkop', 'Zebra',
-'Macaw', 'Gibbon', 'Madrill', 'Wolf', 'Stork', 'Armadillo', 'Ostrich', 'Marmoset',
-'Lizard', 'Panda', 'Giraffe', 'Cassowary', 'Kangaroo', 'Gorilla', 'Pheasant',
-'Finch', 'Duck', 'Matamata', 'Teal', 'Macaque', 'Goat', 'Lechwe', 'Ibis', 'Parrot',
-'Parakeet', 'Bongo', 'Pudu', 'Echidna', 'Lemur', 'Bat', 'Curlew', 'Terrapin',
-'Peafowl', 'Duck', 'Owl', 'Parakeet', 'Meerkat', 'Tern', 'Wigeon', 'Pintail',
-'Meerkat', 'Motmot', 'Motmot', 'Shama', 'Dormouse', 'Horse', 'Rhinoceros', 'Sloth',
- 'Mousedeer', 'Treeshrew', 'Bushbaby', 'Guinea Pig', 'Agouti', 'Water Vole', 'Hog',
-'Pig', 'Anoa', 'Octupus', 'Butterfly', 'Cat', 'Kitten', 'Coyote', 'Crocodile',
-'Cockroach', 'Crow', 'Bird', 'Dolphin', 'Earthworm', 'Frog', 'Hamster', 'Hedgehog',
-'Hog', 'Human', 'Hummingbird', 'Iguana', 'Leech', 'Leopard', ' Marten',
-'Mockingbird', 'Mockingjay', 'Mosquito', 'Moth', 'Partdridge', 'Bee', 'Penguin');
+ 'Monkey', 'Prairie Dog', 'Plover', 'Tapir', 'Capybara', 'Cheetah', 'Flamingo', 'Peccary', 'Eider', 'Porcupine', 'Pelican', 'Dove', 'Crane', 'Tortoise', 'Agouti',
+ 'Tamarin', 'Pheasant', 'Owl', 'Gibbon', 'Goose', 'Baboon', 'Hamerkop', 'Zebra',
+ 'Macaw', 'Gibbon', 'Madrill', 'Wolf', 'Stork', 'Armadillo', 'Ostrich', 'Marmoset',
+ 'Lizard', 'Panda', 'Giraffe', 'Cassowary', 'Kangaroo', 'Gorilla', 'Pheasant',
+ 'Finch', 'Duck', 'Matamata', 'Teal', 'Macaque', 'Goat', 'Lechwe', 'Ibis', 'Parrot',
+ 'Parakeet', 'Bongo', 'Pudu', 'Echidna', 'Lemur', 'Bat', 'Curlew', 'Terrapin',
+ 'Peafowl', 'Duck', 'Owl', 'Parakeet', 'Meerkat', 'Tern', 'Wigeon', 'Pintail',
+ 'Meerkat', 'Motmot', 'Motmot', 'Shama', 'Dormouse', 'Horse', 'Rhinoceros', 'Sloth',
+ 'Mousedeer', 'Treeshrew', 'Bushbaby', 'Guinea Pig', 'Agouti', 'Water Vole', 'Hog',
+ 'Pig', 'Anoa', 'Octupus', 'Butterfly', 'Cat', 'Kitten', 'Coyote', 'Crocodile',
+ 'Cockroach', 'Crow', 'Bird', 'Dolphin', 'Earthworm', 'Frog', 'Hamster', 'Hedgehog',
+ 'Hog', 'Human', 'Hummingbird', 'Iguana', 'Leech', 'Leopard', ' Marten',
+ 'Mockingbird', 'Mockingjay', 'Mosquito', 'Moth', 'Partdridge', 'Bee', 'Penguin');
$config['adjectives'] = array('Ample', 'Mature', 'Bulky', 'Burly', 'Capacious',
-'Colossal', 'Commodious', 'Thundering', 'Mammoth', 'Mungo', 'Voluminous',
-'Walloping', 'Tiny', 'Baby', 'Bitty', 'Diminutive', 'Little', 'Paltry', 'Scanty',
-'Trivial', 'Scribby', 'Blush', 'Tinct', 'Colorant', 'Aqua', 'Beige', 'Bistre',
-'Buff', 'Bistre', 'Chartreuse', 'Chocolate', 'Cobalt', 'Coral', 'Cream', 'Crimson',
-'Denim', 'Emerald', 'Gray', 'Gamboge', 'Ivory', 'Mustard', 'Silly', 'Perl',
-'Whipped', 'Violet', 'Harmless', 'Gentle', 'Innocent', 'Reliable', 'Unreliable',
-'Soft', 'Toxic', 'Anorexic', 'Beefy', 'Sexy', 'Morose', 'Rude', 'Ungracious',
-'Abrupt', 'Gracious', 'Queen', 'Cute', 'Edgy', 'Insensitive', 'Round', 'Sharp',
-'Gruff', 'Subtle', 'Crippled', 'Eratic', 'Social', 'Jittery', 'Sole', 'Unique',
-'Botched', 'Tacky', 'Sludgy', 'Stained', 'Wet', 'Soiled', 'Big', 'Small', 'Sloppy',
-'Smelly', 'Funky', 'Putrid', 'Melodic', 'Corrupt', 'Lousy', 'Fiery', 'Red',
-'Sweet', 'Hot', 'Scorching', 'Sweltering', 'Torrid', 'Obese', 'Speedy', 'Flying',
-'Idiotic', 'Chunky', 'Forensic');
+ 'Colossal', 'Commodious', 'Thundering', 'Mammoth', 'Mungo', 'Voluminous',
+ 'Walloping', 'Tiny', 'Baby', 'Bitty', 'Diminutive', 'Little', 'Paltry', 'Scanty',
+ 'Trivial', 'Scribby', 'Blush', 'Tinct', 'Colorant', 'Aqua', 'Beige', 'Bistre',
+ 'Buff', 'Bistre', 'Chartreuse', 'Chocolate', 'Cobalt', 'Coral', 'Cream', 'Crimson',
+ 'Denim', 'Emerald', 'Gray', 'Gamboge', 'Ivory', 'Mustard', 'Silly', 'Perl',
+ 'Whipped', 'Violet', 'Harmless', 'Gentle', 'Innocent', 'Reliable', 'Unreliable',
+ 'Soft', 'Toxic', 'Anorexic', 'Beefy', 'Sexy', 'Morose', 'Rude', 'Ungracious',
+ 'Abrupt', 'Gracious', 'Queen', 'Cute', 'Edgy', 'Insensitive', 'Round', 'Sharp',
+ 'Gruff', 'Subtle', 'Crippled', 'Eratic', 'Social', 'Jittery', 'Sole', 'Unique',
+ 'Botched', 'Tacky', 'Sludgy', 'Stained', 'Wet', 'Soiled', 'Big', 'Small', 'Sloppy',
+ 'Smelly', 'Funky', 'Putrid', 'Melodic', 'Corrupt', 'Lousy', 'Fiery', 'Red',
+ 'Sweet', 'Hot', 'Scorching', 'Sweltering', 'Torrid', 'Obese', 'Speedy', 'Flying',
+ 'Idiotic', 'Chunky', 'Forensic');
/**
*
@@ -350,9 +350,9 @@ $config['adjectives'] = array('Ample', 'Mature', 'Bulky', 'Burly', 'Capacious',
* Words used for expiring pastes
*
*
-**/
+ **/
$config['expires'] = array('expire', 'perish', 'go to its last resting place',
-'go to meet its maker', 'cross the great divide', 'slip away', 'give up the ghost',
-'kick the bucket', 'croak', 'bite the big one', 'check out', 'buy the farm',
-'join the choir invisible', 'shuffle off the mortal coil', 'hop the perch',
-'run down the curtain', 'die', 'self destruct', 'explode');
+ 'go to meet its maker', 'cross the great divide', 'slip away', 'give up the ghost',
+ 'kick the bucket', 'croak', 'bite the big one', 'check out', 'buy the farm',
+ 'join the choir invisible', 'shuffle off the mortal coil', 'hop the perch',
+ 'run down the curtain', 'die', 'self destruct', 'explode');
diff --git a/htdocs/application/config/ace_languages.php b/htdocs/application/config/ace_languages.php
index ea3694c..577ca86 100644
--- a/htdocs/application/config/ace_languages.php
+++ b/htdocs/application/config/ace_languages.php
@@ -1,82 +1,77 @@
-<?php
-/**
- * Class and Function List:
- * Function list:
- * Classes list:
- */
-
-if (!defined('BASEPATH')) exit('No direct script access allowed');
+<?php if (!defined('BASEPATH')) {
+ exit('No direct script access allowed');
+}
//codemirror languages
$config['ace_languages'] = array(
- 'text' => 'text',
- 'html5' => 'html',
- 'css' => 'css',
- 'javascript' => 'javascript',
- 'php' => 'php',
- 'python' => 'python',
- 'ruby' => 'ruby',
- 'lua' => 'lua',
- 'bash' => 'sh',
- 'erlang' => 'erlang',
- 'go' => 'golang',
- 'c' => 'c_cpp',
- 'cpp' => 'c_cpp',
- 'diff' => 'diff',
- 'latex' => 'latex',
- 'sql' => 'sql',
- 'xml' => 'xml',
- '0' => 'text',
- 'abap' => 'abap',
- 'actionscript' => 'actionscript',
- 'actionscript3' => 'actionscript',
- 'ada' => 'ada',
- 'apache' => 'apache_conf',
- 'applescript' => 'applescript',
- 'asm' => 'assembly_x86',
- 'autohotkey' => 'autohotkey',
- 'closure' => 'closure',
- 'cobol' => 'cobol',
- 'coffeescript' => 'coffee',
- 'coffeescript' => 'coffee',
- 'cpp-winapi' => 'c_cpp',
- 'c_loadrunner' => 'c_cpp',
- 'c_mac' => 'c_cpp',
- 'c_winapi' => 'c_cpp',
- 'csharp' => 'csharp',
- 'd' => 'd',
- 'dart' => 'dart',
- 'dot' => 'dot',
- 'eiffel' => 'eiffel',
- 'fortran' => 'fortran',
- 'groovy' => 'groovy',
- 'haskell' => 'haskell',
- 'haxe' => 'haxe',
- 'ini' => 'ini',
- 'io' => 'io',
- 'java' => 'java',
- 'java5' => 'java',
- 'make' => 'makefile',
- 'matlab' => 'matlab',
- 'mysql' => 'mysql',
- 'objc' => 'objectivec',
- 'ocaml' => 'ocaml',
- 'pascal' => 'pascal',
- 'perl' => 'perl',
- 'perl6' => 'perl',
- 'postgresql' => 'pgsql',
- 'powershell' => 'powershell',
- 'prolog' => 'prolog',
- 'properties' => 'properties',
- 'rails' => 'ruby',
- 'rust' => 'rust',
- 'scala' => 'scala',
- 'scheme' => 'scheme',
- 'smarty' => 'smarty',
- 'tcl' => 'tcl',
- 'vala' => 'vala',
- 'vb' => 'vbscript',
- 'verilog' => 'verilog',
- 'vhdl' => 'vhdl',
- 'yaml' => 'yaml',
+ 'text' => 'text',
+ 'html5' => 'html',
+ 'css' => 'css',
+ 'javascript' => 'javascript',
+ 'php' => 'php',
+ 'python' => 'python',
+ 'ruby' => 'ruby',
+ 'lua' => 'lua',
+ 'bash' => 'sh',
+ 'erlang' => 'erlang',
+ 'go' => 'golang',
+ 'c' => 'c_cpp',
+ 'cpp' => 'c_cpp',
+ 'diff' => 'diff',
+ 'latex' => 'latex',
+ 'sql' => 'sql',
+ 'xml' => 'xml',
+ '0' => 'text',
+ 'abap' => 'abap',
+ 'actionscript' => 'actionscript',
+ 'actionscript3' => 'actionscript',
+ 'ada' => 'ada',
+ 'apache' => 'apache_conf',
+ 'applescript' => 'applescript',
+ 'asm' => 'assembly_x86',
+ 'autohotkey' => 'autohotkey',
+ 'closure' => 'closure',
+ 'cobol' => 'cobol',
+ 'coffeescript' => 'coffee',
+ 'coffeescript' => 'coffee',
+ 'cpp-winapi' => 'c_cpp',
+ 'c_loadrunner' => 'c_cpp',
+ 'c_mac' => 'c_cpp',
+ 'c_winapi' => 'c_cpp',
+ 'csharp' => 'csharp',
+ 'd' => 'd',
+ 'dart' => 'dart',
+ 'dot' => 'dot',
+ 'eiffel' => 'eiffel',
+ 'fortran' => 'fortran',
+ 'groovy' => 'groovy',
+ 'haskell' => 'haskell',
+ 'haxe' => 'haxe',
+ 'ini' => 'ini',
+ 'io' => 'io',
+ 'java' => 'java',
+ 'java5' => 'java',
+ 'make' => 'makefile',
+ 'matlab' => 'matlab',
+ 'mysql' => 'mysql',
+ 'objc' => 'objectivec',
+ 'ocaml' => 'ocaml',
+ 'pascal' => 'pascal',
+ 'perl' => 'perl',
+ 'perl6' => 'perl',
+ 'postgresql' => 'pgsql',
+ 'powershell' => 'powershell',
+ 'prolog' => 'prolog',
+ 'properties' => 'properties',
+ 'rails' => 'ruby',
+ 'rust' => 'rust',
+ 'scala' => 'scala',
+ 'scheme' => 'scheme',
+ 'smarty' => 'smarty',
+ 'tcl' => 'tcl',
+ 'vala' => 'vala',
+ 'vb' => 'vbscript',
+ 'verilog' => 'verilog',
+ 'vhdl' => 'vhdl',
+ 'yaml' => 'yaml',
);
diff --git a/htdocs/application/config/auth_ldap.php b/htdocs/application/config/auth_ldap.php
index d1b1c1d..a4a4e24 100644
--- a/htdocs/application/config/auth_ldap.php
+++ b/htdocs/application/config/auth_ldap.php
@@ -1,20 +1,23 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+<?php if (!defined('BASEPATH')) {
+ exit('No direct script access allowed');
+}
+
/*
* This file is part of Auth_Ldap.
- Auth_Ldap is free software: you can redistribute it and/or modify
- it under the terms of the GNU Lesser General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+Auth_Ldap is free software: you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
- Auth_Ldap is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+Auth_Ldap is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with Auth_Ldap. If not, see <http://www.gnu.org/licenses/>.
- *
+You should have received a copy of the GNU General Public License
+along with Auth_Ldap. If not, see <http://www.gnu.org/licenses/>.
+ *
*/
/**
@@ -33,27 +36,26 @@
* login_attribute - LDAP attribute used to check usernames against
* proxy_user - Distinguised name of a proxy user if your LDAP server does not allow anonymous binds
* proxy pass - Password to use with above
- * roles - An array of role names to use within your app. The values are arbitrary.
+ * roles - An array of role names to use within your app. The values are arbitrary.
* The keys themselves represent the
- * "security level," ie
- * if( $security_level >= 3 ) {
- * // Is a power user
- * echo display_info_for_power_users_or_admins();
- * }
+ * "security level," ie
+ * if( $security_level >= 3 ) {
+ * // Is a power user
+ * echo display_info_for_power_users_or_admins();
+ * }
* member_attribute - Attribute to search to determine allowance after successful authentication
* auditlog - Location to log auditable events. Needs to be writeable
* by the web server
*/
-
+
$config['hosts'] = array('ldap.mycompany.com');
$config['ports'] = array(389);
$config['basedn'] = 'dc=mycompany,dc=com';
$config['login_attribute'] = 'uid';
$config['proxy_user'] = '';
$config['proxy_pass'] = '';
-$config['roles'] = array(1 => 'User',
+$config['roles'] = array(1 => 'User',
3 => 'Power User',
5 => 'Administrator');
$config['member_attribute'] = 'memberUid';
-$config['auditlog'] = 'application/logs/audit.log'; // Some place to log attempted logins (separate from message log)
-?>
+$config['auditlog'] = 'application/logs/audit.log'; // Some place to log attempted logins (separate from message log)
diff --git a/htdocs/application/config/autoload.php b/htdocs/application/config/autoload.php
index c83e765..29e0e58 100644
--- a/htdocs/application/config/autoload.php
+++ b/htdocs/application/config/autoload.php
@@ -1,4 +1,7 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+<?php if (!defined('BASEPATH')) {
+ exit('No direct script access allowed');
+}
+
/*
| -------------------------------------------------------------------
| AUTO-LOADER
@@ -25,7 +28,7 @@
| 5. Language files
| 6. Models
|
-*/
+ */
/*
| -------------------------------------------------------------------
@@ -35,11 +38,10 @@
|
| $autoload['packages'] = array(APPPATH.'third_party', '/usr/local/shared');
|
-*/
+ */
$autoload['packages'] = array();
-
/*
| -------------------------------------------------------------------
| Auto-load Libraries
@@ -49,68 +51,63 @@ $autoload['packages'] = array();
|
| Prototype:
|
-| $autoload['libraries'] = array('database', 'session', 'xmlrpc');
-*/
+| $autoload['libraries'] = array('database', 'session', 'xmlrpc');
+ */
$autoload['libraries'] = array('database', 'carabiner');
-
/*
| -------------------------------------------------------------------
| Auto-load Helper Files
| -------------------------------------------------------------------
| Prototype:
|
-| $autoload['helper'] = array('url', 'file');
-*/
+| $autoload['helper'] = array('url', 'file');
+ */
$autoload['helper'] = array('url', 'date', 'language');
-
/*
| -------------------------------------------------------------------
| Auto-load Config files
| -------------------------------------------------------------------
| Prototype:
|
-| $autoload['config'] = array('config1', 'config2');
+| $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('stikked');
-
/*
| -------------------------------------------------------------------
| Auto-load Language files
| -------------------------------------------------------------------
| Prototype:
|
-| $autoload['language'] = array('lang1', 'lang2');
+| $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('stikked');
-
/*
| -------------------------------------------------------------------
| Auto-load Models
| -------------------------------------------------------------------
| Prototype:
|
-| $autoload['model'] = array('model1', 'model2');
+| $autoload['model'] = array('model1', 'model2');
|
-*/
+ */
$autoload['model'] = array();
-
/* End of file autoload.php */
/* Location: ./application/config/autoload.php */
diff --git a/htdocs/application/config/codemirror_languages.php b/htdocs/application/config/codemirror_languages.php
index ea80c18..06fe16f 100644
--- a/htdocs/application/config/codemirror_languages.php
+++ b/htdocs/application/config/codemirror_languages.php
@@ -1,581 +1,576 @@
-<?php
-/**
- * Class and Function List:
- * Function list:
- * Classes list:
- */
-
-if (!defined('BASEPATH')) exit('No direct script access allowed');
+<?php if (!defined('BASEPATH')) {
+ exit('No direct script access allowed');
+}
//codemirror languages
$config['codemirror_languages'] = array(
- 'html5' => array(
- 'mode' => 'htmlmixed',
- 'js' => array(
- array(
- 'codemirror/mode/xml/xml.js'
- ) ,
- array(
- 'codemirror/mode/javascript/javascript.js'
- ) ,
- array(
- 'codemirror/mode/css/css.js'
- ) ,
- array(
- 'codemirror/mode/htmlmixed/htmlmixed.js'
- ) ,
- ) ,
- ) ,
- 'css' => array(
- 'mode' => 'css',
- 'js' => array(
- array(
- 'codemirror/mode/css/css.js'
- ) ,
- ) ,
- ) ,
- 'javascript' => array(
- 'mode' => 'javascript',
- 'js' => array(
- array(
- 'codemirror/mode/javascript/javascript.js'
- ) ,
- ) ,
- ) ,
- 'php' => array(
- 'mode' => 'php',
- 'js' => array(
- array(
- 'codemirror/mode/xml/xml.js'
- ) ,
- array(
- 'codemirror/mode/javascript/javascript.js'
- ) ,
- array(
- 'codemirror/mode/css/css.js'
- ) ,
- array(
- 'codemirror/mode/clike/clike.js'
- ) ,
- array(
- 'codemirror/mode/php/php.js'
- ) ,
- ) ,
- ) ,
- 'python' => array(
- 'mode' => 'python',
- 'js' => array(
- array(
- 'codemirror/mode/python/python.js'
- ) ,
- ) ,
- ) ,
- 'ruby' => array(
- 'mode' => 'ruby',
- 'js' => array(
- array(
- 'codemirror/mode/ruby/ruby.js'
- ) ,
- ) ,
- ) ,
- 'lua' => array(
- 'mode' => 'text/x-lua',
- 'js' => array(
- array(
- 'codemirror/mode/lua/lua.js'
- ) ,
- ) ,
- ) ,
- 'bash' => array(
- 'mode' => 'text/x-sh',
- 'js' => array(
- array(
- 'codemirror/mode/shell/shell.js'
- ) ,
- ) ,
- ) ,
- 'go' => array(
- 'mode' => 'text/x-go',
- 'js' => array(
- array(
- 'codemirror/mode/go/go.js'
- ) ,
- ) ,
- ) ,
- 'c' => array(
- 'mode' => 'text/x-csrc',
- 'js' => array(
- array(
- 'codemirror/mode/clike/clike.js'
- ) ,
- ) ,
- ) ,
- 'cpp' => array(
- 'mode' => 'text/x-c++src',
- 'js' => array(
- array(
- 'codemirror/mode/clike/clike.js'
- ) ,
- ) ,
- ) ,
- 'diff' => array(
- 'mode' => 'diff',
- 'js' => array(
- array(
- 'codemirror/mode/diff/diff.js'
- ) ,
- ) ,
- ) ,
- 'latex' => array(
- 'mode' => 'stex',
- 'js' => array(
- array(
- 'codemirror/mode/stex/stex.js'
- ) ,
- ) ,
- ) ,
- 'sql' => array(
- 'mode' => 'sql',
- 'js' => array(
- array(
- 'codemirror/mode/sql/sql.js'
- ) ,
- ) ,
- ) ,
- 'xml' => array(
- 'mode' => 'xml',
- 'js' => array(
- array(
- 'codemirror/mode/xml/xml.js'
- ) ,
- ) ,
- ) ,
- 'text' => 'Plain Text',
- '4cs' => '4CS',
- '6502acme' => 'MOS 6502',
- '6502kickass' => 'MOS 6502 Kick Assembler',
- '6502tasm' => 'MOS 6502 TASM/64TASS',
- '68000devpac' => 'Motorola 68000 Devpac Assembler',
- 'abap' => 'ABAP',
- 'apl' => array(
- 'mode' => 'apl',
- 'js' => array(
- array(
- 'codemirror/mode/apl/apl.js'
- ) ,
- ) ,
- ) ,
- 'asterisk' => array(
- 'mode' => 'asterisk',
- 'js' => array(
- array(
- 'codemirror/mode/asterisk/asterisk.js'
- ) ,
- ) ,
- ) ,
- 'actionscript' => 'Actionscript',
- 'actionscript3' => 'ActionScript3',
- 'ada' => 'Ada',
- 'algol68' => 'ALGOL 68',
- 'apache' => 'Apache',
- 'applescript' => 'AppleScript',
- 'apt_sources' => 'Apt sources.list',
- 'asm' => 'x86 Assembler',
- 'asp' => 'ASP',
- 'autoconf' => 'autoconf',
- 'autohotkey' => 'Autohotkey',
- 'autoit' => 'AutoIT',
- 'avisynth' => 'AviSynth',
- 'awk' => 'Awk',
- 'bascomavr' => 'BASCOM AVR',
- 'basic4gl' => 'Basic4GL',
- 'bf' => 'Brainfuck',
- 'bibtex' => 'BibTeX',
- 'blitzbasic' => 'BlitzBasic',
- 'bnf' => 'BNF (Backus-Naur form)',
- 'boo' => 'Boo',
- 'c_loadrunner' => array(
- 'mode' => 'text/x-csrc',
- 'js' => array(
- array(
- 'codemirror/mode/clike/clike.js'
- ) ,
- ) ,
- ) ,
- 'c_mac' => array(
- 'mode' => 'text/x-csrc',
- 'js' => array(
- array(
- 'codemirror/mode/clike/clike.js'
- ) ,
- ) ,
- ) ,
- 'caddcl' => 'CAD DCL (Dialog Control Language)',
- 'cadlisp' => 'AutoCAD/IntelliCAD Lisp',
- 'cfdg' => 'CFDG',
- 'cfm' => 'ColdFusion',
- 'chaiscript' => 'ChaiScript',
- 'cil' => 'CIL (Common Intermediate Language)',
- 'clojure' => 'Clojure',
- 'cmake' => 'CMake',
- 'cobol' => 'COBOL',
- 'coffeescript' => 'CoffeeScript',
- 'coffeescript' => array(
- 'mode' => 'text/x-coffeescript',
- 'js' => array(
- array(
- 'codemirror/mode/coffeescript/coffeescript.js'
- ) ,
- ) ,
- ) ,
- 'csharp' => array(
- 'mode' => 'text/x-csharp',
- 'js' => array(
- array(
- 'codemirror/mode/clike/clike.js'
- ) ,
- ) ,
- ) ,
- 'cuesheet' => 'Cuesheet',
- 'd' => array(
- 'mode' => 'd',
- 'js' => array(
- array(
- 'codemirror/mode/d/d.js'
- ) ,
- ) ,
- ) ,
- 'dcs' => 'DCS',
- 'delphi' => 'Delphi (Object Pascal)',
- 'div' => 'DIV',
- 'dos' => 'DOS',
- 'dot' => 'dot',
- 'e' => 'E',
- 'ecmascript' => array(
- 'mode' => 'javascript',
- 'js' => array(
- array(
- 'codemirror/mode/javascript/javascript.js'
- ) ,
- ) ,
- ) ,
- 'eiffel' => 'Eiffel',
- 'email' => 'Email (mbox/eml/RFC format)',
- 'epc' => 'Enerscript',
- 'erlang' => array(
- 'mode' => 'erlang',
- 'js' => array(
- array(
- 'codemirror/mode/erlang/erlang.js'
- ) ,
- ) ,
- ) ,
- 'euphoria' => 'Euphoria',
- 'f1' => 'Formula One',
- 'falcon' => 'Falcon',
- 'fo' => 'fo',
- 'fortran' => 'Fortran',
- 'freebasic' => 'FreeBasic',
- 'fsharp' => 'F#',
- 'gambas' => 'GAMBAS',
- 'gdb' => 'GDB',
- 'genero' => 'Genero',
- 'genie' => 'Genie',
- 'gettext' => 'GNU Gettext .po/.pot',
- 'glsl' => 'glSlang',
- 'gml' => 'GML',
- 'gnuplot' => 'Gnuplot script',
- 'go' => array(
- 'mode' => 'go',
- 'js' => array(
- array(
- 'codemirror/mode/go/go.js'
- ) ,
- ) ,
- ) ,
- 'groovy' => array(
- 'mode' => 'text/x-groovy',
- 'js' => array(
- array(
- 'codemirror/mode/groovy/groovy.js'
- ) ,
- ) ,
- ) ,
- 'gwbasic' => 'GwBasic',
- 'haskell' => array(
- 'mode' => 'text/x-haskell',
- 'js' => array(
- array(
- 'codemirror/mode/haskell/haskell.js'
- ) ,
- ) ,
- ) ,
- 'haxe' => array(
- 'mode' => 'text/x-haxe',
- 'js' => array(
- array(
- 'codemirror/mode/haxe/haxe.js'
- ) ,
- ) ,
- ) ,
- 'hicest' => 'HicEst',
- 'hq9plus' => 'HQ9+',
- 'html4strict' => array(
- 'mode' => 'htmlmixed',
- 'js' => array(
- array(
- 'codemirror/mode/xml/xml.js'
- ) ,
- array(
- 'codemirror/mode/javascript/javascript.js'
- ) ,
- array(
- 'codemirror/mode/css/css.js'
- ) ,
- array(
- 'codemirror/mode/htmlmixed/htmlmixed.js'
- ) ,
- ) ,
- ) ,
- 'icon' => 'Icon',
- 'idl' => 'Unoidl',
- 'ini' => 'INI',
- 'inno' => 'Inno Script',
- 'intercal' => 'INTERCAL',
- 'io' => 'Io',
- 'j' => 'J',
- 'java' => array(
- 'mode' => 'text/x-java',
- 'js' => array(
- array(
- 'codemirror/mode/clike/clike.js'
- ) ,
- ) ,
- ) ,
- 'java5' => array(
- 'mode' => 'text/x-java',
- 'js' => array(
- array(
- 'codemirror/mode/clike/clike.js'
- ) ,
- ) ,
- ) ,
- 'jquery' => array(
- 'mode' => 'javascript',
- 'js' => array(
- array(
- 'codemirror/mode/javascript/javascript.js'
- ) ,
- ) ,
- ) ,
+ 'html5' => array(
+ 'mode' => 'htmlmixed',
+ 'js' => array(
+ array(
+ 'codemirror/mode/xml/xml.js',
+ ),
+ array(
+ 'codemirror/mode/javascript/javascript.js',
+ ),
+ array(
+ 'codemirror/mode/css/css.js',
+ ),
+ array(
+ 'codemirror/mode/htmlmixed/htmlmixed.js',
+ ),
+ ),
+ ),
+ 'css' => array(
+ 'mode' => 'css',
+ 'js' => array(
+ array(
+ 'codemirror/mode/css/css.js',
+ ),
+ ),
+ ),
+ 'javascript' => array(
+ 'mode' => 'javascript',
+ 'js' => array(
+ array(
+ 'codemirror/mode/javascript/javascript.js',
+ ),
+ ),
+ ),
+ 'php' => array(
+ 'mode' => 'php',
+ 'js' => array(
+ array(
+ 'codemirror/mode/xml/xml.js',
+ ),
+ array(
+ 'codemirror/mode/javascript/javascript.js',
+ ),
+ array(
+ 'codemirror/mode/css/css.js',
+ ),
+ array(
+ 'codemirror/mode/clike/clike.js',
+ ),
+ array(
+ 'codemirror/mode/php/php.js',
+ ),
+ ),
+ ),
+ 'python' => array(
+ 'mode' => 'python',
+ 'js' => array(
+ array(
+ 'codemirror/mode/python/python.js',
+ ),
+ ),
+ ),
+ 'ruby' => array(
+ 'mode' => 'ruby',
+ 'js' => array(
+ array(
+ 'codemirror/mode/ruby/ruby.js',
+ ),
+ ),
+ ),
+ 'lua' => array(
+ 'mode' => 'text/x-lua',
+ 'js' => array(
+ array(
+ 'codemirror/mode/lua/lua.js',
+ ),
+ ),
+ ),
+ 'bash' => array(
+ 'mode' => 'text/x-sh',
+ 'js' => array(
+ array(
+ 'codemirror/mode/shell/shell.js',
+ ),
+ ),
+ ),
+ 'go' => array(
+ 'mode' => 'text/x-go',
+ 'js' => array(
+ array(
+ 'codemirror/mode/go/go.js',
+ ),
+ ),
+ ),
+ 'c' => array(
+ 'mode' => 'text/x-csrc',
+ 'js' => array(
+ array(
+ 'codemirror/mode/clike/clike.js',
+ ),
+ ),
+ ),
+ 'cpp' => array(
+ 'mode' => 'text/x-c++src',
+ 'js' => array(
+ array(
+ 'codemirror/mode/clike/clike.js',
+ ),
+ ),
+ ),
+ 'diff' => array(
+ 'mode' => 'diff',
+ 'js' => array(
+ array(
+ 'codemirror/mode/diff/diff.js',
+ ),
+ ),
+ ),
+ 'latex' => array(
+ 'mode' => 'stex',
+ 'js' => array(
+ array(
+ 'codemirror/mode/stex/stex.js',
+ ),
+ ),
+ ),
+ 'sql' => array(
+ 'mode' => 'sql',
+ 'js' => array(
+ array(
+ 'codemirror/mode/sql/sql.js',
+ ),
+ ),
+ ),
+ 'xml' => array(
+ 'mode' => 'xml',
+ 'js' => array(
+ array(
+ 'codemirror/mode/xml/xml.js',
+ ),
+ ),
+ ),
+ 'text' => 'Plain Text',
+ '4cs' => '4CS',
+ '6502acme' => 'MOS 6502',
+ '6502kickass' => 'MOS 6502 Kick Assembler',
+ '6502tasm' => 'MOS 6502 TASM/64TASS',
+ '68000devpac' => 'Motorola 68000 Devpac Assembler',
+ 'abap' => 'ABAP',
+ 'apl' => array(
+ 'mode' => 'apl',
+ 'js' => array(
+ array(
+ 'codemirror/mode/apl/apl.js',
+ ),
+ ),
+ ),
+ 'asterisk' => array(
+ 'mode' => 'asterisk',
+ 'js' => array(
+ array(
+ 'codemirror/mode/asterisk/asterisk.js',
+ ),
+ ),
+ ),
+ 'actionscript' => 'Actionscript',
+ 'actionscript3' => 'ActionScript3',
+ 'ada' => 'Ada',
+ 'algol68' => 'ALGOL 68',
+ 'apache' => 'Apache',
+ 'applescript' => 'AppleScript',
+ 'apt_sources' => 'Apt sources.list',
+ 'asm' => 'x86 Assembler',
+ 'asp' => 'ASP',
+ 'autoconf' => 'autoconf',
+ 'autohotkey' => 'Autohotkey',
+ 'autoit' => 'AutoIT',
+ 'avisynth' => 'AviSynth',
+ 'awk' => 'Awk',
+ 'bascomavr' => 'BASCOM AVR',
+ 'basic4gl' => 'Basic4GL',
+ 'bf' => 'Brainfuck',
+ 'bibtex' => 'BibTeX',
+ 'blitzbasic' => 'BlitzBasic',
+ 'bnf' => 'BNF (Backus-Naur form)',
+ 'boo' => 'Boo',
+ 'c_loadrunner' => array(
+ 'mode' => 'text/x-csrc',
+ 'js' => array(
+ array(
+ 'codemirror/mode/clike/clike.js',
+ ),
+ ),
+ ),
+ 'c_mac' => array(
+ 'mode' => 'text/x-csrc',
+ 'js' => array(
+ array(
+ 'codemirror/mode/clike/clike.js',
+ ),
+ ),
+ ),
+ 'caddcl' => 'CAD DCL (Dialog Control Language)',
+ 'cadlisp' => 'AutoCAD/IntelliCAD Lisp',
+ 'cfdg' => 'CFDG',
+ 'cfm' => 'ColdFusion',
+ 'chaiscript' => 'ChaiScript',
+ 'cil' => 'CIL (Common Intermediate Language)',
+ 'clojure' => 'Clojure',
+ 'cmake' => 'CMake',
+ 'cobol' => 'COBOL',
+ 'coffeescript' => 'CoffeeScript',
+ 'coffeescript' => array(
+ 'mode' => 'text/x-coffeescript',
+ 'js' => array(
+ array(
+ 'codemirror/mode/coffeescript/coffeescript.js',
+ ),
+ ),
+ ),
+ 'csharp' => array(
+ 'mode' => 'text/x-csharp',
+ 'js' => array(
+ array(
+ 'codemirror/mode/clike/clike.js',
+ ),
+ ),
+ ),
+ 'cuesheet' => 'Cuesheet',
+ 'd' => array(
+ 'mode' => 'd',
+ 'js' => array(
+ array(
+ 'codemirror/mode/d/d.js',
+ ),
+ ),
+ ),
+ 'dcs' => 'DCS',
+ 'delphi' => 'Delphi (Object Pascal)',
+ 'div' => 'DIV',
+ 'dos' => 'DOS',
+ 'dot' => 'dot',
+ 'e' => 'E',
+ 'ecmascript' => array(
+ 'mode' => 'javascript',
+ 'js' => array(
+ array(
+ 'codemirror/mode/javascript/javascript.js',
+ ),
+ ),
+ ),
+ 'eiffel' => 'Eiffel',
+ 'email' => 'Email (mbox/eml/RFC format)',
+ 'epc' => 'Enerscript',
+ 'erlang' => array(
+ 'mode' => 'erlang',
+ 'js' => array(
+ array(
+ 'codemirror/mode/erlang/erlang.js',
+ ),
+ ),
+ ),
+ 'euphoria' => 'Euphoria',
+ 'f1' => 'Formula One',
+ 'falcon' => 'Falcon',
+ 'fo' => 'fo',
+ 'fortran' => 'Fortran',
+ 'freebasic' => 'FreeBasic',
+ 'fsharp' => 'F#',
+ 'gambas' => 'GAMBAS',
+ 'gdb' => 'GDB',
+ 'genero' => 'Genero',
+ 'genie' => 'Genie',
+ 'gettext' => 'GNU Gettext .po/.pot',
+ 'glsl' => 'glSlang',
+ 'gml' => 'GML',
+ 'gnuplot' => 'Gnuplot script',
+ 'go' => array(
+ 'mode' => 'go',
+ 'js' => array(
+ array(
+ 'codemirror/mode/go/go.js',
+ ),
+ ),
+ ),
+ 'groovy' => array(
+ 'mode' => 'text/x-groovy',
+ 'js' => array(
+ array(
+ 'codemirror/mode/groovy/groovy.js',
+ ),
+ ),
+ ),
+ 'gwbasic' => 'GwBasic',
+ 'haskell' => array(
+ 'mode' => 'text/x-haskell',
+ 'js' => array(
+ array(
+ 'codemirror/mode/haskell/haskell.js',
+ ),
+ ),
+ ),
+ 'haxe' => array(
+ 'mode' => 'text/x-haxe',
+ 'js' => array(
+ array(
+ 'codemirror/mode/haxe/haxe.js',
+ ),
+ ),
+ ),
+ 'hicest' => 'HicEst',
+ 'hq9plus' => 'HQ9+',
+ 'html4strict' => array(
+ 'mode' => 'htmlmixed',
+ 'js' => array(
+ array(
+ 'codemirror/mode/xml/xml.js',
+ ),
+ array(
+ 'codemirror/mode/javascript/javascript.js',
+ ),
+ array(
+ 'codemirror/mode/css/css.js',
+ ),
+ array(
+ 'codemirror/mode/htmlmixed/htmlmixed.js',
+ ),
+ ),
+ ),
+ 'icon' => 'Icon',
+ 'idl' => 'Unoidl',
+ 'ini' => 'INI',
+ 'inno' => 'Inno Script',
+ 'intercal' => 'INTERCAL',
+ 'io' => 'Io',
+ 'j' => 'J',
+ 'java' => array(
+ 'mode' => 'text/x-java',
+ 'js' => array(
+ array(
+ 'codemirror/mode/clike/clike.js',
+ ),
+ ),
+ ),
+ 'java5' => array(
+ 'mode' => 'text/x-java',
+ 'js' => array(
+ array(
+ 'codemirror/mode/clike/clike.js',
+ ),
+ ),
+ ),
+ 'jquery' => array(
+ 'mode' => 'javascript',
+ 'js' => array(
+ array(
+ 'codemirror/mode/javascript/javascript.js',
+ ),
+ ),
+ ),
- //'kixtart' => 'PHP',
- 'klonec' => 'KLone with C',
- 'klonecpp' => 'KLone with C++',
- 'lb' => 'Liberty BASIC',
- 'lisp' => 'Generic Lisp',
- 'llvm' => 'LLVM',
- 'locobasic' => 'Locomotive Basic (Amstrad CPC series)',
- 'logtalk' => 'Logtalk',
- 'lolcode' => 'LOLcode',
- 'lotusformulas' => '@Formula/@Command',
- 'lotusscript' => 'LotusScript',
- 'lscript' => 'Lightwave Script',
- 'lsl2' => 'Linden Scripting',
- 'm68k' => 'Motorola 68000 Assembler',
- 'magiksf' => 'MagikSF',
- 'make' => 'Make',
- 'mapbasic' => 'MapBasic',
- 'matlab' => 'Matlab M-file',
- 'mirc' => array(
- 'mode' => 'mirc',
- 'js' => array(
- array(
- 'codemirror/mode/mirc/mirc.js'
- ) ,
- ) ,
- ) ,
- 'mmix' => 'MMIX Assembler',
- 'modula2' => 'Modula-2',
- 'modula3' => 'Modula-3',
- 'mpasm' => 'Microchip Assembler',
- 'mxml' => 'MXML',
- 'mysql' => array(
- 'mode' => 'sql',
- 'js' => array(
- array(
- 'codemirror/mode/sql/sql.js'
- ) ,
- ) ,
- ) ,
- 'newlisp' => 'newLISP',
- 'nsis' => 'Nullsoft Scriptable Install System',
- 'oberon2' => 'Oberon-2',
- 'objc' => 'Objective-C',
- 'objeck' => 'Objeck Programming Language',
- 'ocaml' => 'OCaml (Objective Caml)',
- 'ocaml' => array(
- 'mode' => 'text/x-ocaml',
- 'js' => array(
- array(
- 'codemirror/mode/ocaml/ocaml.js'
- ) ,
- ) ,
- ) ,
- 'oobas' => 'OpenOffice.org Basic',
- 'oracle11' => 'Oracle 11i',
- 'oracle8' => 'Oracle 8',
- 'oxygene' => 'Delphi Prism (Oxygene)',
- 'oz' => 'Oz',
- 'pascal' => array(
- 'mode' => 'text/x-pascal',
- 'js' => array(
- array(
- 'codemirror/mode/pascal/pascal.js'
- ) ,
- ) ,
- ) ,
- 'pcre' => 'PCRE',
- 'per' => 'Per (forms)',
- 'perl' => array(
- 'mode' => 'perl',
- 'js' => array(
- array(
- 'codemirror/mode/perl/perl.js'
- ) ,
- ) ,
- ) ,
- 'perl6' => array(
- 'mode' => 'perl',
- 'js' => array(
- array(
- 'codemirror/mode/perl/perl.js'
- ) ,
- ) ,
- ) ,
- 'pf' => 'OpenBSD packet filter',
- 'pic16' => 'PIC16 Assembler',
- 'pike' => 'Pike',
- 'pixelbender' => 'Pixel Bender 1.0',
- 'pli' => 'PL/I',
- 'plsql' => array(
- 'mode' => 'sql',
- 'js' => array(
- array(
- 'codemirror/mode/sql/sql.js'
- ) ,
- ) ,
- ) ,
- 'postgresql' => 'PostgreSQL',
- 'povray' => 'Povray',
- 'powerbuilder' => 'PowerBuilder (PowerScript)',
- 'powershell' => 'PowerShell',
- 'proftpd' => 'ProFTPd',
- 'progress' => 'Progress',
- 'prolog' => 'Prolog',
- 'properties' => array(
- 'mode' => 'text/x-properties',
- 'js' => array(
- array(
- 'codemirror/mode/properties/properties.js'
- ) ,
- ) ,
- ) ,
- 'providex' => 'ProvideX',
- 'purebasic' => 'PureBasic',
- 'q' => array(
- 'mode' => 'text/x-q',
- 'js' => array(
- array(
- 'codemirror/mode/q/q.js'
- ) ,
- ) ,
- ) ,
- 'qbasic' => 'QBasic/QuickBASIC',
- 'rails' => 'Ruby (with Ruby on Rails Framework)',
- 'rebol' => 'Rebol',
- 'reg' => 'Microsoft Registry Editor',
- 'robots' => 'robots.txt',
- 'rpmspec' => 'RPM Spec',
- 'rsplus' => 'R',
- 'sas' => 'SAS',
- 'scala' => array(
- 'mode' => 'scala',
- 'js' => array(
- array(
- 'codemirror/mode/clike/clike.js'
- ) ,
- ) ,
- ) ,
- 'scheme' => array(
- 'mode' => 'text/x-scheme',
- 'js' => array(
- array(
- 'codemirror/mode/scheme/scheme.js'
- ) ,
- ) ,
- ) ,
- 'scilab' => 'SciLab',
- 'sdlbasic' => 'sdlBasic',
- 'smalltalk' => 'Smalltalk',
- 'smarty' => 'Smarty template',
- 'systemverilog' => 'SystemVerilog IEEE 1800-2009(draft8)',
- 'tcl' => array(
- 'mode' => 'text/x-tcl',
- 'js' => array(
- array(
- 'codemirror/mode/tcl/tcl.js'
- ) ,
- ) ,
- ) ,
- 'teraterm' => 'Tera Term Macro',
- 'thinbasic' => 'thinBasic',
- 'tsql' => 'T-SQL',
- 'typoscript' => 'TypoScript',
- 'unicon' => 'Unicon',
- 'uscript' => 'UnrealScript',
- 'vala' => 'Vala',
- 'vb' => array(
- 'mode' => 'text/x-vb',
- 'js' => array(
- array(
- 'codemirror/mode/vb/vb.js'
- ) ,
- ) ,
- ) ,
- 'verilog' => array(
- 'mode' => 'text/x-verilog',
- 'js' => array(
- array(
- 'codemirror/mode/verilog/verilog.js'
- ) ,
- ) ,
- ) ,
- 'vhdl' => 'VHDL',
- 'vim' => 'Vim scripting',
- 'visualfoxpro' => 'Visual FoxPro',
- 'visualprolog' => 'Visual Prolog',
- 'whitespace' => 'Whitespace',
- 'whois' => 'Whois response (RPSL format)',
- 'winbatch' => 'WinBatch',
- 'xbasic' => 'XBasic',
- 'xorg_conf' => 'xorg.conf',
- 'xpp' => 'Axapta/Dynamics Ax X++',
- 'yaml' => array(
- 'mode' => 'text/x-yaml',
- 'js' => array(
- array(
- 'codemirror/mode/yaml/yaml.js'
- ) ,
- ) ,
- ) ,
- 'z80' => array(
- 'mode' => 'text/x-z80',
- 'js' => array(
- array(
- 'codemirror/mode/z80/z80.js'
- ) ,
- ) ,
- ) ,
- 'zxbasic' => 'ZXBasic',
+ //'kixtart' => 'PHP',
+ 'klonec' => 'KLone with C',
+ 'klonecpp' => 'KLone with C++',
+ 'lb' => 'Liberty BASIC',
+ 'lisp' => 'Generic Lisp',
+ 'llvm' => 'LLVM',
+ 'locobasic' => 'Locomotive Basic (Amstrad CPC series)',
+ 'logtalk' => 'Logtalk',
+ 'lolcode' => 'LOLcode',
+ 'lotusformulas' => '@Formula/@Command',
+ 'lotusscript' => 'LotusScript',
+ 'lscript' => 'Lightwave Script',
+ 'lsl2' => 'Linden Scripting',
+ 'm68k' => 'Motorola 68000 Assembler',
+ 'magiksf' => 'MagikSF',
+ 'make' => 'Make',
+ 'mapbasic' => 'MapBasic',
+ 'matlab' => 'Matlab M-file',
+ 'mirc' => array(
+ 'mode' => 'mirc',
+ 'js' => array(
+ array(
+ 'codemirror/mode/mirc/mirc.js',
+ ),
+ ),
+ ),
+ 'mmix' => 'MMIX Assembler',
+ 'modula2' => 'Modula-2',
+ 'modula3' => 'Modula-3',
+ 'mpasm' => 'Microchip Assembler',
+ 'mxml' => 'MXML',
+ 'mysql' => array(
+ 'mode' => 'sql',
+ 'js' => array(
+ array(
+ 'codemirror/mode/sql/sql.js',
+ ),
+ ),
+ ),
+ 'newlisp' => 'newLISP',
+ 'nsis' => 'Nullsoft Scriptable Install System',
+ 'oberon2' => 'Oberon-2',
+ 'objc' => 'Objective-C',
+ 'objeck' => 'Objeck Programming Language',
+ 'ocaml' => 'OCaml (Objective Caml)',
+ 'ocaml' => array(
+ 'mode' => 'text/x-ocaml',
+ 'js' => array(
+ array(
+ 'codemirror/mode/ocaml/ocaml.js',
+ ),
+ ),
+ ),
+ 'oobas' => 'OpenOffice.org Basic',
+ 'oracle11' => 'Oracle 11i',
+ 'oracle8' => 'Oracle 8',
+ 'oxygene' => 'Delphi Prism (Oxygene)',
+ 'oz' => 'Oz',
+ 'pascal' => array(
+ 'mode' => 'text/x-pascal',
+ 'js' => array(
+ array(
+ 'codemirror/mode/pascal/pascal.js',
+ ),
+ ),
+ ),
+ 'pcre' => 'PCRE',
+ 'per' => 'Per (forms)',
+ 'perl' => array(
+ 'mode' => 'perl',
+ 'js' => array(
+ array(
+ 'codemirror/mode/perl/perl.js',
+ ),
+ ),
+ ),
+ 'perl6' => array(
+ 'mode' => 'perl',
+ 'js' => array(
+ array(
+ 'codemirror/mode/perl/perl.js',
+ ),
+ ),
+ ),
+ 'pf' => 'OpenBSD packet filter',
+ 'pic16' => 'PIC16 Assembler',
+ 'pike' => 'Pike',
+ 'pixelbender' => 'Pixel Bender 1.0',
+ 'pli' => 'PL/I',
+ 'plsql' => array(
+ 'mode' => 'sql',
+ 'js' => array(
+ array(
+ 'codemirror/mode/sql/sql.js',
+ ),
+ ),
+ ),
+ 'postgresql' => 'PostgreSQL',
+ 'povray' => 'Povray',
+ 'powerbuilder' => 'PowerBuilder (PowerScript)',
+ 'powershell' => 'PowerShell',
+ 'proftpd' => 'ProFTPd',
+ 'progress' => 'Progress',
+ 'prolog' => 'Prolog',
+ 'properties' => array(
+ 'mode' => 'text/x-properties',
+ 'js' => array(
+ array(
+ 'codemirror/mode/properties/properties.js',
+ ),
+ ),
+ ),
+ 'providex' => 'ProvideX',
+ 'purebasic' => 'PureBasic',
+ 'q' => array(
+ 'mode' => 'text/x-q',
+ 'js' => array(
+ array(
+ 'codemirror/mode/q/q.js',
+ ),
+ ),
+ ),
+ 'qbasic' => 'QBasic/QuickBASIC',
+ 'rails' => 'Ruby (with Ruby on Rails Framework)',
+ 'rebol' => 'Rebol',
+ 'reg' => 'Microsoft Registry Editor',
+ 'robots' => 'robots.txt',
+ 'rpmspec' => 'RPM Spec',
+ 'rsplus' => 'R',
+ 'sas' => 'SAS',
+ 'scala' => array(
+ 'mode' => 'scala',
+ 'js' => array(
+ array(
+ 'codemirror/mode/clike/clike.js',
+ ),
+ ),
+ ),
+ 'scheme' => array(
+ 'mode' => 'text/x-scheme',
+ 'js' => array(
+ array(
+ 'codemirror/mode/scheme/scheme.js',
+ ),
+ ),
+ ),
+ 'scilab' => 'SciLab',
+ 'sdlbasic' => 'sdlBasic',
+ 'smalltalk' => 'Smalltalk',
+ 'smarty' => 'Smarty template',
+ 'systemverilog' => 'SystemVerilog IEEE 1800-2009(draft8)',
+ 'tcl' => array(
+ 'mode' => 'text/x-tcl',
+ 'js' => array(
+ array(
+ 'codemirror/mode/tcl/tcl.js',
+ ),
+ ),
+ ),
+ 'teraterm' => 'Tera Term Macro',
+ 'thinbasic' => 'thinBasic',
+ 'tsql' => 'T-SQL',
+ 'typoscript' => 'TypoScript',
+ 'unicon' => 'Unicon',
+ 'uscript' => 'UnrealScript',
+ 'vala' => 'Vala',
+ 'vb' => array(
+ 'mode' => 'text/x-vb',
+ 'js' => array(
+ array(
+ 'codemirror/mode/vb/vb.js',
+ ),
+ ),
+ ),
+ 'verilog' => array(
+ 'mode' => 'text/x-verilog',
+ 'js' => array(
+ array(
+ 'codemirror/mode/verilog/verilog.js',
+ ),
+ ),
+ ),
+ 'vhdl' => 'VHDL',
+ 'vim' => 'Vim scripting',
+ 'visualfoxpro' => 'Visual FoxPro',
+ 'visualprolog' => 'Visual Prolog',
+ 'whitespace' => 'Whitespace',
+ 'whois' => 'Whois response (RPSL format)',
+ 'winbatch' => 'WinBatch',
+ 'xbasic' => 'XBasic',
+ 'xorg_conf' => 'xorg.conf',
+ 'xpp' => 'Axapta/Dynamics Ax X++',
+ 'yaml' => array(
+ 'mode' => 'text/x-yaml',
+ 'js' => array(
+ array(
+ 'codemirror/mode/yaml/yaml.js',
+ ),
+ ),
+ ),
+ 'z80' => array(
+ 'mode' => 'text/x-z80',
+ 'js' => array(
+ array(
+ 'codemirror/mode/z80/z80.js',
+ ),
+ ),
+ ),
+ 'zxbasic' => 'ZXBasic',
);
diff --git a/htdocs/application/config/config.php b/htdocs/application/config/config.php
index d2feb65..5901149 100644
--- a/htdocs/application/config/config.php
+++ b/htdocs/application/config/config.php
@@ -1,4 +1,6 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+<?php if (!defined('BASEPATH')) {
+ exit('No direct script access allowed');
+}
/*
|--------------------------------------------------------------------------
@@ -8,13 +10,13 @@
| URL to your CodeIgniter root. Typically this will be your base URL,
| WITH a trailing slash:
|
-| http://example.com/
+| http://example.com/
|
| If this is not set then CodeIgniter will guess the protocol, domain and
| path to your installation.
|
-*/
-$config['base_url'] = '';
+ */
+$config['base_url'] = '';
/*
|--------------------------------------------------------------------------
@@ -23,7 +25,7 @@ $config['base_url'] = '';
|
| So that we can track your version.
|
-*/
+ */
$config['stikked_version'] = '0.13.0';
/*
@@ -35,7 +37,7 @@ $config['stikked_version'] = '0.13.0';
| something else. If you are using mod_rewrite to remove the page set this
| variable so that it is blank.
|
-*/
+ */
$config['index_page'] = '';
/*
@@ -47,14 +49,14 @@ $config['index_page'] = '';
| URI string. The default setting of 'AUTO' works for most servers.
| If your links do not seem to work, try one of the other delicious flavors:
|
-| 'AUTO' Default - auto detects
-| 'PATH_INFO' Uses the PATH_INFO
-| 'QUERY_STRING' Uses the QUERY_STRING
-| 'REQUEST_URI' Uses the REQUEST_URI
-| 'ORIG_PATH_INFO' Uses the ORIG_PATH_INFO
+| 'AUTO' Default - auto detects
+| 'PATH_INFO' Uses the PATH_INFO
+| 'QUERY_STRING' Uses the QUERY_STRING
+| 'REQUEST_URI' Uses the REQUEST_URI
+| 'ORIG_PATH_INFO' Uses the ORIG_PATH_INFO
|
-*/
-$config['uri_protocol'] = 'AUTO';
+ */
+$config['uri_protocol'] = 'AUTO';
/*
|--------------------------------------------------------------------------
@@ -65,7 +67,7 @@ $config['uri_protocol'] = 'AUTO';
| For more information please see the user guide:
|
| http://codeigniter.com/user_guide/general/urls.html
-*/
+ */
$config['url_suffix'] = '';
@@ -78,8 +80,8 @@ $config['url_suffix'] = '';
| there is an available translation if you intend to use something other
| than english.
|
-*/
-#$config['language'] = 'english'; #this is configured in config/stikked.php
+ */
+#$config['language'] = 'english'; #this is configured in config/stikked.php
/*
|--------------------------------------------------------------------------
@@ -89,7 +91,7 @@ $config['url_suffix'] = '';
| This determines which character set is used by default in various methods
| that require a character set to be provided.
|
-*/
+ */
$config['charset'] = 'UTF-8';
/*
@@ -100,9 +102,8 @@ $config['charset'] = 'UTF-8';
| If you would like to use the 'hooks' feature you must enable it by
| setting this variable to TRUE (boolean). See the user guide for details.
|
-*/
-$config['enable_hooks'] = FALSE;
-
+ */
+$config['enable_hooks'] = false;
/*
|--------------------------------------------------------------------------
@@ -115,10 +116,9 @@ $config['enable_hooks'] = FALSE;
| http://codeigniter.com/user_guide/general/core_classes.html
| http://codeigniter.com/user_guide/general/creating_libraries.html
|
-*/
+ */
$config['subclass_prefix'] = 'MY_';
-
/*
|--------------------------------------------------------------------------
| Allowed URL Characters
@@ -135,10 +135,9 @@ $config['subclass_prefix'] = 'MY_';
|
| DO NOT CHANGE THIS UNLESS YOU FULLY UNDERSTAND THE REPERCUSSIONS!!
|
-*/
+ */
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-';
-
/*
|--------------------------------------------------------------------------
| Enable Query Strings
@@ -163,12 +162,12 @@ $config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-';
| this feature is enabled, since CodeIgniter is designed primarily to
| use segment based URLs.
|
-*/
-$config['allow_get_array'] = TRUE;
-$config['enable_query_strings'] = FALSE;
-$config['controller_trigger'] = 'c';
-$config['function_trigger'] = 'm';
-$config['directory_trigger'] = 'd'; // experimental not currently in use
+ */
+$config['allow_get_array'] = true;
+$config['enable_query_strings'] = false;
+$config['controller_trigger'] = 'c';
+$config['function_trigger'] = 'm';
+$config['directory_trigger'] = 'd'; // experimental not currently in use
/*
|--------------------------------------------------------------------------
@@ -180,16 +179,16 @@ $config['directory_trigger'] = 'd'; // experimental not currently in use
| 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
+| 0 = Disables logging, Error logging TURNED OFF
+| 1 = Error Messages (including PHP errors)
+| 2 = Debug Messages
+| 3 = Informational Messages
+| 4 = All Messages
|
| For a live site you'll usually only enable Errors (1) to be logged otherwise
| your log files will fill up very fast.
|
-*/
+ */
$config['log_threshold'] = 4;
/*
@@ -200,7 +199,7 @@ $config['log_threshold'] = 4;
| Leave this BLANK unless you would like to set something other than the default
| application/logs/ folder. Use a full server path with trailing slash.
|
-*/
+ */
$config['log_path'] = '';
/*
@@ -211,7 +210,7 @@ $config['log_path'] = '';
| 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';
/*
@@ -222,7 +221,7 @@ $config['log_date_format'] = 'Y-m-d H:i:s';
| Leave this BLANK unless you would like to set something other than the default
| system/cache/ folder. Use a full server path with trailing slash.
|
-*/
+ */
$config['cache_path'] = '';
/*
@@ -233,7 +232,7 @@ $config['cache_path'] = '';
| If you use the Encryption class or the Session class you
| MUST set an encryption key. See the user guide for info.
|
-*/
+ */
$config['encryption_key'] = '';
/*
@@ -243,54 +242,54 @@ $config['encryption_key'] = '';
|
| 'sess_driver'
|
-| The storage driver to use: files, database, redis, memcached
+| The storage driver to use: files, database, redis, memcached
|
| 'sess_cookie_name'
|
-| The session cookie name, must contain only [0-9a-z_-] characters
+| 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.
+| 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.
+| 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 '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.
+| 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!
+| 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.
+| 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.
+| 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.
+| 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'] = 'database';
$config['sess_cookie_name'] = 'stikked';
-$config['sess_expiration'] = 60*60*24*1;
+$config['sess_expiration'] = 60 * 60 * 24 * 1;
$config['sess_save_path'] = 'sessions';
-$config['sess_match_ip'] = FALSE;
+$config['sess_match_ip'] = false;
$config['sess_time_to_update'] = 300;
-$config['sess_regenerate_destroy'] = FALSE;
+$config['sess_regenerate_destroy'] = false;
/*
|--------------------------------------------------------------------------
@@ -306,12 +305,12 @@ $config['sess_regenerate_destroy'] = FALSE;
| 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;
+ */
+$config['cookie_prefix'] = '';
+$config['cookie_domain'] = '';
+$config['cookie_path'] = '/';
+$config['cookie_secure'] = false;
+$config['cookie_httponly'] = false;
/*
|--------------------------------------------------------------------------
@@ -321,8 +320,8 @@ $config['cookie_httponly'] = FALSE;
| Determines whether the XSS filter is always active when GET, POST or
| COOKIE data is encountered
|
-*/
-$config['global_xss_filtering'] = FALSE;
+ */
+$config['global_xss_filtering'] = false;
/*
|--------------------------------------------------------------------------
@@ -335,8 +334,8 @@ $config['global_xss_filtering'] = FALSE;
| 'csrf_token_name' = The token name
| 'csrf_cookie_name' = The cookie name
| 'csrf_expire' = The number in seconds the token should expire.
-*/
-$config['csrf_protection'] = FALSE;
+ */
+$config['csrf_protection'] = false;
$config['csrf_token_name'] = 'csrf_test_name';
$config['csrf_cookie_name'] = 'csrf_cookie_name';
$config['csrf_expire'] = 7200;
@@ -357,8 +356,8 @@ $config['csrf_expire'] = 7200;
| 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;
+ */
+$config['compress_output'] = false;
/*
|--------------------------------------------------------------------------
@@ -370,10 +369,9 @@ $config['compress_output'] = FALSE;
| GMT. See the 'date helper' page of the user guide for information
| regarding date handling.
|
-*/
+ */
$config['time_reference'] = 'local';
-
/*
|--------------------------------------------------------------------------
| Rewrite PHP Short Tags
@@ -383,9 +381,8 @@ $config['time_reference'] = 'local';
| can rewrite the tags on-the-fly, enabling you to utilize that syntax
| in your view files. Options are TRUE or FALSE (boolean)
|
-*/
-$config['rewrite_short_tags'] = FALSE;
-
+ */
+$config['rewrite_short_tags'] = false;
/*
|--------------------------------------------------------------------------
@@ -397,7 +394,7 @@ $config['rewrite_short_tags'] = FALSE;
| header in order to properly identify the visitor's IP address.
| Comma-delimited, e.g. '10.0.1.200,10.0.1.201'
|
-*/
+ */
$config['proxy_ips'] = '';
/*
@@ -407,9 +404,9 @@ $config['proxy_ips'] = '';
|
| The favorite languages, that's at the beginning of the list.
|
-*/
+ */
$config['favorite_languages'] = array('text', 'html5', 'css', 'javascript', 'php', 'python', 'ruby',
- 'lua', 'bash', 'erlang', 'go', 'c', 'cpp', 'diff', 'latex', 'sql', 'xml');
+ 'lua', 'bash', 'erlang', 'go', 'c', 'cpp', 'diff', 'latex', 'sql', 'xml');
/* End of file config.php */
/* Location: ./application/config/config.php */
diff --git a/htdocs/application/config/constants.php b/htdocs/application/config/constants.php
index 18d3b4b..160d342 100644
--- a/htdocs/application/config/constants.php
+++ b/htdocs/application/config/constants.php
@@ -1,5 +1,4 @@
-<?php
-defined('BASEPATH') OR exit('No direct script access allowed');
+<?php defined('BASEPATH') or exit('No direct script access allowed');
/*
|--------------------------------------------------------------------------
@@ -10,8 +9,8 @@ defined('BASEPATH') OR exit('No direct script access allowed');
| error_reporting is disabled, the backtrace will not display, regardless
| of this setting
|
-*/
-defined('SHOW_DEBUG_BACKTRACE') OR define('SHOW_DEBUG_BACKTRACE', TRUE);
+ */
+defined('SHOW_DEBUG_BACKTRACE') or define('SHOW_DEBUG_BACKTRACE', true);
/*
|--------------------------------------------------------------------------
@@ -25,11 +24,11 @@ defined('SHOW_DEBUG_BACKTRACE') OR define('SHOW_DEBUG_BACKTRACE', TRUE);
| user, PHP under CGI with Apache suEXEC, etc.). Octal values should
| always be used to set the mode correctly.
|
-*/
-defined('FILE_READ_MODE') OR define('FILE_READ_MODE', 0644);
-defined('FILE_WRITE_MODE') OR define('FILE_WRITE_MODE', 0666);
-defined('DIR_READ_MODE') OR define('DIR_READ_MODE', 0755);
-defined('DIR_WRITE_MODE') OR define('DIR_WRITE_MODE', 0755);
+ */
+defined('FILE_READ_MODE') or define('FILE_READ_MODE', 0644);
+defined('FILE_WRITE_MODE') or define('FILE_WRITE_MODE', 0666);
+defined('DIR_READ_MODE') or define('DIR_READ_MODE', 0755);
+defined('DIR_WRITE_MODE') or define('DIR_WRITE_MODE', 0755);
/*
|--------------------------------------------------------------------------
@@ -38,15 +37,15 @@ defined('DIR_WRITE_MODE') OR define('DIR_WRITE_MODE', 0755);
|
| These modes are used when working with fopen()/popen()
|
-*/
-defined('FOPEN_READ') OR define('FOPEN_READ', 'rb');
-defined('FOPEN_READ_WRITE') OR define('FOPEN_READ_WRITE', 'r+b');
-defined('FOPEN_WRITE_CREATE_DESTRUCTIVE') OR define('FOPEN_WRITE_CREATE_DESTRUCTIVE', 'wb'); // truncates existing file data, use with care
-defined('FOPEN_READ_WRITE_CREATE_DESTRUCTIVE') OR define('FOPEN_READ_WRITE_CREATE_DESTRUCTIVE', 'w+b'); // truncates existing file data, use with care
-defined('FOPEN_WRITE_CREATE') OR define('FOPEN_WRITE_CREATE', 'ab');
-defined('FOPEN_READ_WRITE_CREATE') OR define('FOPEN_READ_WRITE_CREATE', 'a+b');
-defined('FOPEN_WRITE_CREATE_STRICT') OR define('FOPEN_WRITE_CREATE_STRICT', 'xb');
-defined('FOPEN_READ_WRITE_CREATE_STRICT') OR define('FOPEN_READ_WRITE_CREATE_STRICT', 'x+b');
+ */
+defined('FOPEN_READ') or define('FOPEN_READ', 'rb');
+defined('FOPEN_READ_WRITE') or define('FOPEN_READ_WRITE', 'r+b');
+defined('FOPEN_WRITE_CREATE_DESTRUCTIVE') or define('FOPEN_WRITE_CREATE_DESTRUCTIVE', 'wb'); // truncates existing file data, use with care
+defined('FOPEN_READ_WRITE_CREATE_DESTRUCTIVE') or define('FOPEN_READ_WRITE_CREATE_DESTRUCTIVE', 'w+b'); // truncates existing file data, use with care
+defined('FOPEN_WRITE_CREATE') or define('FOPEN_WRITE_CREATE', 'ab');
+defined('FOPEN_READ_WRITE_CREATE') or define('FOPEN_READ_WRITE_CREATE', 'a+b');
+defined('FOPEN_WRITE_CREATE_STRICT') or define('FOPEN_WRITE_CREATE_STRICT', 'xb');
+defined('FOPEN_READ_WRITE_CREATE_STRICT') or define('FOPEN_READ_WRITE_CREATE_STRICT', 'x+b');
/*
|--------------------------------------------------------------------------
@@ -72,14 +71,14 @@ defined('FOPEN_READ_WRITE_CREATE_STRICT') OR define('FOPEN_READ_WRITE_CREA
| Bash scripting:
| http://tldp.org/LDP/abs/html/exitcodes.html
|
-*/
-defined('EXIT_SUCCESS') OR define('EXIT_SUCCESS', 0); // no errors
-defined('EXIT_ERROR') OR define('EXIT_ERROR', 1); // generic error
-defined('EXIT_CONFIG') OR define('EXIT_CONFIG', 3); // configuration error
-defined('EXIT_UNKNOWN_FILE') OR define('EXIT_UNKNOWN_FILE', 4); // file not found
-defined('EXIT_UNKNOWN_CLASS') OR define('EXIT_UNKNOWN_CLASS', 5); // unknown class
-defined('EXIT_UNKNOWN_METHOD') OR define('EXIT_UNKNOWN_METHOD', 6); // unknown class member
-defined('EXIT_USER_INPUT') OR define('EXIT_USER_INPUT', 7); // invalid user input
-defined('EXIT_DATABASE') OR define('EXIT_DATABASE', 8); // database error
-defined('EXIT__AUTO_MIN') OR define('EXIT__AUTO_MIN', 9); // lowest automatically-assigned error code
-defined('EXIT__AUTO_MAX') OR define('EXIT__AUTO_MAX', 125); // highest automatically-assigned error code
+ */
+defined('EXIT_SUCCESS') or define('EXIT_SUCCESS', 0); // no errors
+defined('EXIT_ERROR') or define('EXIT_ERROR', 1); // generic error
+defined('EXIT_CONFIG') or define('EXIT_CONFIG', 3); // configuration error
+defined('EXIT_UNKNOWN_FILE') or define('EXIT_UNKNOWN_FILE', 4); // file not found
+defined('EXIT_UNKNOWN_CLASS') or define('EXIT_UNKNOWN_CLASS', 5); // unknown class
+defined('EXIT_UNKNOWN_METHOD') or define('EXIT_UNKNOWN_METHOD', 6); // unknown class member
+defined('EXIT_USER_INPUT') or define('EXIT_USER_INPUT', 7); // invalid user input
+defined('EXIT_DATABASE') or define('EXIT_DATABASE', 8); // database error
+defined('EXIT__AUTO_MIN') or define('EXIT__AUTO_MIN', 9); // lowest automatically-assigned error code
+defined('EXIT__AUTO_MAX') or define('EXIT__AUTO_MAX', 125); // highest automatically-assigned error code
diff --git a/htdocs/application/config/database.php b/htdocs/application/config/database.php
index df448d6..5c736a9 100644
--- a/htdocs/application/config/database.php
+++ b/htdocs/application/config/database.php
@@ -1,5 +1,7 @@
-<?php
-if (!defined('BASEPATH')) exit('No direct script access allowed');
+<?php if (!defined('BASEPATH')) {
+ exit('No direct script access allowed');
+}
+
/*
| -------------------------------------------------------------------
| DATABASE CONNECTIVITY SETTINGS
@@ -13,97 +15,91 @@ if (!defined('BASEPATH')) exit('No direct script access allowed');
| EXPLANATION OF VARIABLES
| -------------------------------------------------------------------
|
-| ['dsn'] The full DSN string describe a connection to the database.
-| ['hostname'] The hostname of your database server.
-| ['username'] The username used to connect to the database
-| ['password'] The password used to connect to the database
-| ['database'] The name of the database you want to connect to
-| ['dbdriver'] The database driver. e.g.: mysqli.
-| Currently supported:
-| cubrid, ibase, mssql, mysql, mysqli, oci8,
-| odbc, pdo, postgre, sqlite, sqlite3, sqlsrv
-| ['dbprefix'] You can add an optional prefix, which will be added
-| to the table name when using the Query Builder class
-| ['pconnect'] TRUE/FALSE - Whether to use a persistent connection
-| ['db_debug'] TRUE/FALSE - Whether database errors should be displayed.
-| ['cache_on'] TRUE/FALSE - Enables/disables query caching
-| ['cachedir'] The path to the folder where cache files should be stored
-| ['char_set'] The character set used in communicating with the database
-| ['dbcollat'] The character collation used in communicating with the database
-| NOTE: For MySQL and MySQLi databases, this setting is only used
-| as a backup if your server is running PHP < 5.2.3 or MySQL < 5.0.7
-| (and in table creation queries made with DB Forge).
-| There is an incompatibility in PHP with mysql_real_escape_string() which
-| can make your site vulnerable to SQL injection if you are using a
-| multi-byte character set and are running versions lower than these.
-| Sites using Latin-1 or UTF-8 database character set and collation are unaffected.
-| ['swap_pre'] A default table prefix that should be swapped with the dbprefix
-| ['encrypt'] Whether or not to use an encrypted connection.
+| ['dsn'] The full DSN string describe a connection to the database.
+| ['hostname'] The hostname of your database server.
+| ['username'] The username used to connect to the database
+| ['password'] The password used to connect to the database
+| ['database'] The name of the database you want to connect to
+| ['dbdriver'] The database driver. e.g.: mysqli.
+| Currently supported:
+| cubrid, ibase, mssql, mysql, mysqli, oci8,
+| odbc, pdo, postgre, sqlite, sqlite3, sqlsrv
+| ['dbprefix'] You can add an optional prefix, which will be added
+| to the table name when using the Query Builder class
+| ['pconnect'] TRUE/FALSE - Whether to use a persistent connection
+| ['db_debug'] TRUE/FALSE - Whether database errors should be displayed.
+| ['cache_on'] TRUE/FALSE - Enables/disables query caching
+| ['cachedir'] The path to the folder where cache files should be stored
+| ['char_set'] The character set used in communicating with the database
+| ['dbcollat'] The character collation used in communicating with the database
+| NOTE: For MySQL and MySQLi databases, this setting is only used
+| as a backup if your server is running PHP < 5.2.3 or MySQL < 5.0.7
+| (and in table creation queries made with DB Forge).
+| There is an incompatibility in PHP with mysql_real_escape_string() which
+| can make your site vulnerable to SQL injection if you are using a
+| multi-byte character set and are running versions lower than these.
+| Sites using Latin-1 or UTF-8 database character set and collation are unaffected.
+| ['swap_pre'] A default table prefix that should be swapped with the dbprefix
+| ['encrypt'] Whether or not to use an encrypted connection.
|
-| 'mysql' (deprecated), 'sqlsrv' and 'pdo/sqlsrv' drivers accept TRUE/FALSE
-| 'mysqli' and 'pdo/mysql' drivers accept an array with the following options:
+| 'mysql' (deprecated), 'sqlsrv' and 'pdo/sqlsrv' drivers accept TRUE/FALSE
+| 'mysqli' and 'pdo/mysql' drivers accept an array with the following options:
|
-| 'ssl_key' - Path to the private key file
-| 'ssl_cert' - Path to the public key certificate file
-| 'ssl_ca' - Path to the certificate authority file
-| 'ssl_capath' - Path to a directory containing trusted CA certificats in PEM format
-| 'ssl_cipher' - List of *allowed* ciphers to be used for the encryption, separated by colons (':')
-| 'ssl_verify' - TRUE/FALSE; Whether verify the server certificate or not ('mysqli' only)
+| 'ssl_key' - Path to the private key file
+| 'ssl_cert' - Path to the public key certificate file
+| 'ssl_ca' - Path to the certificate authority file
+| 'ssl_capath' - Path to a directory containing trusted CA certificats in PEM format
+| 'ssl_cipher' - List of *allowed* ciphers to be used for the encryption, separated by colons (':')
+| 'ssl_verify' - TRUE/FALSE; Whether verify the server certificate or not ('mysqli' only)
|
-| ['compress'] Whether or not to use client compression (MySQL only)
-| ['stricton'] TRUE/FALSE - forces 'Strict Mode' connections
-| - good for ensuring strict SQL while developing
-| ['ssl_options'] Used to set various SSL options that can be used when making SSL connections.
-| ['failover'] array - A array with 0 or more data for connections if the main should fail.
-| ['save_queries'] TRUE/FALSE - Whether to "save" all executed queries.
-| NOTE: Disabling this will also effectively disable both
-| $this->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.
+| ['compress'] Whether or not to use client compression (MySQL only)
+| ['stricton'] TRUE/FALSE - forces 'Strict Mode' connections
+| - good for ensuring strict SQL while developing
+| ['ssl_options'] Used to set various SSL options that can be used when making SSL connections.
+| ['failover'] array - A array with 0 or more data for connections if the main should fail.
+| ['save_queries'] TRUE/FALSE - Whether to "save" all executed queries.
+| NOTE: Disabling this will also effectively disable both
+| $this->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;
-$CI = & get_instance();
+$query_builder = true;
+$CI = &get_instance();
-if ($CI->config->item('db_driver') == 'sqlite')
-{
- $db['default']['database'] = $CI->config->item('db_database') . '.db';
- $db['default']['dbdriver'] = 'sqlite3';
-}
-else
-{
- $db['default']['hostname'] = $CI->config->item('db_hostname');
- $db['default']['username'] = $CI->config->item('db_username');
- $db['default']['password'] = $CI->config->item('db_password');
- $db['default']['database'] = $CI->config->item('db_database');
- if (null !== $CI->config->item('db_driver'))
- {
- $db['default']['dbdriver'] = $CI->config->item('db_driver');
- }
- else
- {
- $db['default']['dbdriver'] = 'mysqli';
- }
+if ($CI->config->item('db_driver') == 'sqlite') {
+ $db['default']['database'] = $CI->config->item('db_database') . '.db';
+ $db['default']['dbdriver'] = 'sqlite3';
+} else {
+ $db['default']['hostname'] = $CI->config->item('db_hostname');
+ $db['default']['username'] = $CI->config->item('db_username');
+ $db['default']['password'] = $CI->config->item('db_password');
+ $db['default']['database'] = $CI->config->item('db_database');
+ if (null !== $CI->config->item('db_driver')) {
+ $db['default']['dbdriver'] = $CI->config->item('db_driver');
+ } else {
+ $db['default']['dbdriver'] = 'mysqli';
+ }
}
$db['default']['dbprefix'] = $CI->config->item('db_prefix');
-$db['default']['pconnect'] = FALSE;
-$db['default']['db_debug'] = TRUE;
-$db['default']['cache_on'] = FALSE;
+$db['default']['pconnect'] = false;
+$db['default']['db_debug'] = true;
+$db['default']['cache_on'] = false;
$db['default']['cachedir'] = '';
$db['default']['char_set'] = 'utf8';
$db['default']['dbcollat'] = 'utf8_general_ci';
$db['default']['swap_pre'] = '';
-$db['default']['autoinit'] = TRUE;
-$db['default']['stricton'] = FALSE;
+$db['default']['autoinit'] = true;
+$db['default']['stricton'] = false;
/* End of file database.php */
/* Location: ./application/config/database.php */
diff --git a/htdocs/application/config/doctypes.php b/htdocs/application/config/doctypes.php
index f7e1d19..f783237 100644
--- a/htdocs/application/config/doctypes.php
+++ b/htdocs/application/config/doctypes.php
@@ -1,15 +1,17 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+<?php if (!defined('BASEPATH')) {
+ exit('No direct script access allowed');
+}
$_doctypes = array(
- 'xhtml11' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">',
- 'xhtml1-strict' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">',
- 'xhtml1-trans' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">',
- 'xhtml1-frame' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">',
- 'html5' => '<!DOCTYPE html>',
- 'html4-strict' => '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">',
- 'html4-trans' => '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">',
- 'html4-frame' => '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">'
- );
+ 'xhtml11' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">',
+ 'xhtml1-strict' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">',
+ 'xhtml1-trans' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">',
+ 'xhtml1-frame' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">',
+ 'html5' => '<!DOCTYPE html>',
+ 'html4-strict' => '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">',
+ 'html4-trans' => '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">',
+ 'html4-frame' => '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">',
+);
/* End of file doctypes.php */
-/* Location: ./application/config/doctypes.php */ \ No newline at end of file
+/* Location: ./application/config/doctypes.php */
diff --git a/htdocs/application/config/foreign_chars.php b/htdocs/application/config/foreign_chars.php
index 14b0d73..3316ba2 100644
--- a/htdocs/application/config/foreign_chars.php
+++ b/htdocs/application/config/foreign_chars.php
@@ -1,4 +1,7 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+<?php if (!defined('BASEPATH')) {
+ exit('No direct script access allowed');
+}
+
/*
| -------------------------------------------------------------------
| Foreign Characters
@@ -6,59 +9,59 @@
| This file contains an array of foreign characters for transliteration
| conversion used by the Text helper
|
-*/
+ */
$foreign_characters = array(
- '/ä|æ|ǽ/' => 'ae',
- '/ö|œ/' => 'oe',
- '/ü/' => 'ue',
- '/Ä/' => 'Ae',
- '/Ü/' => 'Ue',
- '/Ö/' => 'Oe',
- '/À|Á|Â|Ã|Ä|Å|Ǻ|Ā|Ă|Ą|Ǎ/' => 'A',
- '/à|á|â|ã|å|ǻ|ā|ă|ą|ǎ|ª/' => 'a',
- '/Ç|Ć|Ĉ|Ċ|Č/' => 'C',
- '/ç|ć|ĉ|ċ|č/' => 'c',
- '/Ð|Ď|Đ/' => 'D',
- '/ð|ď|đ/' => 'd',
- '/È|É|Ê|Ë|Ē|Ĕ|Ė|Ę|Ě/' => 'E',
- '/è|é|ê|ë|ē|ĕ|ė|ę|ě/' => 'e',
- '/Ĝ|Ğ|Ġ|Ģ/' => 'G',
- '/ĝ|ğ|ġ|ģ/' => 'g',
- '/Ĥ|Ħ/' => 'H',
- '/ĥ|ħ/' => 'h',
- '/Ì|Í|Î|Ï|Ĩ|Ī|Ĭ|Ǐ|Į|İ/' => 'I',
- '/ì|í|î|ï|ĩ|ī|ĭ|ǐ|į|ı/' => 'i',
- '/Ĵ/' => 'J',
- '/ĵ/' => 'j',
- '/Ķ/' => 'K',
- '/ķ/' => 'k',
- '/Ĺ|Ļ|Ľ|Ŀ|Ł/' => 'L',
- '/ĺ|ļ|ľ|ŀ|ł/' => 'l',
- '/Ñ|Ń|Ņ|Ň/' => 'N',
- '/ñ|ń|ņ|ň|ʼn/' => 'n',
- '/Ò|Ó|Ô|Õ|Ō|Ŏ|Ǒ|Ő|Ơ|Ø|Ǿ/' => 'O',
- '/ò|ó|ô|õ|ō|ŏ|ǒ|ő|ơ|ø|ǿ|º/' => 'o',
- '/Ŕ|Ŗ|Ř/' => 'R',
- '/ŕ|ŗ|ř/' => 'r',
- '/Ś|Ŝ|Ş|Š/' => 'S',
- '/ś|ŝ|ş|š|ſ/' => 's',
- '/Ţ|Ť|Ŧ/' => 'T',
- '/ţ|ť|ŧ/' => 't',
- '/Ù|Ú|Û|Ũ|Ū|Ŭ|Ů|Ű|Ų|Ư|Ǔ|Ǖ|Ǘ|Ǚ|Ǜ/' => 'U',
- '/ù|ú|û|ũ|ū|ŭ|ů|ű|ų|ư|ǔ|ǖ|ǘ|ǚ|ǜ/' => 'u',
- '/Ý|Ÿ|Ŷ/' => 'Y',
- '/ý|ÿ|ŷ/' => 'y',
- '/Ŵ/' => 'W',
- '/ŵ/' => 'w',
- '/Ź|Ż|Ž/' => 'Z',
- '/ź|ż|ž/' => 'z',
- '/Æ|Ǽ/' => 'AE',
- '/ß/'=> 'ss',
- '/IJ/' => 'IJ',
- '/ij/' => 'ij',
- '/Œ/' => 'OE',
- '/ƒ/' => 'f'
+ '/ä|æ|ǽ/' => 'ae',
+ '/ö|œ/' => 'oe',
+ '/ü/' => 'ue',
+ '/Ä/' => 'Ae',
+ '/Ü/' => 'Ue',
+ '/Ö/' => 'Oe',
+ '/À|Á|Â|Ã|Ä|Å|Ǻ|Ā|Ă|Ą|Ǎ/' => 'A',
+ '/à|á|â|ã|å|ǻ|ā|ă|ą|ǎ|ª/' => 'a',
+ '/Ç|Ć|Ĉ|Ċ|Č/' => 'C',
+ '/ç|ć|ĉ|ċ|č/' => 'c',
+ '/Ð|Ď|Đ/' => 'D',
+ '/ð|ď|đ/' => 'd',
+ '/È|É|Ê|Ë|Ē|Ĕ|Ė|Ę|Ě/' => 'E',
+ '/è|é|ê|ë|ē|ĕ|ė|ę|ě/' => 'e',
+ '/Ĝ|Ğ|Ġ|Ģ/' => 'G',
+ '/ĝ|ğ|ġ|ģ/' => 'g',
+ '/Ĥ|Ħ/' => 'H',
+ '/ĥ|ħ/' => 'h',
+ '/Ì|Í|Î|Ï|Ĩ|Ī|Ĭ|Ǐ|Į|İ/' => 'I',
+ '/ì|í|î|ï|ĩ|ī|ĭ|ǐ|į|ı/' => 'i',
+ '/Ĵ/' => 'J',
+ '/ĵ/' => 'j',
+ '/Ķ/' => 'K',
+ '/ķ/' => 'k',
+ '/Ĺ|Ļ|Ľ|Ŀ|Ł/' => 'L',
+ '/ĺ|ļ|ľ|ŀ|ł/' => 'l',
+ '/Ñ|Ń|Ņ|Ň/' => 'N',
+ '/ñ|ń|ņ|ň|ʼn/' => 'n',
+ '/Ò|Ó|Ô|Õ|Ō|Ŏ|Ǒ|Ő|Ơ|Ø|Ǿ/' => 'O',
+ '/ò|ó|ô|õ|ō|ŏ|ǒ|ő|ơ|ø|ǿ|º/' => 'o',
+ '/Ŕ|Ŗ|Ř/' => 'R',
+ '/ŕ|ŗ|ř/' => 'r',
+ '/Ś|Ŝ|Ş|Š/' => 'S',
+ '/ś|ŝ|ş|š|ſ/' => 's',
+ '/Ţ|Ť|Ŧ/' => 'T',
+ '/ţ|ť|ŧ/' => 't',
+ '/Ù|Ú|Û|Ũ|Ū|Ŭ|Ů|Ű|Ų|Ư|Ǔ|Ǖ|Ǘ|Ǚ|Ǜ/' => 'U',
+ '/ù|ú|û|ũ|ū|ŭ|ů|ű|ų|ư|ǔ|ǖ|ǘ|ǚ|ǜ/' => 'u',
+ '/Ý|Ÿ|Ŷ/' => 'Y',
+ '/ý|ÿ|ŷ/' => 'y',
+ '/Ŵ/' => 'W',
+ '/ŵ/' => 'w',
+ '/Ź|Ż|Ž/' => 'Z',
+ '/ź|ż|ž/' => 'z',
+ '/Æ|Ǽ/' => 'AE',
+ '/ß/' => 'ss',
+ '/IJ/' => 'IJ',
+ '/ij/' => 'ij',
+ '/Œ/' => 'OE',
+ '/ƒ/' => 'f',
);
/* End of file foreign_chars.php */
-/* Location: ./application/config/foreign_chars.php */ \ No newline at end of file
+/* Location: ./application/config/foreign_chars.php */
diff --git a/htdocs/application/config/geshi_languages.php b/htdocs/application/config/geshi_languages.php
index a498b3a..f0285e3 100644
--- a/htdocs/application/config/geshi_languages.php
+++ b/htdocs/application/config/geshi_languages.php
@@ -1,252 +1,247 @@
-<?php
-/**
- * Class and Function List:
- * Function list:
- * Classes list:
- */
-
-if (!defined('BASEPATH')) exit('No direct script access allowed');
+<?php if (!defined('BASEPATH')) {
+ exit('No direct script access allowed');
+}
//geshi languages
$config['geshi_languages'] = array(
- '4cs' => '4CS',
- '6502acme' => 'MOS 6502',
- '6502kickass' => 'MOS 6502 Kick Assembler',
- '6502tasm' => 'MOS 6502 TASM/64TASS',
- '68000devpac' => 'Motorola 68000 Devpac Assembler',
- 'abap' => 'ABAP',
- 'actionscript' => 'Actionscript',
- 'actionscript3' => 'ActionScript3',
- 'ada' => 'Ada',
- 'aimms' =>'AIMMS',
- 'algol68' => 'ALGOL 68',
- 'apache' => 'Apache',
- 'applescript' => 'AppleScript',
- 'apt_sources' => 'Apt sources.list',
- 'arm' => 'ARM Assembler',
- 'asm' => 'x86 Assembler',
- 'asymptote' => 'asymptote',
- 'asp' => 'ASP',
- 'autoconf' => 'autoconf',
- 'autohotkey' => 'Autohotkey',
- 'autoit' => 'AutoIT',
- 'avisynth' => 'AviSynth',
- 'awk' => 'Awk',
- 'bascomavr' => 'BASCOM AVR',
- 'bash' => 'Bash',
- 'basic4gl' => 'Basic4GL',
- 'bbcode' => 'BBCode',
- 'bf' => 'Brainfuck',
- 'bibtex' => 'BibTeX',
- 'blitzbasic' => 'BlitzBasic',
- 'bnf' => 'BNF (Backus-Naur form)',
- 'boo' => 'Boo',
- 'c' => 'C',
- 'c_loadrunner' => 'C (for LoadRunner)',
- 'c_mac' => 'C for Macs',
- 'c_winapi' => 'C with WiAPI',
- 'cpp' => 'C++',
- 'caddcl' => 'CAD DCL (Dialog Control Language)',
- 'cadlisp' => 'AutoCAD/IntelliCAD Lisp',
- 'cfdg' => 'CFDG',
- 'cfm' => 'ColdFusion',
- 'chaiscript' => 'ChaiScript',
- 'chapel' => 'Chapel',
- 'cil' => 'CIL (Common Intermediate Language)',
- 'clojure' => 'Clojure',
- 'cmake' => 'CMake',
- 'cobol' => 'COBOL',
- 'coffeescript' => 'CoffeeScript',
- 'cpp-winapi' => 'C++ with WinAPI',
- 'csharp' => 'C#',
- 'css' => 'CSS',
- 'cuesheet' => 'Cuesheet',
- 'd' => 'D',
- 'dart' => 'Dart',
- 'dcs' => 'DCS',
- 'dcl' => 'DCL',
- 'dcpu16' => 'DCPU/16 Assembly',
- 'delphi' => 'Delphi (Object Pascal)',
- 'diff' => 'Diff-output',
- 'div' => 'DIV',
- 'dos' => 'DOS',
- 'dot' => 'dot',
- 'e' => 'E',
- 'ecmascript' => 'ECMAScript',
- 'eiffel' => 'Eiffel',
- 'email' => 'Email (mbox/eml/RFC format)',
- 'epc' => 'Enerscript',
- 'erlang' => 'Erlang',
- 'euphoria' => 'Euphoria',
- 'ezt' => 'EZT',
- 'f1' => 'Formula One',
- 'falcon' => 'Falcon',
- 'fo' => 'fo',
- 'fortran' => 'Fortran',
- 'freebasic' => 'FreeBasic',
- 'freeswitch' => 'FreeSWITCH',
- 'fsharp' => 'F#',
- 'gambas' => 'GAMBAS',
- 'gdb' => 'GDB',
- 'genero' => 'Genero',
- 'genie' => 'Genie',
- 'gettext' => 'GNU Gettext .po/.pot',
- 'glsl' => 'glSlang',
- 'gml' => 'GML',
- 'gnuplot' => 'Gnuplot script',
- 'go' => 'Go',
- 'groovy' => 'Groovy',
- 'gwbasic' => 'GwBasic',
- 'haskell' => 'Haskell',
- 'haxe' => 'Haxe',
- 'hicest' => 'HicEst',
- 'hq9plus' => 'HQ9+',
- 'html4strict' => 'HTML 4.01 strict',
- 'html5' => 'HTML5',
- 'icon' => 'Icon',
- 'idl' => 'Unoidl',
- 'ini' => 'INI',
- 'inno' => 'Inno Script',
- 'intercal' => 'INTERCAL',
- 'io' => 'Io',
- 'ispfpanel' => 'ISPF Panel',
- 'j' => 'J',
- 'java' => 'Java',
- 'java5' => 'Java 5',
- 'javascript' => 'JavaScript',
- 'jcl' => 'Job Control Language',
- 'jquery' => 'jQuery 1.3',
+ '4cs' => '4CS',
+ '6502acme' => 'MOS 6502',
+ '6502kickass' => 'MOS 6502 Kick Assembler',
+ '6502tasm' => 'MOS 6502 TASM/64TASS',
+ '68000devpac' => 'Motorola 68000 Devpac Assembler',
+ 'abap' => 'ABAP',
+ 'actionscript' => 'Actionscript',
+ 'actionscript3' => 'ActionScript3',
+ 'ada' => 'Ada',
+ 'aimms' => 'AIMMS',
+ 'algol68' => 'ALGOL 68',
+ 'apache' => 'Apache',
+ 'applescript' => 'AppleScript',
+ 'apt_sources' => 'Apt sources.list',
+ 'arm' => 'ARM Assembler',
+ 'asm' => 'x86 Assembler',
+ 'asymptote' => 'asymptote',
+ 'asp' => 'ASP',
+ 'autoconf' => 'autoconf',
+ 'autohotkey' => 'Autohotkey',
+ 'autoit' => 'AutoIT',
+ 'avisynth' => 'AviSynth',
+ 'awk' => 'Awk',
+ 'bascomavr' => 'BASCOM AVR',
+ 'bash' => 'Bash',
+ 'basic4gl' => 'Basic4GL',
+ 'bbcode' => 'BBCode',
+ 'bf' => 'Brainfuck',
+ 'bibtex' => 'BibTeX',
+ 'blitzbasic' => 'BlitzBasic',
+ 'bnf' => 'BNF (Backus-Naur form)',
+ 'boo' => 'Boo',
+ 'c' => 'C',
+ 'c_loadrunner' => 'C (for LoadRunner)',
+ 'c_mac' => 'C for Macs',
+ 'c_winapi' => 'C with WiAPI',
+ 'cpp' => 'C++',
+ 'caddcl' => 'CAD DCL (Dialog Control Language)',
+ 'cadlisp' => 'AutoCAD/IntelliCAD Lisp',
+ 'cfdg' => 'CFDG',
+ 'cfm' => 'ColdFusion',
+ 'chaiscript' => 'ChaiScript',
+ 'chapel' => 'Chapel',
+ 'cil' => 'CIL (Common Intermediate Language)',
+ 'clojure' => 'Clojure',
+ 'cmake' => 'CMake',
+ 'cobol' => 'COBOL',
+ 'coffeescript' => 'CoffeeScript',
+ 'cpp-winapi' => 'C++ with WinAPI',
+ 'csharp' => 'C#',
+ 'css' => 'CSS',
+ 'cuesheet' => 'Cuesheet',
+ 'd' => 'D',
+ 'dart' => 'Dart',
+ 'dcs' => 'DCS',
+ 'dcl' => 'DCL',
+ 'dcpu16' => 'DCPU/16 Assembly',
+ 'delphi' => 'Delphi (Object Pascal)',
+ 'diff' => 'Diff-output',
+ 'div' => 'DIV',
+ 'dos' => 'DOS',
+ 'dot' => 'dot',
+ 'e' => 'E',
+ 'ecmascript' => 'ECMAScript',
+ 'eiffel' => 'Eiffel',
+ 'email' => 'Email (mbox/eml/RFC format)',
+ 'epc' => 'Enerscript',
+ 'erlang' => 'Erlang',
+ 'euphoria' => 'Euphoria',
+ 'ezt' => 'EZT',
+ 'f1' => 'Formula One',
+ 'falcon' => 'Falcon',
+ 'fo' => 'fo',
+ 'fortran' => 'Fortran',
+ 'freebasic' => 'FreeBasic',
+ 'freeswitch' => 'FreeSWITCH',
+ 'fsharp' => 'F#',
+ 'gambas' => 'GAMBAS',
+ 'gdb' => 'GDB',
+ 'genero' => 'Genero',
+ 'genie' => 'Genie',
+ 'gettext' => 'GNU Gettext .po/.pot',
+ 'glsl' => 'glSlang',
+ 'gml' => 'GML',
+ 'gnuplot' => 'Gnuplot script',
+ 'go' => 'Go',
+ 'groovy' => 'Groovy',
+ 'gwbasic' => 'GwBasic',
+ 'haskell' => 'Haskell',
+ 'haxe' => 'Haxe',
+ 'hicest' => 'HicEst',
+ 'hq9plus' => 'HQ9+',
+ 'html4strict' => 'HTML 4.01 strict',
+ 'html5' => 'HTML5',
+ 'icon' => 'Icon',
+ 'idl' => 'Unoidl',
+ 'ini' => 'INI',
+ 'inno' => 'Inno Script',
+ 'intercal' => 'INTERCAL',
+ 'io' => 'Io',
+ 'ispfpanel' => 'ISPF Panel',
+ 'j' => 'J',
+ 'java' => 'Java',
+ 'java5' => 'Java 5',
+ 'javascript' => 'JavaScript',
+ 'jcl' => 'Job Control Language',
+ 'jquery' => 'jQuery 1.3',
- //'kixtart' => 'PHP',
- 'klonec' => 'KLone with C',
- 'klonecpp' => 'KLone with C++',
- 'kotlin' => 'Kotlin',
- 'latex' => 'LaTeX',
- 'lb' => 'Liberty BASIC',
- 'ldif' => 'LDIF',
- 'lisp' => 'Generic Lisp',
- 'llvm' => 'LLVM',
- 'locobasic' => 'Locomotive Basic (Amstrad CPC series)',
- 'logcat' => 'Logcat',
- 'logtalk' => 'Logtalk',
- 'lolcode' => 'LOLcode',
- 'lotusformulas' => '@Formula/@Command',
- 'lotusscript' => 'LotusScript',
- 'lscript' => 'Lightwave Script',
- 'lsl2' => 'Linden Scripting',
- 'lua' => 'Lua',
- 'm68k' => 'Motorola 68000 Assembler',
- 'magiksf' => 'MagikSF',
- 'make' => 'Make',
- 'mapbasic' => 'MapBasic',
- 'matlab' => 'Matlab M-file',
- 'mirc' => 'mIRC Scripting',
- 'mmix' => 'MMIX Assembler',
- 'modula2' => 'Modula-2',
- 'modula3' => 'Modula-3',
- 'mpasm' => 'Microchip Assembler',
- 'mxml' => 'MXML',
- 'mysql' => 'MySQL',
- 'nagios' => 'Nagios',
- 'netrexx' => 'NetRexx',
- 'newlisp' => 'newLISP',
- 'nginx' => 'nginx',
- 'nimrod' => 'Nimrod',
- 'nsis' => 'Nullsoft Scriptable Install System',
- 'oberon2' => 'Oberon-2',
- 'objc' => 'Objective-C',
- 'objeck' => 'Objeck Programming Language',
- 'ocaml' => 'OCaml (Objective Caml)',
- 'octave' => 'GNU Octave M-file',
- 'oobas' => 'OpenOffice.org Basic',
- 'oorexx' => 'ooRexx',
- 'oracle11' => 'Oracle 11i',
- 'oracle8' => 'Oracle 8',
- 'oxygene' => 'Delphi Prism (Oxygene)',
- 'oz' => 'Oz',
- 'parasail' => 'ParaSail',
- 'parigp' => 'PARI/GP',
- 'pascal' => 'Pascal',
- 'pcre' => 'PCRE',
- 'per' => 'Per (forms)',
- 'perl' => 'Perl',
- 'perl6' => 'Perl 6',
- 'pf' => 'OpenBSD packet filter',
- 'php' => 'PHP',
- 'pic16' => 'PIC16 Assembler',
- 'pike' => 'Pike',
- 'pixelbender' => 'Pixel Bender 1.0',
- 'pli' => 'PL/I',
- 'plsql' => 'Oracle 9.2 PL/SQL',
- 'postgresql' => 'PostgreSQL',
- 'postscript' => 'Postscript',
- 'povray' => 'Povray',
- 'powerbuilder' => 'PowerBuilder (PowerScript)',
- 'powershell' => 'PowerShell',
- 'proftpd' => 'ProFTPd',
- 'progress' => 'Progress',
- 'prolog' => 'Prolog',
- 'properties' => 'Property',
- 'providex' => 'ProvideX',
- 'purebasic' => 'PureBasic',
- 'pys60' => 'Python for S60',
- 'python' => 'Python',
- 'q' => 'q/kdb+',
- 'qbasic' => 'QBasic/QuickBASIC',
- 'qml' => 'QML',
- 'racket' => 'Racket',
- 'rails' => 'Ruby (with Ruby on Rails Framework)',
- 'rbs' => 'RBS Script',
- 'rebol' => 'Rebol',
- 'reg' => 'Microsoft Registry Editor',
- 'rexx' => 'Rexx',
- 'robots' => 'robots.txt',
- 'rpmspec' => 'RPM Spec',
- 'rsplus' => 'R',
- 'ruby' => 'Ruby',
- 'rust' => 'Rust',
- 'sas' => 'SAS',
- 'scala' => 'Scala',
- 'scheme' => 'Scheme',
- 'scilab' => 'SciLab',
- 'scl' => 'SCL',
- 'sdlbasic' => 'sdlBasic',
- 'smalltalk' => 'Smalltalk',
- 'smarty' => 'Smarty template',
- 'spark' => 'SPARK',
- 'sparql' => 'SPARQL',
- 'sql' => 'SQL',
- 'standardml' => 'StandardML',
- 'stonescript' => 'StoneScript',
- 'systemverilog' => 'SystemVerilog IEEE 1800-2009(draft8)',
- 'tcl' => 'TCL/iTCL',
- 'teraterm' => 'Tera Term Macro',
- 'text' => 'Plain Text',
- 'thinbasic' => 'thinBasic',
- 'tsql' => 'T-SQL',
- 'typoscript' => 'TypoScript',
- 'unicon' => 'Unicon',
- 'uscript' => 'UnrealScript',
- 'upc' => 'UPC',
- 'urbi' => 'Urbi',
- 'vala' => 'Vala',
- 'vb' => 'Visual Basic',
- 'vbnet' => 'VB.NET',
- 'vbscript' => 'VBScript',
- 'vedit' => 'Vedit macro language',
- 'verilog' => 'Verilog',
- 'vhdl' => 'VHDL',
- 'vim' => 'Vim scripting',
- 'visualfoxpro' => 'Visual FoxPro',
- 'visualprolog' => 'Visual Prolog',
- 'whitespace' => 'Whitespace',
- 'whois' => 'Whois response (RPSL format)',
- 'winbatch' => 'WinBatch',
- 'xbasic' => 'XBasic',
- 'xml' => 'XML',
- 'xorg_conf' => 'xorg.conf',
- 'xpp' => 'Axapta/Dynamics Ax X++',
- 'yaml' => 'YAML',
- 'z80' => 'ZiLOG Z80 Assembler',
- 'zxbasic' => 'ZXBasic',
+ //'kixtart' => 'PHP',
+ 'klonec' => 'KLone with C',
+ 'klonecpp' => 'KLone with C++',
+ 'kotlin' => 'Kotlin',
+ 'latex' => 'LaTeX',
+ 'lb' => 'Liberty BASIC',
+ 'ldif' => 'LDIF',
+ 'lisp' => 'Generic Lisp',
+ 'llvm' => 'LLVM',
+ 'locobasic' => 'Locomotive Basic (Amstrad CPC series)',
+ 'logcat' => 'Logcat',
+ 'logtalk' => 'Logtalk',
+ 'lolcode' => 'LOLcode',
+ 'lotusformulas' => '@Formula/@Command',
+ 'lotusscript' => 'LotusScript',
+ 'lscript' => 'Lightwave Script',
+ 'lsl2' => 'Linden Scripting',
+ 'lua' => 'Lua',
+ 'm68k' => 'Motorola 68000 Assembler',
+ 'magiksf' => 'MagikSF',
+ 'make' => 'Make',
+ 'mapbasic' => 'MapBasic',
+ 'matlab' => 'Matlab M-file',
+ 'mirc' => 'mIRC Scripting',
+ 'mmix' => 'MMIX Assembler',
+ 'modula2' => 'Modula-2',
+ 'modula3' => 'Modula-3',
+ 'mpasm' => 'Microchip Assembler',
+ 'mxml' => 'MXML',
+ 'mysql' => 'MySQL',
+ 'nagios' => 'Nagios',
+ 'netrexx' => 'NetRexx',
+ 'newlisp' => 'newLISP',
+ 'nginx' => 'nginx',
+ 'nimrod' => 'Nimrod',
+ 'nsis' => 'Nullsoft Scriptable Install System',
+ 'oberon2' => 'Oberon-2',
+ 'objc' => 'Objective-C',
+ 'objeck' => 'Objeck Programming Language',
+ 'ocaml' => 'OCaml (Objective Caml)',
+ 'octave' => 'GNU Octave M-file',
+ 'oobas' => 'OpenOffice.org Basic',
+ 'oorexx' => 'ooRexx',
+ 'oracle11' => 'Oracle 11i',
+ 'oracle8' => 'Oracle 8',
+ 'oxygene' => 'Delphi Prism (Oxygene)',
+ 'oz' => 'Oz',
+ 'parasail' => 'ParaSail',
+ 'parigp' => 'PARI/GP',
+ 'pascal' => 'Pascal',
+ 'pcre' => 'PCRE',
+ 'per' => 'Per (forms)',
+ 'perl' => 'Perl',
+ 'perl6' => 'Perl 6',
+ 'pf' => 'OpenBSD packet filter',
+ 'php' => 'PHP',
+ 'pic16' => 'PIC16 Assembler',
+ 'pike' => 'Pike',
+ 'pixelbender' => 'Pixel Bender 1.0',
+ 'pli' => 'PL/I',
+ 'plsql' => 'Oracle 9.2 PL/SQL',
+ 'postgresql' => 'PostgreSQL',
+ 'postscript' => 'Postscript',
+ 'povray' => 'Povray',
+ 'powerbuilder' => 'PowerBuilder (PowerScript)',
+ 'powershell' => 'PowerShell',
+ 'proftpd' => 'ProFTPd',
+ 'progress' => 'Progress',
+ 'prolog' => 'Prolog',
+ 'properties' => 'Property',
+ 'providex' => 'ProvideX',
+ 'purebasic' => 'PureBasic',
+ 'pys60' => 'Python for S60',
+ 'python' => 'Python',
+ 'q' => 'q/kdb+',
+ 'qbasic' => 'QBasic/QuickBASIC',
+ 'qml' => 'QML',
+ 'racket' => 'Racket',
+ 'rails' => 'Ruby (with Ruby on Rails Framework)',
+ 'rbs' => 'RBS Script',
+ 'rebol' => 'Rebol',
+ 'reg' => 'Microsoft Registry Editor',
+ 'rexx' => 'Rexx',
+ 'robots' => 'robots.txt',
+ 'rpmspec' => 'RPM Spec',
+ 'rsplus' => 'R',
+ 'ruby' => 'Ruby',
+ 'rust' => 'Rust',
+ 'sas' => 'SAS',
+ 'scala' => 'Scala',
+ 'scheme' => 'Scheme',
+ 'scilab' => 'SciLab',
+ 'scl' => 'SCL',
+ 'sdlbasic' => 'sdlBasic',
+ 'smalltalk' => 'Smalltalk',
+ 'smarty' => 'Smarty template',
+ 'spark' => 'SPARK',
+ 'sparql' => 'SPARQL',
+ 'sql' => 'SQL',
+ 'standardml' => 'StandardML',
+ 'stonescript' => 'StoneScript',
+ 'systemverilog' => 'SystemVerilog IEEE 1800-2009(draft8)',
+ 'tcl' => 'TCL/iTCL',
+ 'teraterm' => 'Tera Term Macro',
+ 'text' => 'Plain Text',
+ 'thinbasic' => 'thinBasic',
+ 'tsql' => 'T-SQL',
+ 'typoscript' => 'TypoScript',
+ 'unicon' => 'Unicon',
+ 'uscript' => 'UnrealScript',
+ 'upc' => 'UPC',
+ 'urbi' => 'Urbi',
+ 'vala' => 'Vala',
+ 'vb' => 'Visual Basic',
+ 'vbnet' => 'VB.NET',
+ 'vbscript' => 'VBScript',
+ 'vedit' => 'Vedit macro language',
+ 'verilog' => 'Verilog',
+ 'vhdl' => 'VHDL',
+ 'vim' => 'Vim scripting',
+ 'visualfoxpro' => 'Visual FoxPro',
+ 'visualprolog' => 'Visual Prolog',
+ 'whitespace' => 'Whitespace',
+ 'whois' => 'Whois response (RPSL format)',
+ 'winbatch' => 'WinBatch',
+ 'xbasic' => 'XBasic',
+ 'xml' => 'XML',
+ 'xorg_conf' => 'xorg.conf',
+ 'xpp' => 'Axapta/Dynamics Ax X++',
+ 'yaml' => 'YAML',
+ 'z80' => 'ZiLOG Z80 Assembler',
+ 'zxbasic' => 'ZXBasic',
);
diff --git a/htdocs/application/config/hooks.php b/htdocs/application/config/hooks.php
index a4ad2be..3e7598b 100644
--- a/htdocs/application/config/hooks.php
+++ b/htdocs/application/config/hooks.php
@@ -1,4 +1,7 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+<?php if (!defined('BASEPATH')) {
+ exit('No direct script access allowed');
+}
+
/*
| -------------------------------------------------------------------------
| Hooks
@@ -6,11 +9,9 @@
| This file lets you define "hooks" to extend CI without hacking the core
| files. Please see the user guide for info:
|
-| http://codeigniter.com/user_guide/general/hooks.html
+| http://codeigniter.com/user_guide/general/hooks.html
|
-*/
-
-
+ */
/* End of file hooks.php */
-/* Location: ./application/config/hooks.php */ \ No newline at end of file
+/* Location: ./application/config/hooks.php */
diff --git a/htdocs/application/config/migration.php b/htdocs/application/config/migration.php
index afa2645..97ed2c3 100644
--- a/htdocs/application/config/migration.php
+++ b/htdocs/application/config/migration.php
@@ -1,41 +1,38 @@
-<?php defined('BASEPATH') OR exit('No direct script access allowed');
-/*
-|--------------------------------------------------------------------------
-| Enable/Disable Migrations
-|--------------------------------------------------------------------------
-|
-| Migrations are disabled by default but should be enabled
-| whenever you intend to do a schema migration.
-|
-*/
-$config['migration_enabled'] = FALSE;
-
-
-/*
-|--------------------------------------------------------------------------
-| Migrations version
-|--------------------------------------------------------------------------
-|
-| This is used to set migration version that the file system should be on.
-| If you run $this->migration->latest() this is the version that schema will
-| be upgraded / downgraded to.
-|
-*/
-$config['migration_version'] = 0;
-
-
-/*
-|--------------------------------------------------------------------------
-| Migrations Path
-|--------------------------------------------------------------------------
-|
-| Path to your migrations folder.
-| Typically, it will be within your application path.
-| Also, writing permission is required within the migrations path.
-|
-*/
-$config['migration_path'] = APPPATH . 'migrations/';
-
-
-/* End of file migration.php */
-/* Location: ./application/config/migration.php */ \ No newline at end of file
+<?php defined('BASEPATH') or exit('No direct script access allowed');
+/*
+|--------------------------------------------------------------------------
+| Enable/Disable Migrations
+|--------------------------------------------------------------------------
+|
+| Migrations are disabled by default but should be enabled
+| whenever you intend to do a schema migration.
+|
+ */
+$config['migration_enabled'] = false;
+
+/*
+|--------------------------------------------------------------------------
+| Migrations version
+|--------------------------------------------------------------------------
+|
+| This is used to set migration version that the file system should be on.
+| If you run $this->migration->latest() this is the version that schema will
+| be upgraded / downgraded to.
+|
+ */
+$config['migration_version'] = 0;
+
+/*
+|--------------------------------------------------------------------------
+| Migrations Path
+|--------------------------------------------------------------------------
+|
+| Path to your migrations folder.
+| Typically, it will be within your application path.
+| Also, writing permission is required within the migrations path.
+|
+ */
+$config['migration_path'] = APPPATH . 'migrations/';
+
+/* End of file migration.php */
+/* Location: ./application/config/migration.php */
diff --git a/htdocs/application/config/mimes.php b/htdocs/application/config/mimes.php
index 0ec9db0..ea54cff 100644
--- a/htdocs/application/config/mimes.php
+++ b/htdocs/application/config/mimes.php
@@ -1,5 +1,4 @@
-<?php
-defined('BASEPATH') OR exit('No direct script access allowed');
+<?php defined('BASEPATH') or exit('No direct script access allowed');
/*
| -------------------------------------------------------------------
@@ -8,177 +7,177 @@ defined('BASEPATH') OR exit('No direct script access allowed');
| This file contains an array of mime types. It is used by the
| Upload class to help identify allowed file types.
|
-*/
+ */
return array(
- 'hqx' => array('application/mac-binhex40', 'application/mac-binhex', 'application/x-binhex40', 'application/x-mac-binhex40'),
- 'cpt' => 'application/mac-compactpro',
- 'csv' => array('text/x-comma-separated-values', 'text/comma-separated-values', 'application/octet-stream', 'application/vnd.ms-excel', 'application/x-csv', 'text/x-csv', 'text/csv', 'application/csv', 'application/excel', 'application/vnd.msexcel', 'text/plain'),
- 'bin' => array('application/macbinary', 'application/mac-binary', 'application/octet-stream', 'application/x-binary', 'application/x-macbinary'),
- 'dms' => 'application/octet-stream',
- 'lha' => 'application/octet-stream',
- 'lzh' => 'application/octet-stream',
- 'exe' => array('application/octet-stream', 'application/x-msdownload'),
- 'class' => 'application/octet-stream',
- 'psd' => array('application/x-photoshop', 'image/vnd.adobe.photoshop'),
- 'so' => 'application/octet-stream',
- 'sea' => 'application/octet-stream',
- 'dll' => 'application/octet-stream',
- 'oda' => 'application/oda',
- 'pdf' => array('application/pdf', 'application/force-download', 'application/x-download', 'binary/octet-stream'),
- 'ai' => array('application/pdf', 'application/postscript'),
- 'eps' => 'application/postscript',
- 'ps' => 'application/postscript',
- 'smi' => 'application/smil',
- 'smil' => 'application/smil',
- 'mif' => 'application/vnd.mif',
- 'xls' => array('application/vnd.ms-excel', 'application/msexcel', 'application/x-msexcel', 'application/x-ms-excel', 'application/x-excel', 'application/x-dos_ms_excel', 'application/xls', 'application/x-xls', 'application/excel', 'application/download', 'application/vnd.ms-office', 'application/msword'),
- 'ppt' => array('application/powerpoint', 'application/vnd.ms-powerpoint', 'application/vnd.ms-office', 'application/msword'),
- 'pptx' => array('application/vnd.openxmlformats-officedocument.presentationml.presentation', 'application/x-zip', 'application/zip'),
- 'wbxml' => 'application/wbxml',
- 'wmlc' => 'application/wmlc',
- 'dcr' => 'application/x-director',
- 'dir' => 'application/x-director',
- 'dxr' => 'application/x-director',
- 'dvi' => 'application/x-dvi',
- 'gtar' => 'application/x-gtar',
- 'gz' => 'application/x-gzip',
- 'gzip' => 'application/x-gzip',
- 'php' => array('application/x-httpd-php', 'application/php', 'application/x-php', 'text/php', 'text/x-php', 'application/x-httpd-php-source'),
- 'php4' => 'application/x-httpd-php',
- 'php3' => 'application/x-httpd-php',
- 'phtml' => 'application/x-httpd-php',
- 'phps' => 'application/x-httpd-php-source',
- 'js' => array('application/x-javascript', 'text/plain'),
- 'swf' => 'application/x-shockwave-flash',
- 'sit' => 'application/x-stuffit',
- 'tar' => 'application/x-tar',
- 'tgz' => array('application/x-tar', 'application/x-gzip-compressed'),
- 'z' => 'application/x-compress',
- 'xhtml' => 'application/xhtml+xml',
- 'xht' => 'application/xhtml+xml',
- 'zip' => array('application/x-zip', 'application/zip', 'application/x-zip-compressed', 'application/s-compressed', 'multipart/x-zip'),
- 'rar' => array('application/x-rar', 'application/rar', 'application/x-rar-compressed'),
- 'mid' => 'audio/midi',
- 'midi' => 'audio/midi',
- 'mpga' => 'audio/mpeg',
- 'mp2' => 'audio/mpeg',
- 'mp3' => array('audio/mpeg', 'audio/mpg', 'audio/mpeg3', 'audio/mp3'),
- 'aif' => array('audio/x-aiff', 'audio/aiff'),
- 'aiff' => array('audio/x-aiff', 'audio/aiff'),
- 'aifc' => 'audio/x-aiff',
- 'ram' => 'audio/x-pn-realaudio',
- 'rm' => 'audio/x-pn-realaudio',
- 'rpm' => 'audio/x-pn-realaudio-plugin',
- 'ra' => 'audio/x-realaudio',
- 'rv' => 'video/vnd.rn-realvideo',
- 'wav' => array('audio/x-wav', 'audio/wave', 'audio/wav'),
- 'bmp' => array('image/bmp', 'image/x-bmp', 'image/x-bitmap', 'image/x-xbitmap', 'image/x-win-bitmap', 'image/x-windows-bmp', 'image/ms-bmp', 'image/x-ms-bmp', 'application/bmp', 'application/x-bmp', 'application/x-win-bitmap'),
- 'gif' => 'image/gif',
- 'jpeg' => array('image/jpeg', 'image/pjpeg'),
- 'jpg' => array('image/jpeg', 'image/pjpeg'),
- 'jpe' => array('image/jpeg', 'image/pjpeg'),
- 'jp2' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
- 'j2k' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
- 'jpf' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
- 'jpg2' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
- 'jpx' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
- 'jpm' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
- 'mj2' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
- 'mjp2' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
- 'png' => array('image/png', 'image/x-png'),
- 'tiff' => 'image/tiff',
- 'tif' => 'image/tiff',
- 'css' => array('text/css', 'text/plain'),
- 'html' => array('text/html', 'text/plain'),
- 'htm' => array('text/html', 'text/plain'),
- 'shtml' => array('text/html', 'text/plain'),
- 'txt' => 'text/plain',
- 'text' => 'text/plain',
- 'log' => array('text/plain', 'text/x-log'),
- 'rtx' => 'text/richtext',
- 'rtf' => 'text/rtf',
- 'xml' => array('application/xml', 'text/xml', 'text/plain'),
- 'xsl' => array('application/xml', 'text/xsl', 'text/xml'),
- 'mpeg' => 'video/mpeg',
- 'mpg' => 'video/mpeg',
- 'mpe' => 'video/mpeg',
- 'qt' => 'video/quicktime',
- 'mov' => 'video/quicktime',
- 'avi' => array('video/x-msvideo', 'video/msvideo', 'video/avi', 'application/x-troff-msvideo'),
- 'movie' => 'video/x-sgi-movie',
- 'doc' => array('application/msword', 'application/vnd.ms-office'),
- 'docx' => array('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/zip', 'application/msword', 'application/x-zip'),
- 'dot' => array('application/msword', 'application/vnd.ms-office'),
- 'dotx' => array('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/zip', 'application/msword'),
- 'xlsx' => array('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'application/zip', 'application/vnd.ms-excel', 'application/msword', 'application/x-zip'),
- 'word' => array('application/msword', 'application/octet-stream'),
- 'xl' => 'application/excel',
- 'eml' => 'message/rfc822',
- 'json' => array('application/json', 'text/json'),
- 'pem' => array('application/x-x509-user-cert', 'application/x-pem-file', 'application/octet-stream'),
- 'p10' => array('application/x-pkcs10', 'application/pkcs10'),
- 'p12' => 'application/x-pkcs12',
- 'p7a' => 'application/x-pkcs7-signature',
- 'p7c' => array('application/pkcs7-mime', 'application/x-pkcs7-mime'),
- 'p7m' => array('application/pkcs7-mime', 'application/x-pkcs7-mime'),
- 'p7r' => 'application/x-pkcs7-certreqresp',
- 'p7s' => 'application/pkcs7-signature',
- 'crt' => array('application/x-x509-ca-cert', 'application/x-x509-user-cert', 'application/pkix-cert'),
- 'crl' => array('application/pkix-crl', 'application/pkcs-crl'),
- 'der' => 'application/x-x509-ca-cert',
- 'kdb' => 'application/octet-stream',
- 'pgp' => 'application/pgp',
- 'gpg' => 'application/gpg-keys',
- 'sst' => 'application/octet-stream',
- 'csr' => 'application/octet-stream',
- 'rsa' => 'application/x-pkcs7',
- 'cer' => array('application/pkix-cert', 'application/x-x509-ca-cert'),
- '3g2' => 'video/3gpp2',
- '3gp' => array('video/3gp', 'video/3gpp'),
- 'mp4' => 'video/mp4',
- 'm4a' => 'audio/x-m4a',
- 'f4v' => array('video/mp4', 'video/x-f4v'),
- 'flv' => 'video/x-flv',
- 'webm' => 'video/webm',
- 'aac' => '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' => array('audio/ogg', 'video/ogg', 'application/ogg'),
- 'kmz' => array('application/vnd.google-earth.kmz', 'application/zip', 'application/x-zip'),
- 'kml' => array('application/vnd.google-earth.kml+xml', 'application/xml', 'text/xml'),
- 'ics' => 'text/calendar',
- 'ical' => 'text/calendar',
- 'zsh' => 'text/x-scriptzsh',
- '7z' => array('application/x-7z-compressed', 'application/x-compressed', 'application/x-zip-compressed', 'application/zip', 'multipart/x-zip'),
- '7zip' => array('application/x-7z-compressed', 'application/x-compressed', 'application/x-zip-compressed', 'application/zip', 'multipart/x-zip'),
- 'cdr' => array('application/cdr', 'application/coreldraw', 'application/x-cdr', 'application/x-coreldraw', 'image/cdr', 'image/x-cdr', 'zz-application/zz-winassoc-cdr'),
- 'wma' => array('audio/x-ms-wma', 'video/x-ms-asf'),
- 'jar' => array('application/java-archive', 'application/x-java-application', 'application/x-jar', 'application/x-compressed'),
- 'svg' => array('image/svg+xml', 'application/xml', 'text/xml'),
- 'vcf' => 'text/x-vcard',
- 'srt' => array('text/srt', 'text/plain'),
- 'vtt' => array('text/vtt', 'text/plain'),
- 'ico' => array('image/x-icon', 'image/x-ico', 'image/vnd.microsoft.icon'),
- 'odc' => 'application/vnd.oasis.opendocument.chart',
- 'otc' => 'application/vnd.oasis.opendocument.chart-template',
- 'odf' => 'application/vnd.oasis.opendocument.formula',
- 'otf' => 'application/vnd.oasis.opendocument.formula-template',
- 'odg' => 'application/vnd.oasis.opendocument.graphics',
- 'otg' => 'application/vnd.oasis.opendocument.graphics-template',
- 'odi' => 'application/vnd.oasis.opendocument.image',
- 'oti' => 'application/vnd.oasis.opendocument.image-template',
- 'odp' => 'application/vnd.oasis.opendocument.presentation',
- 'otp' => 'application/vnd.oasis.opendocument.presentation-template',
- 'ods' => 'application/vnd.oasis.opendocument.spreadsheet',
- 'ots' => 'application/vnd.oasis.opendocument.spreadsheet-template',
- 'odt' => 'application/vnd.oasis.opendocument.text',
- 'odm' => 'application/vnd.oasis.opendocument.text-master',
- 'ott' => 'application/vnd.oasis.opendocument.text-template',
- 'oth' => 'application/vnd.oasis.opendocument.text-web'
+ 'hqx' => array('application/mac-binhex40', 'application/mac-binhex', 'application/x-binhex40', 'application/x-mac-binhex40'),
+ 'cpt' => 'application/mac-compactpro',
+ 'csv' => array('text/x-comma-separated-values', 'text/comma-separated-values', 'application/octet-stream', 'application/vnd.ms-excel', 'application/x-csv', 'text/x-csv', 'text/csv', 'application/csv', 'application/excel', 'application/vnd.msexcel', 'text/plain'),
+ 'bin' => array('application/macbinary', 'application/mac-binary', 'application/octet-stream', 'application/x-binary', 'application/x-macbinary'),
+ 'dms' => 'application/octet-stream',
+ 'lha' => 'application/octet-stream',
+ 'lzh' => 'application/octet-stream',
+ 'exe' => array('application/octet-stream', 'application/x-msdownload'),
+ 'class' => 'application/octet-stream',
+ 'psd' => array('application/x-photoshop', 'image/vnd.adobe.photoshop'),
+ 'so' => 'application/octet-stream',
+ 'sea' => 'application/octet-stream',
+ 'dll' => 'application/octet-stream',
+ 'oda' => 'application/oda',
+ 'pdf' => array('application/pdf', 'application/force-download', 'application/x-download', 'binary/octet-stream'),
+ 'ai' => array('application/pdf', 'application/postscript'),
+ 'eps' => 'application/postscript',
+ 'ps' => 'application/postscript',
+ 'smi' => 'application/smil',
+ 'smil' => 'application/smil',
+ 'mif' => 'application/vnd.mif',
+ 'xls' => array('application/vnd.ms-excel', 'application/msexcel', 'application/x-msexcel', 'application/x-ms-excel', 'application/x-excel', 'application/x-dos_ms_excel', 'application/xls', 'application/x-xls', 'application/excel', 'application/download', 'application/vnd.ms-office', 'application/msword'),
+ 'ppt' => array('application/powerpoint', 'application/vnd.ms-powerpoint', 'application/vnd.ms-office', 'application/msword'),
+ 'pptx' => array('application/vnd.openxmlformats-officedocument.presentationml.presentation', 'application/x-zip', 'application/zip'),
+ 'wbxml' => 'application/wbxml',
+ 'wmlc' => 'application/wmlc',
+ 'dcr' => 'application/x-director',
+ 'dir' => 'application/x-director',
+ 'dxr' => 'application/x-director',
+ 'dvi' => 'application/x-dvi',
+ 'gtar' => 'application/x-gtar',
+ 'gz' => 'application/x-gzip',
+ 'gzip' => 'application/x-gzip',
+ 'php' => array('application/x-httpd-php', 'application/php', 'application/x-php', 'text/php', 'text/x-php', 'application/x-httpd-php-source'),
+ 'php4' => 'application/x-httpd-php',
+ 'php3' => 'application/x-httpd-php',
+ 'phtml' => 'application/x-httpd-php',
+ 'phps' => 'application/x-httpd-php-source',
+ 'js' => array('application/x-javascript', 'text/plain'),
+ 'swf' => 'application/x-shockwave-flash',
+ 'sit' => 'application/x-stuffit',
+ 'tar' => 'application/x-tar',
+ 'tgz' => array('application/x-tar', 'application/x-gzip-compressed'),
+ 'z' => 'application/x-compress',
+ 'xhtml' => 'application/xhtml+xml',
+ 'xht' => 'application/xhtml+xml',
+ 'zip' => array('application/x-zip', 'application/zip', 'application/x-zip-compressed', 'application/s-compressed', 'multipart/x-zip'),
+ 'rar' => array('application/x-rar', 'application/rar', 'application/x-rar-compressed'),
+ 'mid' => 'audio/midi',
+ 'midi' => 'audio/midi',
+ 'mpga' => 'audio/mpeg',
+ 'mp2' => 'audio/mpeg',
+ 'mp3' => array('audio/mpeg', 'audio/mpg', 'audio/mpeg3', 'audio/mp3'),
+ 'aif' => array('audio/x-aiff', 'audio/aiff'),
+ 'aiff' => array('audio/x-aiff', 'audio/aiff'),
+ 'aifc' => 'audio/x-aiff',
+ 'ram' => 'audio/x-pn-realaudio',
+ 'rm' => 'audio/x-pn-realaudio',
+ 'rpm' => 'audio/x-pn-realaudio-plugin',
+ 'ra' => 'audio/x-realaudio',
+ 'rv' => 'video/vnd.rn-realvideo',
+ 'wav' => array('audio/x-wav', 'audio/wave', 'audio/wav'),
+ 'bmp' => array('image/bmp', 'image/x-bmp', 'image/x-bitmap', 'image/x-xbitmap', 'image/x-win-bitmap', 'image/x-windows-bmp', 'image/ms-bmp', 'image/x-ms-bmp', 'application/bmp', 'application/x-bmp', 'application/x-win-bitmap'),
+ 'gif' => 'image/gif',
+ 'jpeg' => array('image/jpeg', 'image/pjpeg'),
+ 'jpg' => array('image/jpeg', 'image/pjpeg'),
+ 'jpe' => array('image/jpeg', 'image/pjpeg'),
+ 'jp2' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
+ 'j2k' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
+ 'jpf' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
+ 'jpg2' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
+ 'jpx' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
+ 'jpm' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
+ 'mj2' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
+ 'mjp2' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
+ 'png' => array('image/png', 'image/x-png'),
+ 'tiff' => 'image/tiff',
+ 'tif' => 'image/tiff',
+ 'css' => array('text/css', 'text/plain'),
+ 'html' => array('text/html', 'text/plain'),
+ 'htm' => array('text/html', 'text/plain'),
+ 'shtml' => array('text/html', 'text/plain'),
+ 'txt' => 'text/plain',
+ 'text' => 'text/plain',
+ 'log' => array('text/plain', 'text/x-log'),
+ 'rtx' => 'text/richtext',
+ 'rtf' => 'text/rtf',
+ 'xml' => array('application/xml', 'text/xml', 'text/plain'),
+ 'xsl' => array('application/xml', 'text/xsl', 'text/xml'),
+ 'mpeg' => 'video/mpeg',
+ 'mpg' => 'video/mpeg',
+ 'mpe' => 'video/mpeg',
+ 'qt' => 'video/quicktime',
+ 'mov' => 'video/quicktime',
+ 'avi' => array('video/x-msvideo', 'video/msvideo', 'video/avi', 'application/x-troff-msvideo'),
+ 'movie' => 'video/x-sgi-movie',
+ 'doc' => array('application/msword', 'application/vnd.ms-office'),
+ 'docx' => array('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/zip', 'application/msword', 'application/x-zip'),
+ 'dot' => array('application/msword', 'application/vnd.ms-office'),
+ 'dotx' => array('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/zip', 'application/msword'),
+ 'xlsx' => array('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'application/zip', 'application/vnd.ms-excel', 'application/msword', 'application/x-zip'),
+ 'word' => array('application/msword', 'application/octet-stream'),
+ 'xl' => 'application/excel',
+ 'eml' => 'message/rfc822',
+ 'json' => array('application/json', 'text/json'),
+ 'pem' => array('application/x-x509-user-cert', 'application/x-pem-file', 'application/octet-stream'),
+ 'p10' => array('application/x-pkcs10', 'application/pkcs10'),
+ 'p12' => 'application/x-pkcs12',
+ 'p7a' => 'application/x-pkcs7-signature',
+ 'p7c' => array('application/pkcs7-mime', 'application/x-pkcs7-mime'),
+ 'p7m' => array('application/pkcs7-mime', 'application/x-pkcs7-mime'),
+ 'p7r' => 'application/x-pkcs7-certreqresp',
+ 'p7s' => 'application/pkcs7-signature',
+ 'crt' => array('application/x-x509-ca-cert', 'application/x-x509-user-cert', 'application/pkix-cert'),
+ 'crl' => array('application/pkix-crl', 'application/pkcs-crl'),
+ 'der' => 'application/x-x509-ca-cert',
+ 'kdb' => 'application/octet-stream',
+ 'pgp' => 'application/pgp',
+ 'gpg' => 'application/gpg-keys',
+ 'sst' => 'application/octet-stream',
+ 'csr' => 'application/octet-stream',
+ 'rsa' => 'application/x-pkcs7',
+ 'cer' => array('application/pkix-cert', 'application/x-x509-ca-cert'),
+ '3g2' => 'video/3gpp2',
+ '3gp' => array('video/3gp', 'video/3gpp'),
+ 'mp4' => 'video/mp4',
+ 'm4a' => 'audio/x-m4a',
+ 'f4v' => array('video/mp4', 'video/x-f4v'),
+ 'flv' => 'video/x-flv',
+ 'webm' => 'video/webm',
+ 'aac' => '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' => array('audio/ogg', 'video/ogg', 'application/ogg'),
+ 'kmz' => array('application/vnd.google-earth.kmz', 'application/zip', 'application/x-zip'),
+ 'kml' => array('application/vnd.google-earth.kml+xml', 'application/xml', 'text/xml'),
+ 'ics' => 'text/calendar',
+ 'ical' => 'text/calendar',
+ 'zsh' => 'text/x-scriptzsh',
+ '7z' => array('application/x-7z-compressed', 'application/x-compressed', 'application/x-zip-compressed', 'application/zip', 'multipart/x-zip'),
+ '7zip' => array('application/x-7z-compressed', 'application/x-compressed', 'application/x-zip-compressed', 'application/zip', 'multipart/x-zip'),
+ 'cdr' => array('application/cdr', 'application/coreldraw', 'application/x-cdr', 'application/x-coreldraw', 'image/cdr', 'image/x-cdr', 'zz-application/zz-winassoc-cdr'),
+ 'wma' => array('audio/x-ms-wma', 'video/x-ms-asf'),
+ 'jar' => array('application/java-archive', 'application/x-java-application', 'application/x-jar', 'application/x-compressed'),
+ 'svg' => array('image/svg+xml', 'application/xml', 'text/xml'),
+ 'vcf' => 'text/x-vcard',
+ 'srt' => array('text/srt', 'text/plain'),
+ 'vtt' => array('text/vtt', 'text/plain'),
+ 'ico' => array('image/x-icon', 'image/x-ico', 'image/vnd.microsoft.icon'),
+ 'odc' => 'application/vnd.oasis.opendocument.chart',
+ 'otc' => 'application/vnd.oasis.opendocument.chart-template',
+ 'odf' => 'application/vnd.oasis.opendocument.formula',
+ 'otf' => 'application/vnd.oasis.opendocument.formula-template',
+ 'odg' => 'application/vnd.oasis.opendocument.graphics',
+ 'otg' => 'application/vnd.oasis.opendocument.graphics-template',
+ 'odi' => 'application/vnd.oasis.opendocument.image',
+ 'oti' => 'application/vnd.oasis.opendocument.image-template',
+ 'odp' => 'application/vnd.oasis.opendocument.presentation',
+ 'otp' => 'application/vnd.oasis.opendocument.presentation-template',
+ 'ods' => 'application/vnd.oasis.opendocument.spreadsheet',
+ 'ots' => 'application/vnd.oasis.opendocument.spreadsheet-template',
+ 'odt' => 'application/vnd.oasis.opendocument.text',
+ 'odm' => 'application/vnd.oasis.opendocument.text-master',
+ 'ott' => 'application/vnd.oasis.opendocument.text-template',
+ 'oth' => 'application/vnd.oasis.opendocument.text-web',
);
diff --git a/htdocs/application/config/profiler.php b/htdocs/application/config/profiler.php
index f8a5b1a..69d9ad8 100644
--- a/htdocs/application/config/profiler.php
+++ b/htdocs/application/config/profiler.php
@@ -1,4 +1,7 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+<?php if (!defined('BASEPATH')) {
+ exit('No direct script access allowed');
+}
+
/*
| -------------------------------------------------------------------------
| Profiler Sections
@@ -7,11 +10,9 @@
| data are displayed when the Profiler is enabled.
| Please see the user guide for info:
|
-| http://codeigniter.com/user_guide/general/profiling.html
+| http://codeigniter.com/user_guide/general/profiling.html
|
-*/
-
-
+ */
/* End of file profiler.php */
-/* Location: ./application/config/profiler.php */ \ No newline at end of file
+/* Location: ./application/config/profiler.php */
diff --git a/htdocs/application/config/routes.php b/htdocs/application/config/routes.php
index dbd8a87..cbde971 100644
--- a/htdocs/application/config/routes.php
+++ b/htdocs/application/config/routes.php
@@ -1,4 +1,7 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+<?php if (!defined('BASEPATH')) {
+ exit('No direct script access allowed');
+}
+
/*
| -------------------------------------------------------------------------
| URI ROUTING
@@ -9,7 +12,7 @@
| and its corresponding controller class/method. The segments in a
| URL normally follow this pattern:
|
-| example.com/class/method/id/
+| example.com/class/method/id/
|
| In some instances, however, you may want to remap this relationship
| so that a different class/function is called than the one
@@ -17,7 +20,7 @@
|
| Please see the user guide for complete details:
|
-| http://codeigniter.com/user_guide/general/routing.html
+| http://codeigniter.com/user_guide/general/routing.html
|
| -------------------------------------------------------------------------
| RESERVED ROUTES
@@ -25,18 +28,18 @@
|
| There area two reserved routes:
|
-| $route['default_controller'] = 'welcome';
+| $route['default_controller'] = 'welcome';
|
| This route indicates which controller class should be loaded if the
| URI contains no data. In the above example, the "welcome" class
| would be loaded.
|
-| $route['404_override'] = 'errors/page_missing';
+| $route['404_override'] = 'errors/page_missing';
|
| This route will tell the Router what URI segments to use if those provided
| in the URL cannot be matched to a valid route.
|
-*/
+ */
$route['default_controller'] = "main";
$route['scaffolding_trigger'] = "";
diff --git a/htdocs/application/config/smileys.php b/htdocs/application/config/smileys.php
index 25d28b2..21280d5 100644
--- a/htdocs/application/config/smileys.php
+++ b/htdocs/application/config/smileys.php
@@ -1,4 +1,7 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+<?php if (!defined('BASEPATH')) {
+ exit('No direct script access allowed');
+}
+
/*
| -------------------------------------------------------------------
| SMILEYS
@@ -10,57 +13,57 @@
| Please see user guide for more info:
| http://codeigniter.com/user_guide/helpers/smiley_helper.html
|
-*/
+ */
$smileys = array(
-// smiley image name width height alt
+// smiley image name width height alt
- ':-)' => array('grin.gif', '19', '19', 'grin'),
- ':lol:' => array('lol.gif', '19', '19', 'LOL'),
- ':cheese:' => array('cheese.gif', '19', '19', 'cheese'),
- ':)' => array('smile.gif', '19', '19', 'smile'),
- ';-)' => array('wink.gif', '19', '19', 'wink'),
- ';)' => array('wink.gif', '19', '19', 'wink'),
- ':smirk:' => array('smirk.gif', '19', '19', 'smirk'),
- ':roll:' => array('rolleyes.gif', '19', '19', 'rolleyes'),
- ':-S' => array('confused.gif', '19', '19', 'confused'),
- ':wow:' => array('surprise.gif', '19', '19', 'surprised'),
- ':bug:' => array('bigsurprise.gif', '19', '19', 'big surprise'),
- ':-P' => array('tongue_laugh.gif', '19', '19', 'tongue laugh'),
- '%-P' => array('tongue_rolleye.gif', '19', '19', 'tongue rolleye'),
- ';-P' => array('tongue_wink.gif', '19', '19', 'tongue wink'),
- ':P' => array('raspberry.gif', '19', '19', 'raspberry'),
- ':blank:' => array('blank.gif', '19', '19', 'blank stare'),
- ':long:' => array('longface.gif', '19', '19', 'long face'),
- ':ohh:' => array('ohh.gif', '19', '19', 'ohh'),
- ':grrr:' => array('grrr.gif', '19', '19', 'grrr'),
- ':gulp:' => array('gulp.gif', '19', '19', 'gulp'),
- '8-/' => array('ohoh.gif', '19', '19', 'oh oh'),
- ':down:' => array('downer.gif', '19', '19', 'downer'),
- ':red:' => array('embarrassed.gif', '19', '19', 'red face'),
- ':sick:' => array('sick.gif', '19', '19', 'sick'),
- ':shut:' => array('shuteye.gif', '19', '19', 'shut eye'),
- ':-/' => array('hmm.gif', '19', '19', 'hmmm'),
- '>:(' => array('mad.gif', '19', '19', 'mad'),
- ':mad:' => array('mad.gif', '19', '19', 'mad'),
- '>:-(' => array('angry.gif', '19', '19', 'angry'),
- ':angry:' => array('angry.gif', '19', '19', 'angry'),
- ':zip:' => array('zip.gif', '19', '19', 'zipper'),
- ':kiss:' => array('kiss.gif', '19', '19', 'kiss'),
- ':ahhh:' => array('shock.gif', '19', '19', 'shock'),
- ':coolsmile:' => array('shade_smile.gif', '19', '19', 'cool smile'),
- ':coolsmirk:' => array('shade_smirk.gif', '19', '19', 'cool smirk'),
- ':coolgrin:' => array('shade_grin.gif', '19', '19', 'cool grin'),
- ':coolhmm:' => array('shade_hmm.gif', '19', '19', 'cool hmm'),
- ':coolmad:' => array('shade_mad.gif', '19', '19', 'cool mad'),
- ':coolcheese:' => array('shade_cheese.gif', '19', '19', 'cool cheese'),
- ':vampire:' => array('vampire.gif', '19', '19', 'vampire'),
- ':snake:' => array('snake.gif', '19', '19', 'snake'),
- ':exclaim:' => array('exclaim.gif', '19', '19', 'excaim'),
- ':question:' => array('question.gif', '19', '19', 'question') // no comma after last item
+ ':-)' => array('grin.gif', '19', '19', 'grin'),
+ ':lol:' => array('lol.gif', '19', '19', 'LOL'),
+ ':cheese:' => array('cheese.gif', '19', '19', 'cheese'),
+ ':)' => array('smile.gif', '19', '19', 'smile'),
+ ';-)' => array('wink.gif', '19', '19', 'wink'),
+ ';)' => array('wink.gif', '19', '19', 'wink'),
+ ':smirk:' => array('smirk.gif', '19', '19', 'smirk'),
+ ':roll:' => array('rolleyes.gif', '19', '19', 'rolleyes'),
+ ':-S' => array('confused.gif', '19', '19', 'confused'),
+ ':wow:' => array('surprise.gif', '19', '19', 'surprised'),
+ ':bug:' => array('bigsurprise.gif', '19', '19', 'big surprise'),
+ ':-P' => array('tongue_laugh.gif', '19', '19', 'tongue laugh'),
+ '%-P' => array('tongue_rolleye.gif', '19', '19', 'tongue rolleye'),
+ ';-P' => array('tongue_wink.gif', '19', '19', 'tongue wink'),
+ ':P' => array('raspberry.gif', '19', '19', 'raspberry'),
+ ':blank:' => array('blank.gif', '19', '19', 'blank stare'),
+ ':long:' => array('longface.gif', '19', '19', 'long face'),
+ ':ohh:' => array('ohh.gif', '19', '19', 'ohh'),
+ ':grrr:' => array('grrr.gif', '19', '19', 'grrr'),
+ ':gulp:' => array('gulp.gif', '19', '19', 'gulp'),
+ '8-/' => array('ohoh.gif', '19', '19', 'oh oh'),
+ ':down:' => array('downer.gif', '19', '19', 'downer'),
+ ':red:' => array('embarrassed.gif', '19', '19', 'red face'),
+ ':sick:' => array('sick.gif', '19', '19', 'sick'),
+ ':shut:' => array('shuteye.gif', '19', '19', 'shut eye'),
+ ':-/' => array('hmm.gif', '19', '19', 'hmmm'),
+ '>:(' => array('mad.gif', '19', '19', 'mad'),
+ ':mad:' => array('mad.gif', '19', '19', 'mad'),
+ '>:-(' => array('angry.gif', '19', '19', 'angry'),
+ ':angry:' => array('angry.gif', '19', '19', 'angry'),
+ ':zip:' => array('zip.gif', '19', '19', 'zipper'),
+ ':kiss:' => array('kiss.gif', '19', '19', 'kiss'),
+ ':ahhh:' => array('shock.gif', '19', '19', 'shock'),
+ ':coolsmile:' => array('shade_smile.gif', '19', '19', 'cool smile'),
+ ':coolsmirk:' => array('shade_smirk.gif', '19', '19', 'cool smirk'),
+ ':coolgrin:' => array('shade_grin.gif', '19', '19', 'cool grin'),
+ ':coolhmm:' => array('shade_hmm.gif', '19', '19', 'cool hmm'),
+ ':coolmad:' => array('shade_mad.gif', '19', '19', 'cool mad'),
+ ':coolcheese:' => array('shade_cheese.gif', '19', '19', 'cool cheese'),
+ ':vampire:' => array('vampire.gif', '19', '19', 'vampire'),
+ ':snake:' => array('snake.gif', '19', '19', 'snake'),
+ ':exclaim:' => array('exclaim.gif', '19', '19', 'excaim'),
+ ':question:' => array('question.gif', '19', '19', 'question'), // no comma after last item
- );
+);
/* End of file smileys.php */
-/* Location: ./application/config/smileys.php */ \ No newline at end of file
+/* Location: ./application/config/smileys.php */
diff --git a/htdocs/application/config/stikked.php.dist b/htdocs/application/config/stikked.php.dist
index f535332..3a02140 100644
--- a/htdocs/application/config/stikked.php.dist
+++ b/htdocs/application/config/stikked.php.dist
@@ -1,11 +1,13 @@
-<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
+<?php if (!defined('BASEPATH')) {
+ exit('No direct script access allowed');
+}
/**
* Site Name
*
* The name of your site
*
-*/
+ */
$config['site_name'] = 'Stikked';
/**
@@ -13,7 +15,7 @@ $config['site_name'] = 'Stikked';
*
* Set the base URL of Stikked. WITH trailing slash!
*
-*/
+ */
$config['base_url'] = 'https://yourpastebin.com/';
/**
@@ -22,7 +24,7 @@ $config['base_url'] = 'https://yourpastebin.com/';
* Credentials for your database
* The database structure will be created automatically
*
-*/
+ */
$config['db_hostname'] = '127.0.0.1';
$config['db_database'] = 'stikked';
$config['db_username'] = 'stikked';
@@ -39,7 +41,7 @@ $config['db_password'] = 'stikked';
* Use underscore as suffix to easily see the tables.
* example: $config['db_prefix'] = 'stikked_';
* use $config['db_prefix'] = ''; if you don't want to use table prefix.
-*/
+ */
$config['db_prefix'] = '';
/**
@@ -49,7 +51,7 @@ $config['db_prefix'] = '';
* Folder name in htdocs/themes/
* Currently: default, bootstrap, gabdark, gabdark3, geocities, snowkat, stikkedizr, cleanwhite, i386
*
-*/
+ */
$config['theme'] = 'default';
/**
@@ -57,7 +59,7 @@ $config['theme'] = 'default';
*
* Whether or not to display the QR code
*
-*/
+ */
$config['qr_enabled'] = true;
/**
@@ -70,7 +72,7 @@ $config['qr_enabled'] = true;
* CodeMirror: ~300kb JS
* ACE: >800kb JS
*
-*/
+ */
$config['js_editor'] = ''; // codemirror, ace, ''
/**
@@ -80,7 +82,7 @@ $config['js_editor'] = ''; // codemirror, ace, ''
* Translate Stikked to your own language, see htdocs/application/language files
* Currently: english, german, swissgerman, spanish, norwegian, danish, portuguese, turkish, french, japanese, polish, russian, chinese-simplified, chinese-traditional, indonesia
*
-*/
+ */
$config['language'] = 'english';
/**
@@ -88,7 +90,7 @@ $config['language'] = 'english';
*
* htdocs/static/asset/ folder must be writeable
*
-*/
+ */
$config['combine_assets'] = false;
/**
@@ -98,7 +100,7 @@ $config['combine_assets'] = false;
* Format: http://php.net/manual/en/function.strtotime.php
* Examples: '+10 seconds', '+1 year', '-1 week'
*
-*/
+ */
$config['content_expiration'] = '-1 week';
/**
@@ -155,11 +157,10 @@ $config['cron_key'] = '';
* polr_url: Your own instance of polr URL-shortener (Download: https://github.com/cydrobolt/polr)
* polr_api: Your polr api key
*
-**/
+ **/
$config['url_shortening_use'] = 'off';
$config['random_url_engines'] = 'googl,bitly'; // Used only in random mode, read comment above for more info
-
// Yourls
$config['yourls_url'] = '';
$config['yourls_signature'] = '';
@@ -178,13 +179,12 @@ $config['bitly_url_api'] = '';
$config['polr_url'] = '';
$config['polr_api'] = '';
-
/**
* Credentials for the backup URL
*
* Basic auth user & pass for the backup URL, accessible via http://yoursite.com/backup
*
-**/
+ **/
$config['backup_user'] = '';
$config['backup_pass'] = '';
@@ -193,7 +193,7 @@ $config['backup_pass'] = '';
*
* Number of pastes per page, on the recent pastes listings.
*
-**/
+ **/
$config['per_page'] = 15;
/**
@@ -202,7 +202,7 @@ $config['per_page'] = 15;
* Require a key to interact with the API.
* Append to all API requests: ?apikey=[yourkey]
*
-**/
+ **/
$config['apikey'] = '';
/**
@@ -215,7 +215,7 @@ $config['apikey'] = '';
* This is useful to maintain a restrictive blocklist
* for spammers and bypass it using the apikey.
*
-**/
+ **/
$config['soft_api'] = false;
/**
@@ -230,7 +230,7 @@ $config['soft_api'] = false;
* disable_shorturl: "Create Shorturl" option will be disabled
* disallow_search_engines: displays a robots.txt that forbids indexing
*
-**/
+ **/
$config['private_only'] = false;
$config['enable_captcha'] = true;
$config['recaptcha_publickey'] = '';
@@ -257,7 +257,7 @@ $config['spamadmin_pass'] = '';
* 40320 (1 month)
* 483840 (1 year)
* 0 (keep forever)
-**/
+ **/
$config['default_expiration'] = 0;
/**
@@ -265,7 +265,7 @@ $config['default_expiration'] = 0;
*
* Preselected language. See application/config/geshi_languages.php for valid values (array keys)
*
-**/
+ **/
$config['default_language'] = 'text';
/**
@@ -276,7 +276,7 @@ $config['default_language'] = 'text';
* Set to random for a random paste to be generated
* NOTE: if changed only pastes from then on will be updated.
*
-**/
+ **/
$config['unknown_poster'] = 'random';
/**
@@ -285,7 +285,7 @@ $config['unknown_poster'] = 'random';
* What name is to be set for untitled pastes.
* DO NOT SET BLANK
* NOTE: if changed only pastes from then on will be updated.
-**/
+ **/
$config['unknown_title'] = 'Untitled';
/**
@@ -294,7 +294,7 @@ $config['unknown_title'] = 'Untitled';
* Weather to require LDAP authenticaiton or not.
* Set to either 'true' to require authentication or 'false' not to.
* NOTE: if changed, set LDAP settings in auth_ldap.php
-**/
+ **/
$config['require_auth'] = false;
/**
@@ -304,7 +304,7 @@ $config['require_auth'] = false;
* Variable $id: the paste_id
* Example: 'http://example.com/$id'
*
-**/
+ **/
$config['displayurl_override'] = '';
/**
@@ -313,36 +313,36 @@ $config['displayurl_override'] = '';
* Words used for when unknown_poster is set to random
*
*
-**/
+ **/
$config['nouns'] = array('Hornbill', 'Elephant', 'Bison', 'Lion', 'Camel', 'Sheep',
-'Monkey', 'Prairie Dog', 'Plover', 'Tapir', 'Capybara', 'Cheetah', 'Flamingo', 'Peccary', 'Eider', 'Porcupine', 'Pelican', 'Dove', 'Crane', 'Tortoise', 'Agouti',
-'Tamarin', 'Pheasant', 'Owl', 'Gibbon', 'Goose', 'Baboon', 'Hamerkop', 'Zebra',
-'Macaw', 'Gibbon', 'Madrill', 'Wolf', 'Stork', 'Armadillo', 'Ostrich', 'Marmoset',
-'Lizard', 'Panda', 'Giraffe', 'Cassowary', 'Kangaroo', 'Gorilla', 'Pheasant',
-'Finch', 'Duck', 'Matamata', 'Teal', 'Macaque', 'Goat', 'Lechwe', 'Ibis', 'Parrot',
-'Parakeet', 'Bongo', 'Pudu', 'Echidna', 'Lemur', 'Bat', 'Curlew', 'Terrapin',
-'Peafowl', 'Duck', 'Owl', 'Parakeet', 'Meerkat', 'Tern', 'Wigeon', 'Pintail',
-'Meerkat', 'Motmot', 'Motmot', 'Shama', 'Dormouse', 'Horse', 'Rhinoceros', 'Sloth',
- 'Mousedeer', 'Treeshrew', 'Bushbaby', 'Guinea Pig', 'Agouti', 'Water Vole', 'Hog',
-'Pig', 'Anoa', 'Octupus', 'Butterfly', 'Cat', 'Kitten', 'Coyote', 'Crocodile',
-'Cockroach', 'Crow', 'Bird', 'Dolphin', 'Earthworm', 'Frog', 'Hamster', 'Hedgehog',
-'Hog', 'Human', 'Hummingbird', 'Iguana', 'Leech', 'Leopard', ' Marten',
-'Mockingbird', 'Mockingjay', 'Mosquito', 'Moth', 'Partdridge', 'Bee', 'Penguin');
+ 'Monkey', 'Prairie Dog', 'Plover', 'Tapir', 'Capybara', 'Cheetah', 'Flamingo', 'Peccary', 'Eider', 'Porcupine', 'Pelican', 'Dove', 'Crane', 'Tortoise', 'Agouti',
+ 'Tamarin', 'Pheasant', 'Owl', 'Gibbon', 'Goose', 'Baboon', 'Hamerkop', 'Zebra',
+ 'Macaw', 'Gibbon', 'Madrill', 'Wolf', 'Stork', 'Armadillo', 'Ostrich', 'Marmoset',
+ 'Lizard', 'Panda', 'Giraffe', 'Cassowary', 'Kangaroo', 'Gorilla', 'Pheasant',
+ 'Finch', 'Duck', 'Matamata', 'Teal', 'Macaque', 'Goat', 'Lechwe', 'Ibis', 'Parrot',
+ 'Parakeet', 'Bongo', 'Pudu', 'Echidna', 'Lemur', 'Bat', 'Curlew', 'Terrapin',
+ 'Peafowl', 'Duck', 'Owl', 'Parakeet', 'Meerkat', 'Tern', 'Wigeon', 'Pintail',
+ 'Meerkat', 'Motmot', 'Motmot', 'Shama', 'Dormouse', 'Horse', 'Rhinoceros', 'Sloth',
+ 'Mousedeer', 'Treeshrew', 'Bushbaby', 'Guinea Pig', 'Agouti', 'Water Vole', 'Hog',
+ 'Pig', 'Anoa', 'Octupus', 'Butterfly', 'Cat', 'Kitten', 'Coyote', 'Crocodile',
+ 'Cockroach', 'Crow', 'Bird', 'Dolphin', 'Earthworm', 'Frog', 'Hamster', 'Hedgehog',
+ 'Hog', 'Human', 'Hummingbird', 'Iguana', 'Leech', 'Leopard', ' Marten',
+ 'Mockingbird', 'Mockingjay', 'Mosquito', 'Moth', 'Partdridge', 'Bee', 'Penguin');
$config['adjectives'] = array('Ample', 'Mature', 'Bulky', 'Burly', 'Capacious',
-'Colossal', 'Commodious', 'Thundering', 'Mammoth', 'Mungo', 'Voluminous',
-'Walloping', 'Tiny', 'Baby', 'Bitty', 'Diminutive', 'Little', 'Paltry', 'Scanty',
-'Trivial', 'Scribby', 'Blush', 'Tinct', 'Colorant', 'Aqua', 'Beige', 'Bistre',
-'Buff', 'Bistre', 'Chartreuse', 'Chocolate', 'Cobalt', 'Coral', 'Cream', 'Crimson',
-'Denim', 'Emerald', 'Gray', 'Gamboge', 'Ivory', 'Mustard', 'Silly', 'Perl',
-'Whipped', 'Violet', 'Harmless', 'Gentle', 'Innocent', 'Reliable', 'Unreliable',
-'Soft', 'Toxic', 'Anorexic', 'Beefy', 'Sexy', 'Morose', 'Rude', 'Ungracious',
-'Abrupt', 'Gracious', 'Queen', 'Cute', 'Edgy', 'Insensitive', 'Round', 'Sharp',
-'Gruff', 'Subtle', 'Crippled', 'Eratic', 'Social', 'Jittery', 'Sole', 'Unique',
-'Botched', 'Tacky', 'Sludgy', 'Stained', 'Wet', 'Soiled', 'Big', 'Small', 'Sloppy',
-'Smelly', 'Funky', 'Putrid', 'Melodic', 'Corrupt', 'Lousy', 'Fiery', 'Red',
-'Sweet', 'Hot', 'Scorching', 'Sweltering', 'Torrid', 'Obese', 'Speedy', 'Flying',
-'Idiotic', 'Chunky', 'Forensic');
+ 'Colossal', 'Commodious', 'Thundering', 'Mammoth', 'Mungo', 'Voluminous',
+ 'Walloping', 'Tiny', 'Baby', 'Bitty', 'Diminutive', 'Little', 'Paltry', 'Scanty',
+ 'Trivial', 'Scribby', 'Blush', 'Tinct', 'Colorant', 'Aqua', 'Beige', 'Bistre',
+ 'Buff', 'Bistre', 'Chartreuse', 'Chocolate', 'Cobalt', 'Coral', 'Cream', 'Crimson',
+ 'Denim', 'Emerald', 'Gray', 'Gamboge', 'Ivory', 'Mustard', 'Silly', 'Perl',
+ 'Whipped', 'Violet', 'Harmless', 'Gentle', 'Innocent', 'Reliable', 'Unreliable',
+ 'Soft', 'Toxic', 'Anorexic', 'Beefy', 'Sexy', 'Morose', 'Rude', 'Ungracious',
+ 'Abrupt', 'Gracious', 'Queen', 'Cute', 'Edgy', 'Insensitive', 'Round', 'Sharp',
+ 'Gruff', 'Subtle', 'Crippled', 'Eratic', 'Social', 'Jittery', 'Sole', 'Unique',
+ 'Botched', 'Tacky', 'Sludgy', 'Stained', 'Wet', 'Soiled', 'Big', 'Small', 'Sloppy',
+ 'Smelly', 'Funky', 'Putrid', 'Melodic', 'Corrupt', 'Lousy', 'Fiery', 'Red',
+ 'Sweet', 'Hot', 'Scorching', 'Sweltering', 'Torrid', 'Obese', 'Speedy', 'Flying',
+ 'Idiotic', 'Chunky', 'Forensic');
/**
*
@@ -350,9 +350,9 @@ $config['adjectives'] = array('Ample', 'Mature', 'Bulky', 'Burly', 'Capacious',
* Words used for expiring pastes
*
*
-**/
+ **/
$config['expires'] = array('expire', 'perish', 'go to its last resting place',
-'go to meet its maker', 'cross the great divide', 'slip away', 'give up the ghost',
-'kick the bucket', 'croak', 'bite the big one', 'check out', 'buy the farm',
-'join the choir invisible', 'shuffle off the mortal coil', 'hop the perch',
-'run down the curtain', 'die', 'self destruct', 'explode');
+ 'go to meet its maker', 'cross the great divide', 'slip away', 'give up the ghost',
+ 'kick the bucket', 'croak', 'bite the big one', 'check out', 'buy the farm',
+ 'join the choir invisible', 'shuffle off the mortal coil', 'hop the perch',
+ 'run down the curtain', 'die', 'self destruct', 'explode');
diff --git a/htdocs/application/config/user_agents.php b/htdocs/application/config/user_agents.php
index e2d3c3a..221b24d 100644
--- a/htdocs/application/config/user_agents.php
+++ b/htdocs/application/config/user_agents.php
@@ -1,4 +1,7 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+<?php if (!defined('BASEPATH')) {
+ exit('No direct script access allowed');
+}
+
/*
| -------------------------------------------------------------------
| USER AGENT TYPES
@@ -8,171 +11,170 @@
| mobile device data. The array keys are used to identify the device
| and the array values are used to set the actual name of the item.
|
-*/
-
-$platforms = array (
- 'windows nt 6.0' => 'Windows Longhorn',
- 'windows nt 5.2' => 'Windows 2003',
- 'windows nt 5.0' => 'Windows 2000',
- 'windows nt 5.1' => 'Windows XP',
- 'windows nt 4.0' => 'Windows NT 4.0',
- 'winnt4.0' => 'Windows NT 4.0',
- 'winnt 4.0' => 'Windows NT',
- 'winnt' => 'Windows NT',
- 'windows 98' => 'Windows 98',
- 'win98' => 'Windows 98',
- 'windows 95' => 'Windows 95',
- 'win95' => 'Windows 95',
- 'windows' => 'Unknown Windows OS',
- 'os x' => 'Mac OS X',
- 'ppc mac' => 'Power PC Mac',
- 'freebsd' => 'FreeBSD',
- 'ppc' => 'Macintosh',
- 'linux' => 'Linux',
- 'debian' => 'Debian',
- 'sunos' => 'Sun Solaris',
- 'beos' => 'BeOS',
- 'apachebench' => 'ApacheBench',
- 'aix' => 'AIX',
- 'irix' => 'Irix',
- 'osf' => 'DEC OSF',
- 'hp-ux' => 'HP-UX',
- 'netbsd' => 'NetBSD',
- 'bsdi' => 'BSDi',
- 'openbsd' => 'OpenBSD',
- 'gnu' => 'GNU/Linux',
- 'unix' => 'Unknown Unix OS'
- );
+ */
+$platforms = array(
+ 'windows nt 6.0' => 'Windows Longhorn',
+ 'windows nt 5.2' => 'Windows 2003',
+ 'windows nt 5.0' => 'Windows 2000',
+ 'windows nt 5.1' => 'Windows XP',
+ 'windows nt 4.0' => 'Windows NT 4.0',
+ 'winnt4.0' => 'Windows NT 4.0',
+ 'winnt 4.0' => 'Windows NT',
+ 'winnt' => 'Windows NT',
+ 'windows 98' => 'Windows 98',
+ 'win98' => 'Windows 98',
+ 'windows 95' => 'Windows 95',
+ 'win95' => 'Windows 95',
+ 'windows' => 'Unknown Windows OS',
+ 'os x' => 'Mac OS X',
+ 'ppc mac' => 'Power PC Mac',
+ 'freebsd' => 'FreeBSD',
+ 'ppc' => 'Macintosh',
+ 'linux' => 'Linux',
+ 'debian' => 'Debian',
+ 'sunos' => 'Sun Solaris',
+ 'beos' => 'BeOS',
+ 'apachebench' => 'ApacheBench',
+ 'aix' => 'AIX',
+ 'irix' => 'Irix',
+ 'osf' => 'DEC OSF',
+ 'hp-ux' => 'HP-UX',
+ 'netbsd' => 'NetBSD',
+ 'bsdi' => 'BSDi',
+ 'openbsd' => 'OpenBSD',
+ 'gnu' => 'GNU/Linux',
+ 'unix' => 'Unknown Unix OS',
+);
// The order of this array should NOT be changed. Many browsers return
// multiple browser types so we want to identify the sub-type first.
$browsers = array(
- 'Flock' => 'Flock',
- 'Chrome' => 'Chrome',
- 'Opera' => 'Opera',
- 'MSIE' => 'Internet Explorer',
- 'Internet Explorer' => 'Internet Explorer',
- 'Shiira' => 'Shiira',
- 'Firefox' => 'Firefox',
- 'Chimera' => 'Chimera',
- 'Phoenix' => 'Phoenix',
- 'Firebird' => 'Firebird',
- 'Camino' => 'Camino',
- 'Netscape' => 'Netscape',
- 'OmniWeb' => 'OmniWeb',
- 'Safari' => 'Safari',
- 'Mozilla' => 'Mozilla',
- 'Konqueror' => 'Konqueror',
- 'icab' => 'iCab',
- 'Lynx' => 'Lynx',
- 'Links' => 'Links',
- 'hotjava' => 'HotJava',
- 'amaya' => 'Amaya',
- 'IBrowse' => 'IBrowse'
- );
+ 'Flock' => 'Flock',
+ 'Chrome' => 'Chrome',
+ 'Opera' => 'Opera',
+ 'MSIE' => 'Internet Explorer',
+ 'Internet Explorer' => 'Internet Explorer',
+ 'Shiira' => 'Shiira',
+ 'Firefox' => 'Firefox',
+ 'Chimera' => 'Chimera',
+ 'Phoenix' => 'Phoenix',
+ 'Firebird' => 'Firebird',
+ 'Camino' => 'Camino',
+ 'Netscape' => 'Netscape',
+ 'OmniWeb' => 'OmniWeb',
+ 'Safari' => 'Safari',
+ 'Mozilla' => 'Mozilla',
+ 'Konqueror' => 'Konqueror',
+ 'icab' => 'iCab',
+ 'Lynx' => 'Lynx',
+ 'Links' => 'Links',
+ 'hotjava' => 'HotJava',
+ 'amaya' => 'Amaya',
+ 'IBrowse' => 'IBrowse',
+);
$mobiles = array(
- // legacy array, old values commented out
- 'mobileexplorer' => 'Mobile Explorer',
-// 'openwave' => 'Open Wave',
-// 'opera mini' => 'Opera Mini',
-// 'operamini' => 'Opera Mini',
-// 'elaine' => 'Palm',
- 'palmsource' => 'Palm',
-// 'digital paths' => 'Palm',
-// 'avantgo' => 'Avantgo',
-// 'xiino' => 'Xiino',
- 'palmscape' => 'Palmscape',
-// 'nokia' => 'Nokia',
-// 'ericsson' => 'Ericsson',
-// 'blackberry' => 'BlackBerry',
-// 'motorola' => 'Motorola'
+ // legacy array, old values commented out
+ 'mobileexplorer' => 'Mobile Explorer',
+// 'openwave' => 'Open Wave',
+ // 'opera mini' => 'Opera Mini',
+ // 'operamini' => 'Opera Mini',
+ // 'elaine' => 'Palm',
+ 'palmsource' => 'Palm',
+// 'digital paths' => 'Palm',
+ // 'avantgo' => 'Avantgo',
+ // 'xiino' => 'Xiino',
+ 'palmscape' => 'Palmscape',
+// 'nokia' => 'Nokia',
+ // 'ericsson' => 'Ericsson',
+ // 'blackberry' => 'BlackBerry',
+ // 'motorola' => 'Motorola'
- // Phones and Manufacturers
- 'motorola' => "Motorola",
- 'nokia' => "Nokia",
- 'palm' => "Palm",
- 'iphone' => "Apple iPhone",
- 'ipad' => "iPad",
- 'ipod' => "Apple iPod Touch",
- 'sony' => "Sony Ericsson",
- 'ericsson' => "Sony Ericsson",
- 'blackberry' => "BlackBerry",
- 'cocoon' => "O2 Cocoon",
- 'blazer' => "Treo",
- 'lg' => "LG",
- 'amoi' => "Amoi",
- 'xda' => "XDA",
- 'mda' => "MDA",
- 'vario' => "Vario",
- 'htc' => "HTC",
- 'samsung' => "Samsung",
- 'sharp' => "Sharp",
- 'sie-' => "Siemens",
- 'alcatel' => "Alcatel",
- 'benq' => "BenQ",
- 'ipaq' => "HP iPaq",
- 'mot-' => "Motorola",
- 'playstation portable' => "PlayStation Portable",
- 'hiptop' => "Danger Hiptop",
- 'nec-' => "NEC",
- 'panasonic' => "Panasonic",
- 'philips' => "Philips",
- 'sagem' => "Sagem",
- 'sanyo' => "Sanyo",
- 'spv' => "SPV",
- 'zte' => "ZTE",
- 'sendo' => "Sendo",
+ // Phones and Manufacturers
+ 'motorola' => "Motorola",
+ 'nokia' => "Nokia",
+ 'palm' => "Palm",
+ 'iphone' => "Apple iPhone",
+ 'ipad' => "iPad",
+ 'ipod' => "Apple iPod Touch",
+ 'sony' => "Sony Ericsson",
+ 'ericsson' => "Sony Ericsson",
+ 'blackberry' => "BlackBerry",
+ 'cocoon' => "O2 Cocoon",
+ 'blazer' => "Treo",
+ 'lg' => "LG",
+ 'amoi' => "Amoi",
+ 'xda' => "XDA",
+ 'mda' => "MDA",
+ 'vario' => "Vario",
+ 'htc' => "HTC",
+ 'samsung' => "Samsung",
+ 'sharp' => "Sharp",
+ 'sie-' => "Siemens",
+ 'alcatel' => "Alcatel",
+ 'benq' => "BenQ",
+ 'ipaq' => "HP iPaq",
+ 'mot-' => "Motorola",
+ 'playstation portable' => "PlayStation Portable",
+ 'hiptop' => "Danger Hiptop",
+ 'nec-' => "NEC",
+ 'panasonic' => "Panasonic",
+ 'philips' => "Philips",
+ 'sagem' => "Sagem",
+ 'sanyo' => "Sanyo",
+ 'spv' => "SPV",
+ 'zte' => "ZTE",
+ 'sendo' => "Sendo",
- // Operating Systems
- 'symbian' => "Symbian",
- 'SymbianOS' => "SymbianOS",
- 'elaine' => "Palm",
- 'palm' => "Palm",
- 'series60' => "Symbian S60",
- 'windows ce' => "Windows CE",
+ // Operating Systems
+ 'symbian' => "Symbian",
+ 'SymbianOS' => "SymbianOS",
+ 'elaine' => "Palm",
+ 'palm' => "Palm",
+ 'series60' => "Symbian S60",
+ 'windows ce' => "Windows CE",
- // Browsers
- 'obigo' => "Obigo",
- 'netfront' => "Netfront Browser",
- 'openwave' => "Openwave Browser",
- 'mobilexplorer' => "Mobile Explorer",
- 'operamini' => "Opera Mini",
- 'opera mini' => "Opera Mini",
+ // Browsers
+ 'obigo' => "Obigo",
+ 'netfront' => "Netfront Browser",
+ 'openwave' => "Openwave Browser",
+ 'mobilexplorer' => "Mobile Explorer",
+ 'operamini' => "Opera Mini",
+ 'opera mini' => "Opera Mini",
- // Other
- 'digital paths' => "Digital Paths",
- 'avantgo' => "AvantGo",
- 'xiino' => "Xiino",
- 'novarra' => "Novarra Transcoder",
- 'vodafone' => "Vodafone",
- 'docomo' => "NTT DoCoMo",
- 'o2' => "O2",
+ // Other
+ 'digital paths' => "Digital Paths",
+ 'avantgo' => "AvantGo",
+ 'xiino' => "Xiino",
+ 'novarra' => "Novarra Transcoder",
+ 'vodafone' => "Vodafone",
+ 'docomo' => "NTT DoCoMo",
+ 'o2' => "O2",
- // Fallback
- 'mobile' => "Generic Mobile",
- 'wireless' => "Generic Mobile",
- 'j2me' => "Generic Mobile",
- 'midp' => "Generic Mobile",
- 'cldc' => "Generic Mobile",
- 'up.link' => "Generic Mobile",
- 'up.browser' => "Generic Mobile",
- 'smartphone' => "Generic Mobile",
- 'cellphone' => "Generic Mobile"
- );
+ // Fallback
+ 'mobile' => "Generic Mobile",
+ 'wireless' => "Generic Mobile",
+ 'j2me' => "Generic Mobile",
+ 'midp' => "Generic Mobile",
+ 'cldc' => "Generic Mobile",
+ 'up.link' => "Generic Mobile",
+ 'up.browser' => "Generic Mobile",
+ 'smartphone' => "Generic Mobile",
+ 'cellphone' => "Generic Mobile",
+);
// There are hundreds of bots but these are the most common.
$robots = array(
- 'googlebot' => 'Googlebot',
- 'msnbot' => 'MSNBot',
- 'slurp' => 'Inktomi Slurp',
- 'yahoo' => 'Yahoo',
- 'askjeeves' => 'AskJeeves',
- 'fastcrawler' => 'FastCrawler',
- 'infoseek' => 'InfoSeek Robot 1.0',
- 'lycos' => 'Lycos'
- );
+ 'googlebot' => 'Googlebot',
+ 'msnbot' => 'MSNBot',
+ 'slurp' => 'Inktomi Slurp',
+ 'yahoo' => 'Yahoo',
+ 'askjeeves' => 'AskJeeves',
+ 'fastcrawler' => 'FastCrawler',
+ 'infoseek' => 'InfoSeek Robot 1.0',
+ 'lycos' => 'Lycos',
+);
/* End of file user_agents.php */
-/* Location: ./application/config/user_agents.php */ \ No newline at end of file
+/* Location: ./application/config/user_agents.php */
diff --git a/htdocs/application/controllers/Api.php b/htdocs/application/controllers/Api.php
index 2ed5cb0..74aac22 100644
--- a/htdocs/application/controllers/Api.php
+++ b/htdocs/application/controllers/Api.php
@@ -1,225 +1,185 @@
-<?php
-/**
- * Class and Function List:
- * Function list:
- * - __construct()
- * - index()
- * - create()
- * - paste()
- * - random()
- * - recent()
- * - trending()
- * - langs()
- * Classes list:
- * - Api extends Main
- */
-include_once ('application/controllers/Main.php');
+<?php if (!defined('BASEPATH')) {
+ exit('No direct script access allowed');
+}
+
+include_once 'application/controllers/Main.php';
class Api extends Main
{
-
- function __construct()
- {
- parent::__construct();
-
- if (config_item('disable_api'))
- {
- die("The API has been disabled\n");
- }
+
+ public function __construct()
+ {
+ parent::__construct();
+
+ if (config_item('disable_api')) {
+ die("The API has been disabled\n");
+ }
// if ldap is configured and no api token is configured, fail the request
- if ((config_item('require_auth') == true) && (config_item('apikey') == ''))
- {
- die("API key not configured");
- }
-
- }
-
- function index()
- {
- $languages = $this->languages->get_languages();
- $languages = array_keys($languages);
- $languages = implode(', ', $languages);
- $data['languages'] = $languages;
- $this->load->view('api_help', $data);
- }
-
- function create()
- {
-
- if (config_item('apikey') != $this->input->get('apikey') && config_item('soft_api') == false)
- {
- die("Invalid API key\n");
- }
- $this->load->model('pastes');
- $this->load->library('form_validation'); //needed by parent class
-
-
- if (!$this->input->post('text'))
- {
- $data['msg'] = 'Error: Missing paste text';
- $this->load->view('view/api', $data);
- }
- else
- {
-
- if (!$this->input->post('lang'))
- {
- $_POST['lang'] = 'text';
- }
- $_POST['code'] = $this->input->post('text');
-
- if ($this->config->item('private_only'))
- {
- $_POST['private'] = 1;
- }
-
- //validations
-
- if (!$this->_valid_ip())
- {
- die("You are not allowed to paste\n");
- }
-
- if (config_item('soft_api') == true && (config_item('apikey') == $this->input->get('apikey')))
- {
-
- //pass
-
- }
- else
- {
-
- if (!$this->_blockwords_check())
- {
- die("Your paste contains blocked words\n");
- }
- }
-
- if (!$this->input->post('expire'))
- {
- $_POST['expire'] = config_item('default_expiration');
- }
-
- //create paste
- $paste_url = $this->pastes->createPaste();
- $data['msg'] = base_url() . $paste_url;
- $this->load->view('view/api', $data);
- }
- }
-
- function paste()
- {
-
- if (config_item('apikey') != $this->input->get('apikey'))
- {
- die("Invalid API key\n");
- }
-
- if (config_item('private_only'))
- {
- show_404();
- }
- $this->load->model('pastes');
- $check = $this->pastes->checkPaste(3);
-
- if ($check)
- {
- $data = $this->pastes->getPaste(3);
- }
- else
- {
- $data = array(
- 'message' => 'Not found',
- );
- }
- echo json_encode($data);
- }
-
- function random()
- {
-
- if (config_item('apikey') != $this->input->get('apikey'))
- {
- die("Invalid API key\n");
- }
-
- if (config_item('private_only'))
- {
- show_404();
- }
- $this->load->model('pastes');
- $data = $this->pastes->random_paste();
- echo json_encode($data);
- }
-
- function recent()
- {
-
- if (config_item('apikey') != $this->input->get('apikey'))
- {
- die("Invalid API key\n");
- }
-
- if (config_item('private_only'))
- {
- show_404();
- }
- $this->load->model('pastes');
- $pastes = $this->pastes->getLists('api/recent');
- $pastes = $pastes['pastes'];
- $data = array();
- foreach ($pastes as $paste)
- {
- $data[] = array(
- 'pid' => $paste['pid'],
- 'title' => $paste['title'],
- 'name' => $paste['name'],
- 'created' => $paste['created'],
- 'lang' => $paste['lang'],
- );
- }
- echo json_encode($data);
- }
-
- function trending()
- {
-
- if (config_item('apikey') != $this->input->get('apikey'))
- {
- die("Invalid API key\n");
- }
-
- if (config_item('private_only'))
- {
- show_404();
- }
- $this->load->model('pastes');
- $pastes = $this->pastes->getTrends('api/trending', 2);
- $pastes = $pastes['pastes'];
- $data = array();
- foreach ($pastes as $paste)
- {
- $data[] = array(
- 'pid' => $paste['pid'],
- 'title' => $paste['title'],
- 'name' => $paste['name'],
- 'created' => $paste['created'],
- 'lang' => $paste['lang'],
- 'hits' => $paste['hits'],
- );
- }
- echo json_encode($data);
- }
-
- function langs()
- {
- if (config_item('apikey') != $this->input->get('apikey'))
- {
- die("Invalid API key\n");
- }
-
- $languages = $this->languages->get_languages();
- echo json_encode($languages);
- }
+ if ((config_item('require_auth') == true) && (config_item('apikey') == '')) {
+ die("API key not configured");
+ }
+
+ }
+
+ public function index()
+ {
+ $languages = $this->languages->get_languages();
+ $languages = array_keys($languages);
+ $languages = implode(', ', $languages);
+ $data['languages'] = $languages;
+ $this->load->view('api_help', $data);
+ }
+
+ public function create()
+ {
+
+ if (config_item('apikey') != $this->input->get('apikey') && config_item('soft_api') == false) {
+ die("Invalid API key\n");
+ }
+ $this->load->model('pastes');
+ $this->load->library('form_validation'); //needed by parent class
+
+ if (!$this->input->post('text')) {
+ $data['msg'] = 'Error: Missing paste text';
+ $this->load->view('view/api', $data);
+ } else {
+
+ if (!$this->input->post('lang')) {
+ $_POST['lang'] = 'text';
+ }
+ $_POST['code'] = $this->input->post('text');
+
+ if ($this->config->item('private_only')) {
+ $_POST['private'] = 1;
+ }
+
+ //validations
+
+ if (!$this->_valid_ip()) {
+ die("You are not allowed to paste\n");
+ }
+
+ if (config_item('soft_api') == true && (config_item('apikey') == $this->input->get('apikey'))) {
+
+ //pass
+
+ } else {
+
+ if (!$this->_blockwords_check()) {
+ die("Your paste contains blocked words\n");
+ }
+ }
+
+ if (!$this->input->post('expire')) {
+ $_POST['expire'] = config_item('default_expiration');
+ }
+
+ //create paste
+ $paste_url = $this->pastes->createPaste();
+ $data['msg'] = base_url() . $paste_url;
+ $this->load->view('view/api', $data);
+ }
+ }
+
+ public function paste()
+ {
+
+ if (config_item('apikey') != $this->input->get('apikey')) {
+ die("Invalid API key\n");
+ }
+
+ if (config_item('private_only')) {
+ show_404();
+ }
+ $this->load->model('pastes');
+ $check = $this->pastes->checkPaste(3);
+
+ if ($check) {
+ $data = $this->pastes->getPaste(3);
+ } else {
+ $data = array(
+ 'message' => 'Not found',
+ );
+ }
+ echo json_encode($data);
+ }
+
+ public function random()
+ {
+
+ if (config_item('apikey') != $this->input->get('apikey')) {
+ die("Invalid API key\n");
+ }
+
+ if (config_item('private_only')) {
+ show_404();
+ }
+ $this->load->model('pastes');
+ $data = $this->pastes->random_paste();
+ echo json_encode($data);
+ }
+
+ public function recent()
+ {
+
+ if (config_item('apikey') != $this->input->get('apikey')) {
+ die("Invalid API key\n");
+ }
+
+ if (config_item('private_only')) {
+ show_404();
+ }
+ $this->load->model('pastes');
+ $pastes = $this->pastes->getLists('api/recent');
+ $pastes = $pastes['pastes'];
+ $data = array();
+ foreach ($pastes as $paste) {
+ $data[] = array(
+ 'pid' => $paste['pid'],
+ 'title' => $paste['title'],
+ 'name' => $paste['name'],
+ 'created' => $paste['created'],
+ 'lang' => $paste['lang'],
+ );
+ }
+ echo json_encode($data);
+ }
+
+ public function trending()
+ {
+
+ if (config_item('apikey') != $this->input->get('apikey')) {
+ die("Invalid API key\n");
+ }
+
+ if (config_item('private_only')) {
+ show_404();
+ }
+ $this->load->model('pastes');
+ $pastes = $this->pastes->getTrends('api/trending', 2);
+ $pastes = $pastes['pastes'];
+ $data = array();
+ foreach ($pastes as $paste) {
+ $data[] = array(
+ 'pid' => $paste['pid'],
+ 'title' => $paste['title'],
+ 'name' => $paste['name'],
+ 'created' => $paste['created'],
+ 'lang' => $paste['lang'],
+ 'hits' => $paste['hits'],
+ );
+ }
+ echo json_encode($data);
+ }
+
+ public function langs()
+ {
+ if (config_item('apikey') != $this->input->get('apikey')) {
+ die("Invalid API key\n");
+ }
+
+ $languages = $this->languages->get_languages();
+ echo json_encode($languages);
+ }
}
diff --git a/htdocs/application/controllers/Auth.php b/htdocs/application/controllers/Auth.php
index 017465c..67f1d1f 100644
--- a/htdocs/application/controllers/Auth.php
+++ b/htdocs/application/controllers/Auth.php
@@ -1,35 +1,24 @@
-<?php
-/**
- * Class and Function List:
- * Function list:
- * - __construct()
- * - index()
- * - login()
- * - logout()
- * - alpha_dash_dot()
- * Classes list:
- * - Auth extends CI_Controller
- */
-
-if (!defined('BASEPATH')) exit('No direct script access allowed');
+<?php if (!defined('BASEPATH')) {
+ exit('No direct script access allowed');
+}
/*
* This file is part of Auth_Ldap.
- Auth_Ldap is free software: you can redistribute it and/or modify
- it under the terms of the GNU Lesser General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+Auth_Ldap is free software: you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
- Auth_Ldap is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+Auth_Ldap is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with Auth_Ldap. If not, see <http://www.gnu.org/licenses/>.
- *
-*/
+You should have received a copy of the GNU General Public License
+along with Auth_Ldap. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
/**
* @author Greg Wojtak <gwojtak@techrockdo.com>
* @copyright Copyright © 2010,2011 by Greg Wojtak <gwojtak@techrockdo.com>
@@ -40,87 +29,73 @@ if (!defined('BASEPATH')) exit('No direct script access allowed');
class Auth extends CI_Controller
{
-
- function __construct()
- {
- parent::__construct();
- $this->load->helper('form');
- $this->load->library('Form_validation');
- $this->load->library('auth_ldap');
- $this->load->helper('url');
- $this->load->library('table');
- }
-
- function index()
- {
- $this->session->keep_flashdata('tried_to');
- $this->login();
- }
-
- function login($errorMsg = NULL)
- {
- $this->session->keep_flashdata('tried_to');
-
- if (!$this->auth_ldap->is_authenticated())
- {
-
- // Set up rules for form validation
- $rules = $this->form_validation;
- $rules->set_rules('username', 'Username', 'required|callback_alpha_dash_dot');
- $rules->set_rules('password', 'Password', 'required');
-
- // Do the login...
-
- if ($rules->run() && $this->auth_ldap->login($rules->set_value('username') , $rules->set_value('password')))
- {
-
- // Login WIN!
-
- if ($this->session->flashdata('tried_to'))
- {
- redirect($this->session->flashdata('tried_to'));
- }
- else
- {
- redirect('/');
- }
- }
- else
- {
-
- // Login FAIL
- $this->session->set_flashdata('login_error', 'Incorrect username or password.');
- $this->load->view('auth/login_form');
- }
- }
- else
- {
-
- // Already logged in...
- redirect('/');
- }
- }
-
- function logout()
- {
-
- if ($this->session->userdata('logged_in'))
- {
- $data['name'] = $this->session->userdata('cn');
- $data['username'] = $this->session->userdata('username');
- $data['logged_in'] = TRUE;
- $this->auth_ldap->logout();
- }
- else
- {
- $data['logged_in'] = FALSE;
- }
- redirect('/');
- }
- public
- function alpha_dash_dot($str)
- {
- return (!preg_match("/^([-a-z0-9_\-\.])+$/i", $str)) ? FALSE : TRUE;
- }
+
+ public function __construct()
+ {
+ parent::__construct();
+ $this->load->helper('form');
+ $this->load->library('Form_validation');
+ $this->load->library('auth_ldap');
+ $this->load->helper('url');
+ $this->load->library('table');
+ }
+
+ public function index()
+ {
+ $this->session->keep_flashdata('tried_to');
+ $this->login();
+ }
+
+ public function login($errorMsg = null)
+ {
+ $this->session->keep_flashdata('tried_to');
+
+ if (!$this->auth_ldap->is_authenticated()) {
+
+ // Set up rules for form validation
+ $rules = $this->form_validation;
+ $rules->set_rules('username', 'Username', 'required|callback_alpha_dash_dot');
+ $rules->set_rules('password', 'Password', 'required');
+
+ // Do the login...
+
+ if ($rules->run() && $this->auth_ldap->login($rules->set_value('username'), $rules->set_value('password'))) {
+
+ // Login WIN!
+
+ if ($this->session->flashdata('tried_to')) {
+ redirect($this->session->flashdata('tried_to'));
+ } else {
+ redirect('/');
+ }
+ } else {
+
+ // Login FAIL
+ $this->session->set_flashdata('login_error', 'Incorrect username or password.');
+ $this->load->view('auth/login_form');
+ }
+ } else {
+
+ // Already logged in...
+ redirect('/');
+ }
+ }
+
+ public function logout()
+ {
+
+ if ($this->session->userdata('logged_in')) {
+ $data['name'] = $this->session->userdata('cn');
+ $data['username'] = $this->session->userdata('username');
+ $data['logged_in'] = true;
+ $this->auth_ldap->logout();
+ } else {
+ $data['logged_in'] = false;
+ }
+ redirect('/');
+ }
+ public function alpha_dash_dot($str)
+ {
+ return (!preg_match("/^([-a-z0-9_\-\.])+$/i", $str)) ? false : true;
+ }
}
-?>
diff --git a/htdocs/application/controllers/Backup.php b/htdocs/application/controllers/Backup.php
index 0f42026..64d0b3c 100644
--- a/htdocs/application/controllers/Backup.php
+++ b/htdocs/application/controllers/Backup.php
@@ -1,43 +1,36 @@
-<?php
-/**
- * Class and Function List:
- * Function list:
- * - __construct()
- * - index()
- * Classes list:
- * - Backup extends CI_Controller
- */
+<?php if (!defined('BASEPATH')) {
+ exit('No direct script access allowed');
+}
class Backup extends CI_Controller
{
-
- function __construct()
- {
- parent::__construct();
-
- //protection
- $user = $this->config->item('backup_user');
- $pass = $this->config->item('backup_pass');
-
- if ($user == '' || $pass == '' || !isset($_SERVER['PHP_AUTH_USER']) || $_SERVER['PHP_AUTH_USER'] != $user || $_SERVER['PHP_AUTH_PW'] != $pass)
- {
- header('WWW-Authenticate: Basic realm="Backup"');
- header('HTTP/1.0 401 Unauthorized');
- exit;
- }
- }
-
- function index()
- {
-
- // Load the DB utility class
- $this->load->dbutil();
-
- // Backup your entire database and assign it to a variable
- $backup = & $this->dbutil->backup();
-
- // Load the download helper and send the file to your desktop
- $this->load->helper('download');
- force_download('stikked.gz', $backup);
- }
+
+ public function __construct()
+ {
+ parent::__construct();
+
+ //protection
+ $user = $this->config->item('backup_user');
+ $pass = $this->config->item('backup_pass');
+
+ if ($user == '' || $pass == '' || !isset($_SERVER['PHP_AUTH_USER']) || $_SERVER['PHP_AUTH_USER'] != $user || $_SERVER['PHP_AUTH_PW'] != $pass) {
+ header('WWW-Authenticate: Basic realm="Backup"');
+ header('HTTP/1.0 401 Unauthorized');
+ exit;
+ }
+ }
+
+ public function index()
+ {
+
+ // Load the DB utility class
+ $this->load->dbutil();
+
+ // Backup your entire database and assign it to a variable
+ $backup = &$this->dbutil->backup();
+
+ // Load the download helper and send the file to your desktop
+ $this->load->helper('download');
+ force_download('stikked.gz', $backup);
+ }
}
diff --git a/htdocs/application/controllers/Iphone.php b/htdocs/application/controllers/Iphone.php
index 52d0227..22ee22f 100644
--- a/htdocs/application/controllers/Iphone.php
+++ b/htdocs/application/controllers/Iphone.php
@@ -1,34 +1,27 @@
-<?php
-/**
- * Class and Function List:
- * Function list:
- * - __construct()
- * - index()
- * - view()
- * Classes list:
- * - Iphone extends CI_Controller
- */
+<?php if (!defined('BASEPATH')) {
+ exit('No direct script access allowed');
+}
class Iphone extends CI_Controller
{
-
- function __construct()
- {
- parent::__construct();
- $this->load->model('languages');
- }
-
- function index()
- {
- $this->load->model('pastes');
- $data = $this->pastes->getLists('iphone/');
- $this->load->view('iphone/recent', $data);
- }
-
- function view()
- {
- $this->load->model('pastes');
- $data = $this->pastes->getPaste(3);
- $this->load->view('iphone/view', $data);
- }
+
+ public function __construct()
+ {
+ parent::__construct();
+ $this->load->model('languages');
+ }
+
+ public function index()
+ {
+ $this->load->model('pastes');
+ $data = $this->pastes->getLists('iphone/');
+ $this->load->view('iphone/recent', $data);
+ }
+
+ public function view()
+ {
+ $this->load->model('pastes');
+ $data = $this->pastes->getPaste(3);
+ $this->load->view('iphone/view', $data);
+ }
}
diff --git a/htdocs/application/controllers/Main.php b/htdocs/application/controllers/Main.php
index 05de769..c2ce255 100644
--- a/htdocs/application/controllers/Main.php
+++ b/htdocs/application/controllers/Main.php
@@ -1,1037 +1,883 @@
-<?php
-/**
- * Class and Function List:
- * Function list:
- * - __construct()
- * - _form_prep()
- * - index()
- * - post_encrypted()
- * - raw()
- * - rss()
- * - embed()
- * - qr()
- * - download()
- * - lists()
- * - trends()
- * - view()
- * - cron()
- * - about()
- * - captcha()
- * - _valid_lang()
- * - _valid_captcha()
- * - _valid_recaptcha()
- * - _valid_ip()
- * - _valid_ipv4()
- * - _valid_ipv6()
- * - _blockwords_check()
- * - _autofill_check()
- * - _valid_authentication()
- * - get_cm_js()
- * - error_404()
- * - robots_txt()
- * Classes list:
- * - Main extends CI_Controller
- */
+<?php if (!defined('BASEPATH')) {
+ exit('No direct script access allowed');
+}
class Main extends CI_Controller
{
-
- function __construct()
- {
- parent::__construct();
- $this->output->enable_profiler(false);
- $this->load->model('languages');
- $this->load->library('curl');
-
- if (config_item('require_auth'))
- {
- $this->load->library('auth_ldap');
- }
-
- //recaptcha
- $this->recaptcha_publickey = config_item('recaptcha_publickey');
- $this->recaptcha_privatekey = config_item('recaptcha_privatekey');
- $this->use_recaptcha = false;
-
- if ($this->recaptcha_publickey != '' && $this->recaptcha_privatekey != '')
- {
- $this->load->helper('recaptcha');
- $this->use_recaptcha = true;
- }
-
- if (!$this->db->table_exists('sessions'))
- {
- $this->load->dbforge();
-
- if ($this->db->table_exists('ci_sessions'))
- {
- $this->dbforge->drop_table('ci_sessions');
- }
- $fields = array(
- 'id' => array(
- 'type' => 'VARCHAR',
- 'constraint' => 128,
- 'default' => 0,
- ) ,
- 'ip_address' => array(
- 'type' => 'VARCHAR',
- 'constraint' => 45,
- 'default' => 0,
- ) ,
- 'timestamp' => array(
- 'type' => 'INT',
- 'constraint' => 10,
- 'unsigned' => TRUE,
- 'default' => 0,
- ) ,
- 'data' => array(
- 'type' => ($this->db->dbdriver == "postgre") ? 'TEXT' : 'BLOB',
- ) ,
- );
- $this->dbforge->add_field($fields);
- $this->dbforge->add_key('id', true);
- $this->dbforge->add_key('timestamp');
- $this->dbforge->create_table('sessions', true);
- }
-
- // load this after db has been initialized
- $this->load->library('session');
-
- if (!$this->db->table_exists('pastes'))
- {
- $this->load->dbforge();
- $fields = array(
- 'id' => array(
- 'type' => 'INT',
- 'constraint' => 10,
- 'auto_increment' => TRUE,
- ) ,
- 'pid' => array(
- 'type' => 'VARCHAR',
- 'constraint' => 8,
- ) ,
- 'title' => array(
- 'type' => 'VARCHAR',
- 'constraint' => 50,
- ) ,
- 'name' => array(
- 'type' => 'VARCHAR',
- 'constraint' => 32,
- ) ,
- 'lang' => array(
- 'type' => 'VARCHAR',
- 'constraint' => 32,
- ) ,
- 'private' => array(
- 'type' => 'TINYINT',
- 'constraint' => 1,
- ) ,
- 'raw' => array(
- 'type' => ($this->db->dbdriver == "postgre") ? 'TEXT' : 'LONGTEXT',
- ) ,
- 'created' => array(
- 'type' => 'INT',
- 'constraint' => 10,
- ) ,
- 'expire' => array(
- 'type' => 'INT',
- 'constraint' => 10,
- 'default' => 0,
- ) ,
- 'toexpire' => array(
- 'type' => 'TINYINT',
- 'constraint' => 1,
- 'unsigned' => TRUE,
- 'default' => 0,
- ) ,
- 'snipurl' => array(
- 'type' => 'VARCHAR',
- 'constraint' => 64,
- 'default' => 0,
- ) ,
- 'replyto' => array(
- 'type' => 'VARCHAR',
- 'constraint' => 8,
- ) ,
- 'ip_address' => array(
- 'type' => 'VARCHAR',
- 'constraint' => 45,
- 'null' => TRUE,
- ) ,
- 'hits' => array(
- 'type' => 'INT',
- 'constraint' => 10,
- 'default' => 0,
- ) ,
- 'hits_updated' => array(
- 'type' => 'INT',
- 'constraint' => 10,
- 'default' => 0,
- ) ,
- );
- $this->dbforge->add_field($fields);
- $this->dbforge->add_key('id', true);
- $this->dbforge->add_key('pid');
- $this->dbforge->add_key('private');
- $this->dbforge->add_key('replyto');
- $this->dbforge->add_key('created');
- $this->dbforge->add_key('ip_address');
- $this->dbforge->add_key('hits');
- $this->dbforge->add_key('hits_updated');
- $this->dbforge->create_table('pastes', true);
- }
-
- if (!$this->db->table_exists('blocked_ips'))
- {
- $this->load->dbforge();
- $fields = array(
- 'ip_address' => array(
- 'type' => 'VARCHAR',
- 'constraint' => 45,
- 'default' => 0,
- ) ,
- 'blocked_at' => array(
- 'type' => 'INT',
- 'constraint' => 10,
- ) ,
- 'spam_attempts' => array(
- 'type' => 'INT',
- 'constraint' => 6,
- 'default' => 0,
- ) ,
- );
- $this->dbforge->add_field($fields);
- $this->dbforge->add_key('ip_address', true);
- $this->dbforge->create_table('blocked_ips', true);
- }
-
- if (!$this->db->table_exists('trending'))
- {
- $this->load->dbforge();
- $fields = array(
- 'paste_id' => array(
- 'type' => 'VARCHAR',
- 'constraint' => 8,
- ) ,
- 'ip_address' => array(
- 'type' => 'VARCHAR',
- 'constraint' => 45,
- 'default' => 0,
- ) ,
- 'created' => array(
- 'type' => 'INT',
- 'constraint' => 10,
- ) ,
- );
- $this->dbforge->add_field($fields);
- $this->dbforge->add_key('paste_id', true);
- $this->dbforge->add_key('ip_address', true);
- $this->dbforge->add_key('created');
- $this->dbforge->create_table('trending', true);
- }
-
- if (!$this->db->field_exists('ip_address', 'pastes'))
- {
- $this->load->dbforge();
- $fields = array(
- 'ip_address' => array(
- 'type' => 'VARCHAR',
- 'constraint' => 45,
- 'null' => TRUE,
- ) ,
- );
- $this->dbforge->add_column('pastes', $fields);
- }
-
- if (!$this->db->field_exists('hits', 'pastes'))
- {
- $this->load->dbforge();
- $fields = array(
- 'hits' => array(
- 'type' => 'INT',
- 'constraint' => 10,
- 'default' => 0,
- ) ,
- 'hits_updated' => array(
- 'type' => 'INT',
- 'constraint' => 10,
- 'default' => 0,
- ) ,
- );
- $this->dbforge->add_key('hits');
- $this->dbforge->add_key('hits_updated');
- $this->dbforge->add_column('pastes', $fields);
- }
-
- //ipv6 migration
- $fields = $this->db->field_data('trending');
-
- if (stristr(config_item('db_driver') , 'sqlite') === false && $fields[1]->max_length < 45)
- {
- $db_prefix = config_item('db_prefix');
-
- if ($this->db->dbdriver == "postgre")
- {
- $this->db->query("ALTER TABLE " . $db_prefix . "trending ALTER COLUMN ip_address TYPE VARCHAR(45), ALTER COLUMN ip_address SET NOT NULL, ALTER COLUMN ip_address SET DEFAULT '0'");
- $this->db->query("ALTER TABLE " . $db_prefix . "pastes ALTER COLUMN ip_address TYPE VARCHAR(45), ALTER COLUMN ip_address SET NOT NULL, ALTER COLUMN ip_address SET DEFAULT '0'");
- $this->db->query("ALTER TABLE " . $db_prefix . "blocked_ips ALTER COLUMN ip_address TYPE VARCHAR(45), ALTER COLUMN ip_address SET NOT NULL, ALTER COLUMN ip_address SET DEFAULT '0'");
- $this->db->query("ALTER TABLE " . $db_prefix . "sessions ALTER COLUMN ip_address TYPE VARCHAR(45), ALTER COLUMN ip_address SET NOT NULL, ALTER COLUMN ip_address SET DEFAULT '0'");
- }
- else
- {
- $this->db->query("ALTER TABLE " . $db_prefix . "trending CHANGE COLUMN ip_address ip_address VARCHAR(45) NOT NULL DEFAULT '0'");
- $this->db->query("ALTER TABLE " . $db_prefix . "pastes CHANGE COLUMN ip_address ip_address VARCHAR(45) NOT NULL DEFAULT '0'");
- $this->db->query("ALTER TABLE " . $db_prefix . "blocked_ips CHANGE COLUMN ip_address ip_address VARCHAR(45) NOT NULL DEFAULT '0'");
- $this->db->query("ALTER TABLE " . $db_prefix . "sessions CHANGE COLUMN ip_address ip_address VARCHAR(45) NOT NULL DEFAULT '0'");
- }
- }
-
- //expand title to 50
- $fields = $this->db->field_data('pastes');
- foreach ($fields as $field)
- {
-
- if ($field->name == 'title')
- {
-
- if (stristr(config_item('db_driver') , 'sqlite') === false && $field->max_length < 50)
- {
- $db_prefix = config_item('db_prefix');
-
- if ($this->db->dbdriver == "postgre")
- {
- $this->db->query("ALTER TABLE " . $db_prefix . "pastes ALTER COLUMN title TYPE VARCHAR(50), ALTER COLUMN title SET NOT NULL");
- }
- else
- {
- $this->db->query("ALTER TABLE " . $db_prefix . "pastes CHANGE COLUMN title title VARCHAR(50) NOT NULL");
- }
- }
- }
- }
-
- //upgrade to CI 3.1.2
- $fields = $this->db->field_data('sessions');
- foreach ($fields as $field)
- {
-
- if ($field->name == 'id')
- {
-
- if (stristr(config_item('db_driver') , 'sqlite') === false)
- {
-
- if ($field->max_length < 128)
- {
- $db_prefix = config_item('db_prefix');
-
- if ($this->db->dbdriver == "postgre")
- {
- $this->db->query("ALTER TABLE " . $db_prefix . "sessions ALTER COLUMN id SET DATA TYPE varchar(128)");
- }
- else
- {
- $this->db->query("ALTER TABLE " . $db_prefix . "sessions CHANGE id id VARCHAR(128) NOT NULL");
- }
- }
- }
- }
- }
- }
-
- function _form_prep($lang = false, $title = '', $paste = '', $reply = false)
- {
- $this->load->model('languages');
- $this->load->helper('form');
- $data['languages'] = $this->languages->get_languages();
-
- if (config_item('js_editor') == 'codemirror')
- {
-
- //codemirror languages
- $this->load->config('codemirror_languages');
- $codemirror_languages = config_item('codemirror_languages');
- $data['codemirror_languages'] = $codemirror_languages;
-
- //codemirror modes
- $cmm = array();
- foreach ($codemirror_languages as $geshi_name => $l)
- {
-
- if (gettype($l) == 'array')
- {
- $cmm[$geshi_name] = $l['mode'];
- }
- }
- $data['codemirror_modes'] = $cmm;
- }
-
- if (config_item('js_editor') == 'ace')
- {
-
- //ace languages
- $this->load->config('ace_languages');
- $ace_languages = config_item('ace_languages');
- $data['ace_languages'] = $ace_languages;
-
- //ace modes
- $acem = array();
- foreach ($ace_languages as $geshi_name => $l)
- {
- $acem[$geshi_name] = $l;
- }
- $data['ace_modes'] = $acem;
- }
-
- //recaptcha
- $data['use_recaptcha'] = $this->use_recaptcha;
- $data['recaptcha_publickey'] = $this->recaptcha_publickey;
-
- if (!$this->input->post('submit'))
- {
-
- if (!$this->session->userdata('expire'))
- {
- $default_expiration = config_item('default_expiration');
- $this->session->set_userdata('expire', $default_expiration);
- }
-
- if (!$this->session->userdata('snipurl'))
- {
- $shorturl_selected = config_item('shorturl_selected');
- $this->session->set_userdata('snipurl', $shorturl_selected);
- }
-
- if ($this->session->flashdata('settings_changed'))
- {
- $data['status_message'] = 'Settings successfully changed';
- }
- $data['name_set'] = $this->session->userdata('name');
- $data['expire_set'] = $this->session->userdata('expire');
- $data['private_set'] = $this->session->userdata('private');
- $data['snipurl_set'] = $this->session->userdata('snipurl');
- $data['paste_set'] = $paste;
- $data['title_set'] = $title;
- $data['reply'] = $reply;
-
- if (!$lang)
- {
- $lang = config_item('default_language');
- }
- $data['lang_set'] = $lang;
- }
- else
- {
- $data['name_set'] = $this->input->post('name');
- $data['expire_set'] = $this->input->post('expire');
- $data['private_set'] = $this->input->post('private');
- $data['snipurl_set'] = $this->input->post('snipurl');
- $data['paste_set'] = htmlspecialchars($this->input->post('code'));
- $data['title_set'] = $this->input->post('title');
- $data['reply'] = $this->input->post('reply');
- $data['lang_set'] = $this->input->post('lang');
- }
- return $data;
- }
-
- function index()
- {
- $this->_valid_authentication();
- $this->load->helper('json');
-
- if (!$this->input->post('submit'))
- {
- $data = $this->_form_prep();
- $this->content_expiration(config_item('content_expiration'));
- $this->load->view('home', $data);
- }
- else
- {
- $this->load->model('pastes');
- $this->load->library('form_validation');
-
- //rules
- $rules = array(
- array(
- 'field' => 'code',
- 'label' => 'Main Paste',
- 'rules' => 'required',
- ) ,
- array(
- 'field' => 'lang',
- 'label' => 'Language',
- 'rules' => 'min_length[1]|required|callback__valid_lang',
- ) ,
- array(
- 'field' => 'captcha',
- 'label' => 'Captcha',
- 'rules' => 'callback__valid_captcha',
- ) ,
- array(
- 'field' => 'valid_ip',
- 'label' => 'Valid IP',
- 'rules' => 'callback__valid_ip',
- ) ,
- array(
- 'field' => 'blockwords_check',
- 'label' => 'No blocked words',
- 'rules' => 'callback__blockwords_check',
- ) ,
- array(
- 'field' => 'email',
- 'label' => 'Field must remain empty',
- 'rules' => 'callback__autofill_check',
- ) ,
- );
-
- //form validation
- $this->form_validation->set_rules($rules);
- $this->form_validation->set_message('min_length', lang('empty'));
- $this->form_validation->set_error_delimiters('<div class="message error"><div class="container">', '</div></div>');
-
- if ($this->form_validation->run() == FALSE)
- {
- $data = $this->_form_prep();
- $this->load->view('home', $data);
- }
- else
- {
-
- if (config_item('private_only'))
- {
- $_POST['private'] = 1;
- }
-
- if (config_item('disable_shorturl'))
- {
- $_POST['snipurl'] = 0;
- }
-
- if ($this->input->post('reply') == false)
- {
- $user_data = array(
- 'name' => $this->input->post('name') ,
- 'lang' => $this->input->post('lang') ,
- 'expire' => $this->input->post('expire') ,
- 'snipurl' => $this->input->post('snipurl') ,
- 'private' => $this->input->post('private') ,
- );
- $this->session->set_userdata($user_data);
- }
- redirect($this->pastes->createPaste());
- }
- }
- }
-
- function post_encrypted()
- {
- $this->_valid_authentication();
-
- if ($this->_valid_captcha($this->input->post('captcha')))
- {
- $this->load->model('pastes');
- $_POST['private'] = 1;
- $_POST['snipurl'] = 0;
- $ret_url = $this->pastes->createPaste();
- echo $ret_url;
- }
- else
- {
- echo 'E_CAPTCHA';
- }
- }
-
- function raw()
- {
- $this->_valid_authentication();
- $this->load->model('pastes');
- $check = $this->pastes->checkPaste(3);
-
- if ($check)
- {
- $data = $this->pastes->getPaste(3);
-
- if (isset($_GET['preview']))
- {
- $this->load->helper('text');
- $data['raw'] = character_limiter($data['raw'], 500);
- }
- $this->content_expiration(config_item('content_expiration'));
- $this->load->view('view/raw', $data);
- }
- else
- {
- show_404();
- }
- }
-
- function rss()
- {
- $this->_valid_authentication();
- $this->load->model('pastes');
- $check = $this->pastes->checkPaste(3);
-
- if ($check)
- {
- $this->load->helper('text');
- $paste = $this->pastes->getPaste(3);
- $data = $this->pastes->getReplies(3);
- $data['page_title'] = $paste['title'] . ' - ' . config_item('site_name');
- $data['feed_url'] = site_url('view/rss/' . $this->uri->segment(3));
- $this->load->view('view/rss', $data);
- }
- else
- {
- show_404();
- }
- }
-
- function embed()
- {
- $this->_valid_authentication();
- $this->load->model('pastes');
- $check = $this->pastes->checkPaste(3);
-
- if ($check)
- {
- $data = $this->pastes->getPaste(3, true, $this->uri->segment(4) == 'diff');
- $this->content_expiration(config_item('content_expiration'));
- $this->load->view('view/embed', $data);
- }
- else
- {
- show_404();
- }
- }
-
- function qr()
- {
- $this->load->model('pastes');
- $check = $this->pastes->checkPaste(3);
-
- if ($check)
- {
- $data = $this->pastes->getPaste(3);
- $this->content_expiration('+1 year');
- $this->load->view('view/qr', $data);
- }
- }
-
- function download()
- {
- $this->_valid_authentication();
- $this->load->model('pastes');
- $check = $this->pastes->checkPaste(3);
-
- if ($check)
- {
- $data = $this->pastes->getPaste(3);
- $this->load->view('view/download', $data);
- }
- else
- {
- show_404();
- }
- }
-
- function lists()
- {
- $this->_valid_authentication();
-
- if (config_item('private_only'))
- {
- show_404();
- }
- else
- {
- $this->load->model('pastes');
-
- if ($this->uri->segment(2) == 'rss')
- {
- $this->load->helper('text');
- $data = $this->pastes->getLists('lists/', 3);
- $data['page_title'] = config_item('site_name');
- $data['feed_url'] = site_url('lists/rss');
- $data['replies'] = $data['pastes'];
- unset($data['pastes']);
- $this->load->view('view/rss', $data);
- }
- else
- {
- $data = $this->pastes->getLists('lists/', 2);
- $this->load->view('list', $data);
- }
- }
- }
-
- function trends()
- {
- $this->_valid_authentication();
-
- if (config_item('private_only'))
- {
- show_404();
- }
- else
- {
- $this->load->model('pastes');
- $data = $this->pastes->getTrends();
- $this->load->view('trends', $data);
- }
- }
-
- function view()
- {
- $this->_valid_authentication();
- $this->load->helper('json');
- $this->load->model('pastes');
- $check = $this->pastes->checkPaste(2);
-
- if ($check)
- {
-
- if ($this->session->userdata('view_raw'))
- {
- redirect('view/raw/' . $this->uri->segment(2));
- }
- $data = $this->pastes->getPaste(2, true, $this->uri->segment(3) == 'diff');
- $data['reply_form'] = $this->_form_prep($data['lang_code'], 'Re: ' . $data['title'], $data['raw'], $data['pid']);
-
- if ($data['private'] == 1)
- {
- $data['reply_form']['use_recaptcha'] = $this->use_recaptcha;
- }
- $this->content_expiration(config_item('content_expiration'));
- $this->load->view('view/view', $data);
- }
- else
- {
- show_404();
- }
- }
-
- function cron()
- {
- $this->load->model('pastes');
- $key = $this->uri->segment(2);
-
- if ($key != config_item('cron_key'))
- {
- show_404();
- }
- else
- {
- $this->pastes->cron();
- return 0;
- }
- }
-
- function about()
- {
- $this->load->view('about');
- }
-
- function captcha()
- {
- $this->load->helper('captcha');
-
- //get "word"
- $pool = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ@';
- $str = '';
- for ($i = 0;$i < 8;$i++)
- {
- $str.= substr($pool, mt_rand(0, strlen($pool) - 1) , 1);
- }
- $word = $str;
-
- //save
- $this->session->set_userdata(array(
- 'captcha' => $word
- ));
-
- //view
- $this->load->view('view/captcha', array(
- 'word' => $word
- ));
- }
-
- function _valid_lang($lang)
- {
- $this->load->model('languages');
- $this->form_validation->set_message('_valid_lang', lang('valid_lang'));
- return $this->languages->valid_language($lang);
- }
-
- function _valid_captcha($text)
- {
-
- if (config_item('enable_captcha') && $this->session->userdata('is_human') === null)
- {
-
- if (isset($this->form_validation))
- {
- $this->form_validation->set_message('_valid_captcha', lang('captcha'));
- }
-
- if ($this->use_recaptcha)
- {
-
- if ($this->_valid_recaptcha())
- {
- $this->session->set_userdata('is_human', true);
- return true;
- }
- else
- {
- return false;
- }
- }
- else
- {
-
- if (strtolower($text) == strtolower($this->session->userdata('captcha')))
- {
- $this->session->set_userdata('is_human', true);
- return true;
- }
- else
- {
- return false;
- }
- }
- }
- else
- {
- return true;
- }
- }
-
- function _valid_recaptcha()
- {
-
- if ($this->recaptcha_privatekey == null || $this->recaptcha_privatekey == '')
- {
- die("To use reCAPTCHA you must get an API key from <a href='https://www.google.com/recaptcha/admin/create'>https://www.google.com/recaptcha/admin/create</a>");
- }
-
- if ($this->input->post('g-recaptcha-response'))
- {
- $pk = $this->recaptcha_privatekey;
- $ra = $_SERVER['REMOTE_ADDR'];
- $rf = trim($this->input->post('g-recaptcha-response'));
- $url = "https://www.google.com/recaptcha/api/siteverify?secret=" . $pk . "&response;=" . $rf . "&remoteip;=" . $ra;
- $response = $this->curl->simple_get($url);
- $status = json_decode($response, true);
- $recaptcha_response = new stdClass();
-
- if ($status['success'])
- {
- $recaptcha_response->is_valid = true;
- }
- else
- {
- $recaptcha_response->is_valid = false;
- }
- return $recaptcha_response;
- }
- else
- {
- return false;
- }
- }
-
- function _valid_ip()
- {
-
- //get ip
- $ip_address = $this->input->ip_address();
-
- if (stristr($ip_address, ':'))
- {
- return $this->_valid_ipv6($ip_address);
- }
- else
- {
- return $this->_valid_ipv4($ip_address);
- }
- }
-
- function _valid_ipv4($ip_address)
- {
-
- //get ip range
- $ip = explode('.', $ip_address);
- $ip_firstpart = $ip[0] . '.' . $ip[1] . '.';
-
- //setup message
- $this->form_validation->set_message('_valid_ip', lang('not_allowed'));
-
- //lookup
- $this->db->select('ip_address, spam_attempts');
- $this->db->like('ip_address', $ip_firstpart, 'after');
- $query = $this->db->get('blocked_ips');
-
- //check
-
- if ($query->num_rows() > 0)
- {
-
- //update spamcount
- $blocked_ips = $query->result_array();
- $spam_attempts = $blocked_ips[0]['spam_attempts'];
- $this->db->where('ip_address', $ip_address);
- $this->db->update('blocked_ips', array(
- 'spam_attempts' => $spam_attempts + 1,
- ));
-
- //return for the validation
- return false;
- }
- else
- {
- return true;
- }
- }
-
- function _valid_ipv6($ip_address)
- {
-
- //setup message
- $this->form_validation->set_message('_valid_ip', lang('not_allowed'));
-
- //lookup
- $this->db->select('ip_address, spam_attempts');
- $this->db->where('ip_address', $ip_address);
- $query = $this->db->get('blocked_ips');
-
- //check
-
- if ($query->num_rows() > 0)
- {
-
- //update spamcount
- $blocked_ips = $query->result_array();
- $spam_attempts = $blocked_ips[0]['spam_attempts'];
- $this->db->where('ip_address', $ip_address);
- $this->db->update('blocked_ips', array(
- 'spam_attempts' => $spam_attempts + 1,
- ));
-
- //return for the validation
- return false;
- }
- else
- {
- return true;
- }
- }
-
- function _blockwords_check()
- {
-
- //setup message
- $this->form_validation->set_message('_blockwords_check', lang('blocked_words'));
-
- //check
- $blocked_words = config_item('blocked_words');
- $post = $this->input->post();
-
- if (!$blocked_words)
- {
- return true;
- }
-
- //we have blocked words
- foreach (explode(',', $blocked_words) as $word)
- {
- $word = trim($word);
-
- if (stristr($post['code'], $word) || stristr($post['title'], $word))
- {
- return false;
- }
- }
- return true;
- }
-
- function _autofill_check()
- {
-
- //setup message
- $this->form_validation->set_message('_autofill_check', lang('robot'));
-
- //check
- return (!$this->input->post('email') && !$this->input->post('url'));
- }
-
- function _valid_authentication()
- {
-
- if (config_item('require_auth'))
- {
-
- if (!$this->auth_ldap->is_authenticated())
- {
- $this->session->set_flashdata('tried_to', "/" . $this->uri->uri_string());
- redirect('/auth');
- }
- }
- }
-
- function get_cm_js()
- {
- $lang = $this->uri->segment(3);
- $this->load->config('codemirror_languages');
- $cml = config_item('codemirror_languages');
-
- //file path
- $file_path = 'themes/' . config_item('theme') . '/js/';
-
- if (!file_exists($file_path))
- {
- $file_path = 'themes/default/js/';
- }
-
- if (isset($cml[$lang]) && gettype($cml[$lang]) == 'array')
- {
- header('Content-Type: application/x-javascript; charset=utf-8');
- header('Expires: ' . gmdate('D, d M Y H:i:s \G\M\T', time() + 60 * 60 * 24 * 30));
- foreach ($cml[$lang]['js'] as $js)
- {
- echo file_get_contents($file_path . $js[0]);
- }
- }
- exit;
- }
-
- function error_404()
- {
- show_404();
- }
-
- function robots_txt()
- {
-
- if (config_item('disallow_search_engines'))
- {
- header('Content-Type: text/plain; charset=utf-8');
- $this->load->view('robots_txt');
- }
- else
- {
- echo '';
- }
- }
-
- function content_expiration($cache_time)
- {
- if(!$cache_time)
- {
- $cache_time = '-1 week';
- }
- $cache_expiration = strtotime($cache_time);
- $this->output->set_header('Pragma: ', true);
- $this->output->set_header('Cache-Control: ', true);
- $this->output->set_header('Expires: ' . gmdate('D, d M Y H:i:s', $cache_expiration) . ' GMT', true);
- }
+
+ public function __construct()
+ {
+ parent::__construct();
+ $this->output->enable_profiler(false);
+ $this->load->model('languages');
+ $this->load->library('curl');
+
+ if (config_item('require_auth')) {
+ $this->load->library('auth_ldap');
+ }
+
+ //recaptcha
+ $this->recaptcha_publickey = config_item('recaptcha_publickey');
+ $this->recaptcha_privatekey = config_item('recaptcha_privatekey');
+ $this->use_recaptcha = false;
+
+ if ($this->recaptcha_publickey != '' && $this->recaptcha_privatekey != '') {
+ $this->load->helper('recaptcha');
+ $this->use_recaptcha = true;
+ }
+
+ if (!$this->db->table_exists('sessions')) {
+ $this->load->dbforge();
+
+ if ($this->db->table_exists('ci_sessions')) {
+ $this->dbforge->drop_table('ci_sessions');
+ }
+ $fields = array(
+ 'id' => array(
+ 'type' => 'VARCHAR',
+ 'constraint' => 128,
+ 'default' => 0,
+ ),
+ 'ip_address' => array(
+ 'type' => 'VARCHAR',
+ 'constraint' => 45,
+ 'default' => 0,
+ ),
+ 'timestamp' => array(
+ 'type' => 'INT',
+ 'constraint' => 10,
+ 'unsigned' => true,
+ 'default' => 0,
+ ),
+ 'data' => array(
+ 'type' => ($this->db->dbdriver == "postgre") ? 'TEXT' : 'BLOB',
+ ),
+ );
+ $this->dbforge->add_field($fields);
+ $this->dbforge->add_key('id', true);
+ $this->dbforge->add_key('timestamp');
+ $this->dbforge->create_table('sessions', true);
+ }
+
+ // load this after db has been initialized
+ $this->load->library('session');
+
+ if (!$this->db->table_exists('pastes')) {
+ $this->load->dbforge();
+ $fields = array(
+ 'id' => array(
+ 'type' => 'INT',
+ 'constraint' => 10,
+ 'auto_increment' => true,
+ ),
+ 'pid' => array(
+ 'type' => 'VARCHAR',
+ 'constraint' => 8,
+ ),
+ 'title' => array(
+ 'type' => 'VARCHAR',
+ 'constraint' => 50,
+ ),
+ 'name' => array(
+ 'type' => 'VARCHAR',
+ 'constraint' => 32,
+ ),
+ 'lang' => array(
+ 'type' => 'VARCHAR',
+ 'constraint' => 32,
+ ),
+ 'private' => array(
+ 'type' => 'TINYINT',
+ 'constraint' => 1,
+ ),
+ 'raw' => array(
+ 'type' => ($this->db->dbdriver == "postgre") ? 'TEXT' : 'LONGTEXT',
+ ),
+ 'created' => array(
+ 'type' => 'INT',
+ 'constraint' => 10,
+ ),
+ 'expire' => array(
+ 'type' => 'INT',
+ 'constraint' => 10,
+ 'default' => 0,
+ ),
+ 'toexpire' => array(
+ 'type' => 'TINYINT',
+ 'constraint' => 1,
+ 'unsigned' => true,
+ 'default' => 0,
+ ),
+ 'snipurl' => array(
+ 'type' => 'VARCHAR',
+ 'constraint' => 64,
+ 'default' => 0,
+ ),
+ 'replyto' => array(
+ 'type' => 'VARCHAR',
+ 'constraint' => 8,
+ ),
+ 'ip_address' => array(
+ 'type' => 'VARCHAR',
+ 'constraint' => 45,
+ 'null' => true,
+ ),
+ 'hits' => array(
+ 'type' => 'INT',
+ 'constraint' => 10,
+ 'default' => 0,
+ ),
+ 'hits_updated' => array(
+ 'type' => 'INT',
+ 'constraint' => 10,
+ 'default' => 0,
+ ),
+ );
+ $this->dbforge->add_field($fields);
+ $this->dbforge->add_key('id', true);
+ $this->dbforge->add_key('pid');
+ $this->dbforge->add_key('private');
+ $this->dbforge->add_key('replyto');
+ $this->dbforge->add_key('created');
+ $this->dbforge->add_key('ip_address');
+ $this->dbforge->add_key('hits');
+ $this->dbforge->add_key('hits_updated');
+ $this->dbforge->create_table('pastes', true);
+ }
+
+ if (!$this->db->table_exists('blocked_ips')) {
+ $this->load->dbforge();
+ $fields = array(
+ 'ip_address' => array(
+ 'type' => 'VARCHAR',
+ 'constraint' => 45,
+ 'default' => 0,
+ ),
+ 'blocked_at' => array(
+ 'type' => 'INT',
+ 'constraint' => 10,
+ ),
+ 'spam_attempts' => array(
+ 'type' => 'INT',
+ 'constraint' => 6,
+ 'default' => 0,
+ ),
+ );
+ $this->dbforge->add_field($fields);
+ $this->dbforge->add_key('ip_address', true);
+ $this->dbforge->create_table('blocked_ips', true);
+ }
+
+ if (!$this->db->table_exists('trending')) {
+ $this->load->dbforge();
+ $fields = array(
+ 'paste_id' => array(
+ 'type' => 'VARCHAR',
+ 'constraint' => 8,
+ ),
+ 'ip_address' => array(
+ 'type' => 'VARCHAR',
+ 'constraint' => 45,
+ 'default' => 0,
+ ),
+ 'created' => array(
+ 'type' => 'INT',
+ 'constraint' => 10,
+ ),
+ );
+ $this->dbforge->add_field($fields);
+ $this->dbforge->add_key('paste_id', true);
+ $this->dbforge->add_key('ip_address', true);
+ $this->dbforge->add_key('created');
+ $this->dbforge->create_table('trending', true);
+ }
+
+ if (!$this->db->field_exists('ip_address', 'pastes')) {
+ $this->load->dbforge();
+ $fields = array(
+ 'ip_address' => array(
+ 'type' => 'VARCHAR',
+ 'constraint' => 45,
+ 'null' => true,
+ ),
+ );
+ $this->dbforge->add_column('pastes', $fields);
+ }
+
+ if (!$this->db->field_exists('hits', 'pastes')) {
+ $this->load->dbforge();
+ $fields = array(
+ 'hits' => array(
+ 'type' => 'INT',
+ 'constraint' => 10,
+ 'default' => 0,
+ ),
+ 'hits_updated' => array(
+ 'type' => 'INT',
+ 'constraint' => 10,
+ 'default' => 0,
+ ),
+ );
+ $this->dbforge->add_key('hits');
+ $this->dbforge->add_key('hits_updated');
+ $this->dbforge->add_column('pastes', $fields);
+ }
+
+ //ipv6 migration
+ $fields = $this->db->field_data('trending');
+
+ if (stristr(config_item('db_driver'), 'sqlite') === false && $fields[1]->max_length < 45) {
+ $db_prefix = config_item('db_prefix');
+
+ if ($this->db->dbdriver == "postgre") {
+ $this->db->query("ALTER TABLE " . $db_prefix . "trending ALTER COLUMN ip_address TYPE VARCHAR(45), ALTER COLUMN ip_address SET NOT NULL, ALTER COLUMN ip_address SET DEFAULT '0'");
+ $this->db->query("ALTER TABLE " . $db_prefix . "pastes ALTER COLUMN ip_address TYPE VARCHAR(45), ALTER COLUMN ip_address SET NOT NULL, ALTER COLUMN ip_address SET DEFAULT '0'");
+ $this->db->query("ALTER TABLE " . $db_prefix . "blocked_ips ALTER COLUMN ip_address TYPE VARCHAR(45), ALTER COLUMN ip_address SET NOT NULL, ALTER COLUMN ip_address SET DEFAULT '0'");
+ $this->db->query("ALTER TABLE " . $db_prefix . "sessions ALTER COLUMN ip_address TYPE VARCHAR(45), ALTER COLUMN ip_address SET NOT NULL, ALTER COLUMN ip_address SET DEFAULT '0'");
+ } else {
+ $this->db->query("ALTER TABLE " . $db_prefix . "trending CHANGE COLUMN ip_address ip_address VARCHAR(45) NOT NULL DEFAULT '0'");
+ $this->db->query("ALTER TABLE " . $db_prefix . "pastes CHANGE COLUMN ip_address ip_address VARCHAR(45) NOT NULL DEFAULT '0'");
+ $this->db->query("ALTER TABLE " . $db_prefix . "blocked_ips CHANGE COLUMN ip_address ip_address VARCHAR(45) NOT NULL DEFAULT '0'");
+ $this->db->query("ALTER TABLE " . $db_prefix . "sessions CHANGE COLUMN ip_address ip_address VARCHAR(45) NOT NULL DEFAULT '0'");
+ }
+ }
+
+ //expand title to 50
+ $fields = $this->db->field_data('pastes');
+ foreach ($fields as $field) {
+
+ if ($field->name == 'title') {
+
+ if (stristr(config_item('db_driver'), 'sqlite') === false && $field->max_length < 50) {
+ $db_prefix = config_item('db_prefix');
+
+ if ($this->db->dbdriver == "postgre") {
+ $this->db->query("ALTER TABLE " . $db_prefix . "pastes ALTER COLUMN title TYPE VARCHAR(50), ALTER COLUMN title SET NOT NULL");
+ } else {
+ $this->db->query("ALTER TABLE " . $db_prefix . "pastes CHANGE COLUMN title title VARCHAR(50) NOT NULL");
+ }
+ }
+ }
+ }
+
+ //upgrade to CI 3.1.2
+ $fields = $this->db->field_data('sessions');
+ foreach ($fields as $field) {
+
+ if ($field->name == 'id') {
+
+ if (stristr(config_item('db_driver'), 'sqlite') === false) {
+
+ if ($field->max_length < 128) {
+ $db_prefix = config_item('db_prefix');
+
+ if ($this->db->dbdriver == "postgre") {
+ $this->db->query("ALTER TABLE " . $db_prefix . "sessions ALTER COLUMN id SET DATA TYPE varchar(128)");
+ } else {
+ $this->db->query("ALTER TABLE " . $db_prefix . "sessions CHANGE id id VARCHAR(128) NOT NULL");
+ }
+ }
+ }
+ }
+ }
+ }
+
+ public function _form_prep($lang = false, $title = '', $paste = '', $reply = false)
+ {
+ $this->load->model('languages');
+ $this->load->helper('form');
+ $data['languages'] = $this->languages->get_languages();
+
+ if (config_item('js_editor') == 'codemirror') {
+
+ //codemirror languages
+ $this->load->config('codemirror_languages');
+ $codemirror_languages = config_item('codemirror_languages');
+ $data['codemirror_languages'] = $codemirror_languages;
+
+ //codemirror modes
+ $cmm = array();
+ foreach ($codemirror_languages as $geshi_name => $l) {
+
+ if (gettype($l) == 'array') {
+ $cmm[$geshi_name] = $l['mode'];
+ }
+ }
+ $data['codemirror_modes'] = $cmm;
+ }
+
+ if (config_item('js_editor') == 'ace') {
+
+ //ace languages
+ $this->load->config('ace_languages');
+ $ace_languages = config_item('ace_languages');
+ $data['ace_languages'] = $ace_languages;
+
+ //ace modes
+ $acem = array();
+ foreach ($ace_languages as $geshi_name => $l) {
+ $acem[$geshi_name] = $l;
+ }
+ $data['ace_modes'] = $acem;
+ }
+
+ //recaptcha
+ $data['use_recaptcha'] = $this->use_recaptcha;
+ $data['recaptcha_publickey'] = $this->recaptcha_publickey;
+
+ if (!$this->input->post('submit')) {
+
+ if (!$this->session->userdata('expire')) {
+ $default_expiration = config_item('default_expiration');
+ $this->session->set_userdata('expire', $default_expiration);
+ }
+
+ if (!$this->session->userdata('snipurl')) {
+ $shorturl_selected = config_item('shorturl_selected');
+ $this->session->set_userdata('snipurl', $shorturl_selected);
+ }
+
+ if ($this->session->flashdata('settings_changed')) {
+ $data['status_message'] = 'Settings successfully changed';
+ }
+ $data['name_set'] = $this->session->userdata('name');
+ $data['expire_set'] = $this->session->userdata('expire');
+ $data['private_set'] = $this->session->userdata('private');
+ $data['snipurl_set'] = $this->session->userdata('snipurl');
+ $data['paste_set'] = $paste;
+ $data['title_set'] = $title;
+ $data['reply'] = $reply;
+
+ if (!$lang) {
+ $lang = config_item('default_language');
+ }
+ $data['lang_set'] = $lang;
+ } else {
+ $data['name_set'] = $this->input->post('name');
+ $data['expire_set'] = $this->input->post('expire');
+ $data['private_set'] = $this->input->post('private');
+ $data['snipurl_set'] = $this->input->post('snipurl');
+ $data['paste_set'] = htmlspecialchars($this->input->post('code'));
+ $data['title_set'] = $this->input->post('title');
+ $data['reply'] = $this->input->post('reply');
+ $data['lang_set'] = $this->input->post('lang');
+ }
+ return $data;
+ }
+
+ public function index()
+ {
+ $this->_valid_authentication();
+ $this->load->helper('json');
+
+ if (!$this->input->post('submit')) {
+ $data = $this->_form_prep();
+ $this->content_expiration(config_item('content_expiration'));
+ $this->load->view('home', $data);
+ } else {
+ $this->load->model('pastes');
+ $this->load->library('form_validation');
+
+ //rules
+ $rules = array(
+ array(
+ 'field' => 'code',
+ 'label' => 'Main Paste',
+ 'rules' => 'required',
+ ),
+ array(
+ 'field' => 'lang',
+ 'label' => 'Language',
+ 'rules' => 'min_length[1]|required|callback__valid_lang',
+ ),
+ array(
+ 'field' => 'captcha',
+ 'label' => 'Captcha',
+ 'rules' => 'callback__valid_captcha',
+ ),
+ array(
+ 'field' => 'valid_ip',
+ 'label' => 'Valid IP',
+ 'rules' => 'callback__valid_ip',
+ ),
+ array(
+ 'field' => 'blockwords_check',
+ 'label' => 'No blocked words',
+ 'rules' => 'callback__blockwords_check',
+ ),
+ array(
+ 'field' => 'email',
+ 'label' => 'Field must remain empty',
+ 'rules' => 'callback__autofill_check',
+ ),
+ );
+
+ //form validation
+ $this->form_validation->set_rules($rules);
+ $this->form_validation->set_message('min_length', lang('empty'));
+ $this->form_validation->set_error_delimiters('<div class="message error"><div class="container">', '</div></div>');
+
+ if ($this->form_validation->run() == false) {
+ $data = $this->_form_prep();
+ $this->load->view('home', $data);
+ } else {
+
+ if (config_item('private_only')) {
+ $_POST['private'] = 1;
+ }
+
+ if (config_item('disable_shorturl')) {
+ $_POST['snipurl'] = 0;
+ }
+
+ if ($this->input->post('reply') == false) {
+ $user_data = array(
+ 'name' => $this->input->post('name'),
+ 'lang' => $this->input->post('lang'),
+ 'expire' => $this->input->post('expire'),
+ 'snipurl' => $this->input->post('snipurl'),
+ 'private' => $this->input->post('private'),
+ );
+ $this->session->set_userdata($user_data);
+ }
+ redirect($this->pastes->createPaste());
+ }
+ }
+ }
+
+ public function post_encrypted()
+ {
+ $this->_valid_authentication();
+
+ if ($this->_valid_captcha($this->input->post('captcha'))) {
+ $this->load->model('pastes');
+ $_POST['private'] = 1;
+ $_POST['snipurl'] = 0;
+ $ret_url = $this->pastes->createPaste();
+ echo $ret_url;
+ } else {
+ echo 'E_CAPTCHA';
+ }
+ }
+
+ public function raw()
+ {
+ $this->_valid_authentication();
+ $this->load->model('pastes');
+ $check = $this->pastes->checkPaste(3);
+
+ if ($check) {
+ $data = $this->pastes->getPaste(3);
+
+ if (isset($_GET['preview'])) {
+ $this->load->helper('text');
+ $data['raw'] = character_limiter($data['raw'], 500);
+ }
+ $this->content_expiration(config_item('content_expiration'));
+ $this->load->view('view/raw', $data);
+ } else {
+ show_404();
+ }
+ }
+
+ public function rss()
+ {
+ $this->_valid_authentication();
+ $this->load->model('pastes');
+ $check = $this->pastes->checkPaste(3);
+
+ if ($check) {
+ $this->load->helper('text');
+ $paste = $this->pastes->getPaste(3);
+ $data = $this->pastes->getReplies(3);
+ $data['page_title'] = $paste['title'] . ' - ' . config_item('site_name');
+ $data['feed_url'] = site_url('view/rss/' . $this->uri->segment(3));
+ $this->load->view('view/rss', $data);
+ } else {
+ show_404();
+ }
+ }
+
+ public function embed()
+ {
+ $this->_valid_authentication();
+ $this->load->model('pastes');
+ $check = $this->pastes->checkPaste(3);
+
+ if ($check) {
+ $data = $this->pastes->getPaste(3, true, $this->uri->segment(4) == 'diff');
+ $this->content_expiration(config_item('content_expiration'));
+ $this->load->view('view/embed', $data);
+ } else {
+ show_404();
+ }
+ }
+
+ public function qr()
+ {
+ $this->load->model('pastes');
+ $check = $this->pastes->checkPaste(3);
+
+ if ($check) {
+ $data = $this->pastes->getPaste(3);
+ $this->content_expiration('+1 year');
+ $this->load->view('view/qr', $data);
+ }
+ }
+
+ public function download()
+ {
+ $this->_valid_authentication();
+ $this->load->model('pastes');
+ $check = $this->pastes->checkPaste(3);
+
+ if ($check) {
+ $data = $this->pastes->getPaste(3);
+ $this->load->view('view/download', $data);
+ } else {
+ show_404();
+ }
+ }
+
+ public function lists()
+ {
+ $this->_valid_authentication();
+
+ if (config_item('private_only')) {
+ show_404();
+ } else {
+ $this->load->model('pastes');
+
+ if ($this->uri->segment(2) == 'rss') {
+ $this->load->helper('text');
+ $data = $this->pastes->getLists('lists/', 3);
+ $data['page_title'] = config_item('site_name');
+ $data['feed_url'] = site_url('lists/rss');
+ $data['replies'] = $data['pastes'];
+ unset($data['pastes']);
+ $this->load->view('view/rss', $data);
+ } else {
+ $data = $this->pastes->getLists('lists/', 2);
+ $this->load->view('list', $data);
+ }
+ }
+ }
+
+ public function trends()
+ {
+ $this->_valid_authentication();
+
+ if (config_item('private_only')) {
+ show_404();
+ } else {
+ $this->load->model('pastes');
+ $data = $this->pastes->getTrends();
+ $this->load->view('trends', $data);
+ }
+ }
+
+ public function view()
+ {
+ $this->_valid_authentication();
+ $this->load->helper('json');
+ $this->load->model('pastes');
+ $check = $this->pastes->checkPaste(2);
+
+ if ($check) {
+
+ if ($this->session->userdata('view_raw')) {
+ redirect('view/raw/' . $this->uri->segment(2));
+ }
+ $data = $this->pastes->getPaste(2, true, $this->uri->segment(3) == 'diff');
+ $data['reply_form'] = $this->_form_prep($data['lang_code'], 'Re: ' . $data['title'], $data['raw'], $data['pid']);
+
+ if ($data['private'] == 1) {
+ $data['reply_form']['use_recaptcha'] = $this->use_recaptcha;
+ }
+ $this->content_expiration(config_item('content_expiration'));
+ $this->load->view('view/view', $data);
+ } else {
+ show_404();
+ }
+ }
+
+ public function cron()
+ {
+ $this->load->model('pastes');
+ $key = $this->uri->segment(2);
+
+ if ($key != config_item('cron_key')) {
+ show_404();
+ } else {
+ $this->pastes->cron();
+ return 0;
+ }
+ }
+
+ public function about()
+ {
+ $this->load->view('about');
+ }
+
+ public function captcha()
+ {
+ $this->load->helper('captcha');
+
+ //get "word"
+ $pool = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ@';
+ $str = '';
+ for ($i = 0; $i < 8; $i++) {
+ $str .= substr($pool, mt_rand(0, strlen($pool) - 1), 1);
+ }
+ $word = $str;
+
+ //save
+ $this->session->set_userdata(array(
+ 'captcha' => $word,
+ ));
+
+ //view
+ $this->load->view('view/captcha', array(
+ 'word' => $word,
+ ));
+ }
+
+ public function _valid_lang($lang)
+ {
+ $this->load->model('languages');
+ $this->form_validation->set_message('_valid_lang', lang('valid_lang'));
+ return $this->languages->valid_language($lang);
+ }
+
+ public function _valid_captcha($text)
+ {
+
+ if (config_item('enable_captcha') && $this->session->userdata('is_human') === null) {
+
+ if (isset($this->form_validation)) {
+ $this->form_validation->set_message('_valid_captcha', lang('captcha'));
+ }
+
+ if ($this->use_recaptcha) {
+
+ if ($this->_valid_recaptcha()) {
+ $this->session->set_userdata('is_human', true);
+ return true;
+ } else {
+ return false;
+ }
+ } else {
+
+ if (strtolower($text) == strtolower($this->session->userdata('captcha'))) {
+ $this->session->set_userdata('is_human', true);
+ return true;
+ } else {
+ return false;
+ }
+ }
+ } else {
+ return true;
+ }
+ }
+
+ public function _valid_recaptcha()
+ {
+
+ if ($this->recaptcha_privatekey == null || $this->recaptcha_privatekey == '') {
+ die("To use reCAPTCHA you must get an API key from <a href='https://www.google.com/recaptcha/admin/create'>https://www.google.com/recaptcha/admin/create</a>");
+ }
+
+ if ($this->input->post('g-recaptcha-response')) {
+ $pk = $this->recaptcha_privatekey;
+ $ra = $_SERVER['REMOTE_ADDR'];
+ $rf = trim($this->input->post('g-recaptcha-response'));
+ $url = "https://www.google.com/recaptcha/api/siteverify?secret=" . $pk . "&response;=" . $rf . "&remoteip;=" . $ra;
+ $response = $this->curl->simple_get($url);
+ $status = json_decode($response, true);
+ $recaptcha_response = new stdClass();
+
+ if ($status['success']) {
+ $recaptcha_response->is_valid = true;
+ } else {
+ $recaptcha_response->is_valid = false;
+ }
+ return $recaptcha_response;
+ } else {
+ return false;
+ }
+ }
+
+ public function _valid_ip()
+ {
+
+ //get ip
+ $ip_address = $this->input->ip_address();
+
+ if (stristr($ip_address, ':')) {
+ return $this->_valid_ipv6($ip_address);
+ } else {
+ return $this->_valid_ipv4($ip_address);
+ }
+ }
+
+ public function _valid_ipv4($ip_address)
+ {
+
+ //get ip range
+ $ip = explode('.', $ip_address);
+ $ip_firstpart = $ip[0] . '.' . $ip[1] . '.';
+
+ //setup message
+ $this->form_validation->set_message('_valid_ip', lang('not_allowed'));
+
+ //lookup
+ $this->db->select('ip_address, spam_attempts');
+ $this->db->like('ip_address', $ip_firstpart, 'after');
+ $query = $this->db->get('blocked_ips');
+
+ //check
+
+ if ($query->num_rows() > 0) {
+
+ //update spamcount
+ $blocked_ips = $query->result_array();
+ $spam_attempts = $blocked_ips[0]['spam_attempts'];
+ $this->db->where('ip_address', $ip_address);
+ $this->db->update('blocked_ips', array(
+ 'spam_attempts' => $spam_attempts + 1,
+ ));
+
+ //return for the validation
+ return false;
+ } else {
+ return true;
+ }
+ }
+
+ public function _valid_ipv6($ip_address)
+ {
+
+ //setup message
+ $this->form_validation->set_message('_valid_ip', lang('not_allowed'));
+
+ //lookup
+ $this->db->select('ip_address, spam_attempts');
+ $this->db->where('ip_address', $ip_address);
+ $query = $this->db->get('blocked_ips');
+
+ //check
+
+ if ($query->num_rows() > 0) {
+
+ //update spamcount
+ $blocked_ips = $query->result_array();
+ $spam_attempts = $blocked_ips[0]['spam_attempts'];
+ $this->db->where('ip_address', $ip_address);
+ $this->db->update('blocked_ips', array(
+ 'spam_attempts' => $spam_attempts + 1,
+ ));
+
+ //return for the validation
+ return false;
+ } else {
+ return true;
+ }
+ }
+
+ public function _blockwords_check()
+ {
+
+ //setup message
+ $this->form_validation->set_message('_blockwords_check', lang('blocked_words'));
+
+ //check
+ $blocked_words = config_item('blocked_words');
+ $post = $this->input->post();
+
+ if (!$blocked_words) {
+ return true;
+ }
+
+ //we have blocked words
+ foreach (explode(',', $blocked_words) as $word) {
+ $word = trim($word);
+
+ if (stristr($post['code'], $word) || stristr($post['title'], $word)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public function _autofill_check()
+ {
+
+ //setup message
+ $this->form_validation->set_message('_autofill_check', lang('robot'));
+
+ //check
+ return (!$this->input->post('email') && !$this->input->post('url'));
+ }
+
+ public function _valid_authentication()
+ {
+
+ if (config_item('require_auth')) {
+
+ if (!$this->auth_ldap->is_authenticated()) {
+ $this->session->set_flashdata('tried_to', "/" . $this->uri->uri_string());
+ redirect('/auth');
+ }
+ }
+ }
+
+ public function get_cm_js()
+ {
+ $lang = $this->uri->segment(3);
+ $this->load->config('codemirror_languages');
+ $cml = config_item('codemirror_languages');
+
+ //file path
+ $file_path = 'themes/' . config_item('theme') . '/js/';
+
+ if (!file_exists($file_path)) {
+ $file_path = 'themes/default/js/';
+ }
+
+ if (isset($cml[$lang]) && gettype($cml[$lang]) == 'array') {
+ header('Content-Type: application/x-javascript; charset=utf-8');
+ header('Expires: ' . gmdate('D, d M Y H:i:s \G\M\T', time() + 60 * 60 * 24 * 30));
+ foreach ($cml[$lang]['js'] as $js) {
+ echo file_get_contents($file_path . $js[0]);
+ }
+ }
+ exit;
+ }
+
+ public function error_404()
+ {
+ show_404();
+ }
+
+ public function robots_txt()
+ {
+
+ if (config_item('disallow_search_engines')) {
+ header('Content-Type: text/plain; charset=utf-8');
+ $this->load->view('robots_txt');
+ } else {
+ echo '';
+ }
+ }
+
+ public function content_expiration($cache_time)
+ {
+ if (!$cache_time) {
+ $cache_time = '-1 week';
+ }
+ $cache_expiration = strtotime($cache_time);
+ $this->output->set_header('Pragma: ', true);
+ $this->output->set_header('Cache-Control: ', true);
+ $this->output->set_header('Expires: ' . gmdate('D, d M Y H:i:s', $cache_expiration) . ' GMT', true);
+ }
}
diff --git a/htdocs/application/controllers/Spamadmin.php b/htdocs/application/controllers/Spamadmin.php
index 8bd9682..0f03645 100644
--- a/htdocs/application/controllers/Spamadmin.php
+++ b/htdocs/application/controllers/Spamadmin.php
@@ -1,159 +1,139 @@
-<?php
-/**
- * Class and Function List:
- * Function list:
- * - __construct()
- * - index()
- * - spam_detail()
- * - blacklist()
- * - unblock_ip()
- * Classes list:
- * - Spamadmin extends CI_Controller
- */
+<?php if (!defined('BASEPATH')) {
+ exit('No direct script access allowed');
+}
class Spamadmin extends CI_Controller
{
-
- function __construct()
- {
- parent::__construct();
-
- //protection
- $user = $this->config->item('spamadmin_user');
- $pass = $this->config->item('spamadmin_pass');
-
- // FastCGI doesn't provide PHP_AUTH_USER and PHP_AUTH_PW, apparently?
- if (empty($_SERVER['PHP_AUTH_USER']) && empty($_SERVER['PHP_AUTH_PW'])) {
- if (!empty($_SERVER['HTTP_AUTHORIZATION'])) {
- list($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']) = explode(':', base64_decode(substr($_SERVER['HTTP_AUTHORIZATION'], 6)));
- }
- }
-
- // If they're not set, set them to blank. The null coalesce operator would be handy here, but
- // that's PHP 7.0 and higher...
- if (empty($_SERVER['PHP_AUTH_USER']))
- {
- $_SERVER['PHP_AUTH_USER'] = "";
- }
- if (empty($_SERVER['PHP_AUTH_PW']))
- {
- $_SERVER['PHP_AUTH_PW'] = "";
- }
-
- if ($user === '' || $pass === '' || $_SERVER['PHP_AUTH_USER'] !== $user || $_SERVER['PHP_AUTH_PW'] !== $pass)
- {
- header('WWW-Authenticate: Basic realm="Spamadmin"');
- header('HTTP/1.0 401 Unauthorized');
- exit;
- }
- }
-
- function index()
- {
- $this->load->model('pastes');
- $pastes_to_delete = $this->input->post('pastes_to_delete');
-
- if ($pastes_to_delete)
- {
- foreach (explode(' ', $pastes_to_delete) as $pid)
- {
- $this->db->where('pid', $pid);
- $this->db->delete('pastes');
- }
- redirect(site_url('spamadmin/' . $this->uri->segment(2)));
- }
-
- //render view
- $data = $this->pastes->getSpamLists();
- $this->load->view('list_ips', $data);
- }
-
- function spam_detail()
- {
- $this->load->model('pastes');
- $ip_address = $this->uri->segment(2);
-
- if ($this->input->post('confirm_remove') && $ip_address != '')
- {
- $this->db->where('ip_address', $ip_address);
- $this->db->delete('pastes');
- $paste_count = $this->db->affected_rows();
-
- if ($this->input->post('block_ip'))
- {
- $query = $this->db->get_where('blocked_ips', array(
- 'ip_address' => $ip_address
- ));
-
- if ($query->num_rows() == 0)
- {
- $this->db->insert('blocked_ips', array(
- 'ip_address' => $ip_address,
- 'blocked_at' => time() ,
- 'spam_attempts' => $paste_count,
- ));
- }
- }
- }
-
- //fill data
- $data = $this->pastes->getSpamLists('spamadmin/' . $ip_address, $seg = 3, $ip_address);
- $data['ip_address'] = $ip_address;
- $ip = explode('.', $ip_address);
-
- if (count($ip) > 1)
- {
- $ip_firstpart = $ip[0] . '.' . $ip[1] . '.';
- $data['ip_range'] = $ip_firstpart . '*.*';
- }
- else
- {
-
- // ipv6
- $ip = explode(':', $ip_address);
- $ip_firstpart = $ip[0] . ':' . $ip[1] . ':' . $ip[2] . ':' . $ip[3] . ':' . $ip[4] . ':' . $ip[5] . ':' . $ip[6];
- $data['ip_range'] = $ip_firstpart . ':*';
- }
-
- //view
- $this->load->view('spam_detail', $data);
- }
-
- function blacklist()
- {
-
- //pagination
- $amount = $this->config->item('per_page');
- $page = ($this->uri->segment(3) ? $this->uri->segment(3) : 0);
-
- //get
- $this->db->select('ip_address, blocked_at, spam_attempts');
- $this->db->order_by('blocked_at desc, ip_address asc');
- $query = $this->db->get('blocked_ips', $amount, $page);
- $data['blocked_ips'] = $query->result_array();
-
- //pagination
- $config['base_url'] = site_url('spamadmin/blacklist');
- $query = $this->db->get('blocked_ips');
- $config['total_rows'] = $query->num_rows();
- $config['per_page'] = $amount;
- $config['num_links'] = 9;
- $config['full_tag_open'] = '<div class="pages">';
- $config['full_tag_close'] = '</div>';
- $config['uri_segment'] = 3;
- $this->load->library('pagination');
- $this->pagination->initialize($config);
- $data['pages'] = $this->pagination->create_links();
-
- //view
- $this->load->view('list_blocked_ips', $data);
- }
-
- function unblock_ip()
- {
- $ip_address = $this->uri->segment(4);
- $this->db->where('ip_address', $ip_address);
- $this->db->delete('blocked_ips');
- redirect('spamadmin/blacklist');
- }
+
+ public function __construct()
+ {
+ parent::__construct();
+
+ //protection
+ $user = $this->config->item('spamadmin_user');
+ $pass = $this->config->item('spamadmin_pass');
+
+ // FastCGI doesn't provide PHP_AUTH_USER and PHP_AUTH_PW, apparently?
+ if (empty($_SERVER['PHP_AUTH_USER']) && empty($_SERVER['PHP_AUTH_PW'])) {
+ if (!empty($_SERVER['HTTP_AUTHORIZATION'])) {
+ list($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']) = explode(':', base64_decode(substr($_SERVER['HTTP_AUTHORIZATION'], 6)));
+ }
+ }
+
+ // If they're not set, set them to blank. The null coalesce operator would be handy here, but
+ // that's PHP 7.0 and higher...
+ if (empty($_SERVER['PHP_AUTH_USER'])) {
+ $_SERVER['PHP_AUTH_USER'] = "";
+ }
+ if (empty($_SERVER['PHP_AUTH_PW'])) {
+ $_SERVER['PHP_AUTH_PW'] = "";
+ }
+
+ if ($user === '' || $pass === '' || $_SERVER['PHP_AUTH_USER'] !== $user || $_SERVER['PHP_AUTH_PW'] !== $pass) {
+ header('WWW-Authenticate: Basic realm="Spamadmin"');
+ header('HTTP/1.0 401 Unauthorized');
+ exit;
+ }
+ }
+
+ public function index()
+ {
+ $this->load->model('pastes');
+ $pastes_to_delete = $this->input->post('pastes_to_delete');
+
+ if ($pastes_to_delete) {
+ foreach (explode(' ', $pastes_to_delete) as $pid) {
+ $this->db->where('pid', $pid);
+ $this->db->delete('pastes');
+ }
+ redirect(site_url('spamadmin/' . $this->uri->segment(2)));
+ }
+
+ //render view
+ $data = $this->pastes->getSpamLists();
+ $this->load->view('list_ips', $data);
+ }
+
+ public function spam_detail()
+ {
+ $this->load->model('pastes');
+ $ip_address = $this->uri->segment(2);
+
+ if ($this->input->post('confirm_remove') && $ip_address != '') {
+ $this->db->where('ip_address', $ip_address);
+ $this->db->delete('pastes');
+ $paste_count = $this->db->affected_rows();
+
+ if ($this->input->post('block_ip')) {
+ $query = $this->db->get_where('blocked_ips', array(
+ 'ip_address' => $ip_address,
+ ));
+
+ if ($query->num_rows() == 0) {
+ $this->db->insert('blocked_ips', array(
+ 'ip_address' => $ip_address,
+ 'blocked_at' => time(),
+ 'spam_attempts' => $paste_count,
+ ));
+ }
+ }
+ }
+
+ //fill data
+ $data = $this->pastes->getSpamLists('spamadmin/' . $ip_address, $seg = 3, $ip_address);
+ $data['ip_address'] = $ip_address;
+ $ip = explode('.', $ip_address);
+
+ if (count($ip) > 1) {
+ $ip_firstpart = $ip[0] . '.' . $ip[1] . '.';
+ $data['ip_range'] = $ip_firstpart . '*.*';
+ } else {
+
+ // ipv6
+ $ip = explode(':', $ip_address);
+ $ip_firstpart = $ip[0] . ':' . $ip[1] . ':' . $ip[2] . ':' . $ip[3] . ':' . $ip[4] . ':' . $ip[5] . ':' . $ip[6];
+ $data['ip_range'] = $ip_firstpart . ':*';
+ }
+
+ //view
+ $this->load->view('spam_detail', $data);
+ }
+
+ public function blacklist()
+ {
+
+ //pagination
+ $amount = $this->config->item('per_page');
+ $page = ($this->uri->segment(3) ? $this->uri->segment(3) : 0);
+
+ //get
+ $this->db->select('ip_address, blocked_at, spam_attempts');
+ $this->db->order_by('blocked_at desc, ip_address asc');
+ $query = $this->db->get('blocked_ips', $amount, $page);
+ $data['blocked_ips'] = $query->result_array();
+
+ //pagination
+ $config['base_url'] = site_url('spamadmin/blacklist');
+ $query = $this->db->get('blocked_ips');
+ $config['total_rows'] = $query->num_rows();
+ $config['per_page'] = $amount;
+ $config['num_links'] = 9;
+ $config['full_tag_open'] = '<div class="pages">';
+ $config['full_tag_close'] = '</div>';
+ $config['uri_segment'] = 3;
+ $this->load->library('pagination');
+ $this->pagination->initialize($config);
+ $data['pages'] = $this->pagination->create_links();
+
+ //view
+ $this->load->view('list_blocked_ips', $data);
+ }
+
+ public function unblock_ip()
+ {
+ $ip_address = $this->uri->segment(4);
+ $this->db->where('ip_address', $ip_address);
+ $this->db->delete('blocked_ips');
+ redirect('spamadmin/blacklist');
+ }
}
diff --git a/htdocs/application/controllers/Theme_assets.php b/htdocs/application/controllers/Theme_assets.php
index a6d084f..8bb87cc 100644
--- a/htdocs/application/controllers/Theme_assets.php
+++ b/htdocs/application/controllers/Theme_assets.php
@@ -1,227 +1,191 @@
-<?php
-/**
- * Class and Function List:
- * Function list:
- * - __construct()
- * - css()
- * - fonts()
- * - images()
- * - js()
- * - _expires_header()
- * Classes list:
- * - Theme_assets extends CI_Controller
- */
+<?php if (!defined('BASEPATH')) {
+ exit('No direct script access allowed');
+}
class Theme_assets extends CI_Controller
{
-
- function __construct()
- {
- parent::__construct();
- $this->theme = config_item('theme');
- }
-
- function css()
- {
- $css_file = $this->uri->segment(4);
- $css_file = basename($css_file); // Fix LFI Vulnerability
-
-
- if ($css_file == 'fonts')
- {
- $font_file = $this->uri->segment(5);
- $font_file = basename($font_file);
-
- //file path
- $file_path = 'themes/' . $this->theme . '/css/fonts/' . $font_file;
-
- if (!file_exists($file_path))
- {
- return false;
- }
- $path_parts = pathinfo(dirname(dirname(dirname(__FILE__))) . '/' . $file_path);
-
- if ($path_parts['extension'] == "woff")
- {
- header('Content-type: application/font-woff');
- }
-
- if ($path_parts['extension'] == "eot")
- {
- header('Content-type: application/vnd.ms-fontobject');
- }
-
- if ($path_parts['extension'] == "ttf" || $path_parts['extension'] == "ttc")
- {
- header('Content-type: application/x-font-ttf');
- }
-
- if ($path_parts['extension'] == "otf")
- {
- header('Content-type: font/opentype');
- }
-
- if ($path_parts['extension'] == "svg")
- {
- header('Content-type: image/svg+xml');
- }
-
- if ($path_parts['extension'] == "svgz")
- {
- header("Content-Encoding: gzip");
- header('Content-type: image/svg+xml');
- }
-
- //send
- $this->_expires_header(1);
- readfile($file_path);
- }
- else
- {
-
- //file path
- $file_path = 'themes/' . $this->theme . '/css/' . $css_file;
-
- //fallback to default css if view in theme not found
-
- if (!file_exists($file_path))
- {
- $file_path = 'themes/default/css/' . $css_file;
- }
-
- // Double checking file
-
- if (!file_exists($file_path))
- {
- return false;
- }
-
- //send
- header('Content-type: text/css');
- $this->_expires_header(1);
- readfile($file_path);
- }
- }
-
- function fonts()
- {
- $font_file = $this->uri->segment(4);
-
- //file path
- $file_path = 'themes/' . $this->theme . '/fonts/' . $font_file;
-
- //no fallback to default, since default has no such fonts
- //since no fallbcack, there is no doucle checking for file
-
-
- if (!file_exists($file_path))
- {
- return false;
- }
-
- //send
- $path_parts = pathinfo(dirname(dirname(dirname(__FILE__))) . '/' . $file_path);
-
- if ($path_parts['extension'] == "woff")
- {
- header('Content-type: application/font-woff');
- }
-
- if ($path_parts['extension'] == "eot")
- {
- header('Content-type: application/vnd.ms-fontobject');
- }
-
- if ($path_parts['extension'] == "ttf" || $path_parts['extension'] == "ttc")
- {
- header('Content-type: application/x-font-ttf');
- }
-
- if ($path_parts['extension'] == "otf")
- {
- header('Content-type: font/opentype');
- }
-
- if ($path_parts['extension'] == "svg")
- {
- header('Content-type: image/svg+xml');
- }
-
- if ($path_parts['extension'] == "svgz")
- {
- header("Content-Encoding: gzip");
- header('Content-type: image/svg+xml');
- }
- $this->_expires_header(1);
- readfile($file_path);
- }
-
- function images()
- {
- $image_file = $this->uri->segment(4);
- $image_file = basename($image_file);
-
- //file path
- $file_path = 'themes/' . $this->theme . '/images/' . $image_file;
-
- //fallback to default css if view in theme not found
-
- if (!file_exists($file_path))
- {
- $file_path = 'themes/default/images/' . $image_file;
- }
-
- // double checking file
-
- if (!file_exists($file_path))
- {
- return false;
- }
-
- //send
- $size = getimagesize($file_path);
- header('Content-type: ' . $size['mime']);
- $this->_expires_header(30);
- readfile($file_path);
- }
-
- function js()
- {
-
- //get js
- $segments = $this->uri->segment_array();
- array_shift($segments);
- array_shift($segments);
- array_shift($segments);
- $js_file = implode('/', $segments);
- $js_file = str_replace('../', '', $js_file);
-
- //file path
- $file_path = 'themes/' . $this->theme . '/js/' . $js_file;
-
- //fallback to default js if js in theme not found
-
- if (!file_exists($file_path))
- {
- $file_path = 'themes/default/js/' . $js_file;
- }
-
- // return empty string if not found, to not mess up existing JS
-
- if (!file_exists($file_path))
- {
- header('HTTP/1.1 404 Not Found');
- return '';
- }
-
- //send
- header('Content-Type: application/x-javascript; charset=utf-8');
- $this->_expires_header(30);
- readfile($file_path);
- }
- private
- function _expires_header($days)
- {
- header('Expires: ' . gmdate('D, d M Y H:i:s \G\M\T', time() + 60 * 60 * 24 * $days));
- }
+
+ public function __construct()
+ {
+ parent::__construct();
+ $this->theme = config_item('theme');
+ }
+
+ public function css()
+ {
+ $css_file = $this->uri->segment(4);
+ $css_file = basename($css_file); // Fix LFI Vulnerability
+
+ if ($css_file == 'fonts') {
+ $font_file = $this->uri->segment(5);
+ $font_file = basename($font_file);
+
+ //file path
+ $file_path = 'themes/' . $this->theme . '/css/fonts/' . $font_file;
+
+ if (!file_exists($file_path)) {
+ return false;
+ }
+ $path_parts = pathinfo(dirname(dirname(dirname(__FILE__))) . '/' . $file_path);
+
+ if ($path_parts['extension'] == "woff") {
+ header('Content-type: application/font-woff');
+ }
+
+ if ($path_parts['extension'] == "eot") {
+ header('Content-type: application/vnd.ms-fontobject');
+ }
+
+ if ($path_parts['extension'] == "ttf" || $path_parts['extension'] == "ttc") {
+ header('Content-type: application/x-font-ttf');
+ }
+
+ if ($path_parts['extension'] == "otf") {
+ header('Content-type: font/opentype');
+ }
+
+ if ($path_parts['extension'] == "svg") {
+ header('Content-type: image/svg+xml');
+ }
+
+ if ($path_parts['extension'] == "svgz") {
+ header("Content-Encoding: gzip");
+ header('Content-type: image/svg+xml');
+ }
+
+ //send
+ $this->_expires_header(1);
+ readfile($file_path);
+ } else {
+
+ //file path
+ $file_path = 'themes/' . $this->theme . '/css/' . $css_file;
+
+ //fallback to default css if view in theme not found
+
+ if (!file_exists($file_path)) {
+ $file_path = 'themes/default/css/' . $css_file;
+ }
+
+ // Double checking file
+
+ if (!file_exists($file_path)) {
+ return false;
+ }
+
+ //send
+ header('Content-type: text/css');
+ $this->_expires_header(1);
+ readfile($file_path);
+ }
+ }
+
+ public function fonts()
+ {
+ $font_file = $this->uri->segment(4);
+
+ //file path
+ $file_path = 'themes/' . $this->theme . '/fonts/' . $font_file;
+
+ //no fallback to default, since default has no such fonts
+ //since no fallbcack, there is no doucle checking for file
+
+ if (!file_exists($file_path)) {
+ return false;
+ }
+
+ //send
+ $path_parts = pathinfo(dirname(dirname(dirname(__FILE__))) . '/' . $file_path);
+
+ if ($path_parts['extension'] == "woff") {
+ header('Content-type: application/font-woff');
+ }
+
+ if ($path_parts['extension'] == "eot") {
+ header('Content-type: application/vnd.ms-fontobject');
+ }
+
+ if ($path_parts['extension'] == "ttf" || $path_parts['extension'] == "ttc") {
+ header('Content-type: application/x-font-ttf');
+ }
+
+ if ($path_parts['extension'] == "otf") {
+ header('Content-type: font/opentype');
+ }
+
+ if ($path_parts['extension'] == "svg") {
+ header('Content-type: image/svg+xml');
+ }
+
+ if ($path_parts['extension'] == "svgz") {
+ header("Content-Encoding: gzip");
+ header('Content-type: image/svg+xml');
+ }
+ $this->_expires_header(1);
+ readfile($file_path);
+ }
+
+ public function images()
+ {
+ $image_file = $this->uri->segment(4);
+ $image_file = basename($image_file);
+
+ //file path
+ $file_path = 'themes/' . $this->theme . '/images/' . $image_file;
+
+ //fallback to default css if view in theme not found
+
+ if (!file_exists($file_path)) {
+ $file_path = 'themes/default/images/' . $image_file;
+ }
+
+ // double checking file
+
+ if (!file_exists($file_path)) {
+ return false;
+ }
+
+ //send
+ $size = getimagesize($file_path);
+ header('Content-type: ' . $size['mime']);
+ $this->_expires_header(30);
+ readfile($file_path);
+ }
+
+ public function js()
+ {
+
+ //get js
+ $segments = $this->uri->segment_array();
+ array_shift($segments);
+ array_shift($segments);
+ array_shift($segments);
+ $js_file = implode('/', $segments);
+ $js_file = str_replace('../', '', $js_file);
+
+ //file path
+ $file_path = 'themes/' . $this->theme . '/js/' . $js_file;
+
+ //fallback to default js if js in theme not found
+
+ if (!file_exists($file_path)) {
+ $file_path = 'themes/default/js/' . $js_file;
+ }
+
+ // return empty string if not found, to not mess up existing JS
+
+ if (!file_exists($file_path)) {
+ header('HTTP/1.1 404 Not Found');
+ return '';
+ }
+
+ //send
+ header('Content-Type: application/x-javascript; charset=utf-8');
+ $this->_expires_header(30);
+ readfile($file_path);
+ }
+ private function _expires_header($days)
+ {
+ header('Expires: ' . gmdate('D, d M Y H:i:s \G\M\T', time() + 60 * 60 * 24 * $days));
+ }
}
diff --git a/htdocs/application/controllers/Unittest.php b/htdocs/application/controllers/Unittest.php
index 3a12be0..937ab92 100644
--- a/htdocs/application/controllers/Unittest.php
+++ b/htdocs/application/controllers/Unittest.php
@@ -1,57 +1,50 @@
-<?php
-/**
- * Class and Function List:
- * Function list:
- * - __construct()
- * - index()
- * Classes list:
- * - Unittest extends CI_Controller
- */
+<?php if (!defined('BASEPATH')) {
+ exit('No direct script access allowed');
+}
class Unittest extends CI_Controller
{
-
- function __construct()
- {
- parent::__construct();
-
- //protection
-
- if ($_SERVER['HTTP_HOST'] != 'stikked')
- {
- exit;
- }
- }
-
- function index()
- {
- $this->load->library('unit_test');
- $this->load->model('pastes');
-
- //self test
- $test = 1 + 1;
- $expected_result = 2;
- $test_name = 'Self test: Adds one plus one';
- $this->unit->run($test, $expected_result, $test_name);
-
- //manipulation: create paste
- $_POST['code'] = '<?php echo "hello world!";';
- $_POST['lang'] = 'php';
- $_POST['title'] = 'hello world';
- $_POST['name'] = 'stikkeduser';
- $pid = $this->pastes->createPaste();
-
- //paste created, has pid
- $test = $pid;
- $expected_result = 'is_string';
- $test_name = 'Create paste, has pid';
- $this->unit->run($test, $expected_result, $test_name);
- $pid = str_replace('view/', '', $pid);
-
- //manipulation: delete paste
- $this->pastes->delete_paste($pid);
-
- //report
- echo $this->unit->report();
- }
+
+ public function __construct()
+ {
+ parent::__construct();
+
+ //protection
+
+ if ($_SERVER['HTTP_HOST'] != 'stikked') {
+ exit;
+ }
+ }
+
+ public function index()
+ {
+ $this->load->library('unit_test');
+ $this->load->model('pastes');
+
+ //self test
+ $test = 1 + 1;
+ $expected_result = 2;
+ $test_name = 'Self test: Adds one plus one';
+ $this->unit->run($test, $expected_result, $test_name);
+
+ //manipulation: create paste
+ $_POST['code'] = '<?php echo "hello world!";';
+ $_POST['lang'] = 'php';
+ $_POST['title'] = 'hello world';
+ $_POST['name'] = 'stikkeduser';
+ $pid = $this->pastes->createPaste();
+
+ //paste created, has pid
+ $test = $pid;
+ $expected_result = 'is_string';
+ $test_name = 'Create paste, has pid';
+ $this->unit->run($test, $expected_result, $test_name);
+ $pid = str_replace('view/', '', $pid);
+
+ //manipulation: delete paste
+ $this->pastes->delete_paste($pid);
+
+ //report
+ echo $this->unit->report();
+ }
}
diff --git a/htdocs/application/core/MY_Loader.php b/htdocs/application/core/MY_Loader.php
index 1b1f1da..64d67b6 100644
--- a/htdocs/application/core/MY_Loader.php
+++ b/htdocs/application/core/MY_Loader.php
@@ -1,209 +1,178 @@
-<?php
-/**
- * Class and Function List:
- * Function list:
- * - __construct()
- * - view()
- * - _ci_load()
- * Classes list:
- * - MY_Loader extends CI_Loader
- */
-
-if (!defined('BASEPATH')) exit('No direct script access allowed');
+<?php if (!defined('BASEPATH')) {
+ exit('No direct script access allowed');
+}
class MY_Loader extends CI_Loader
{
-
- function __construct()
- {
- parent::__construct();
- log_message('debug', 'MY_Loader Class Initialized');
- }
-
- function view($view, $vars = array() , $return = FALSE)
- {
-
- //theme name
- $theme = config_item('theme');
-
- //view path
- $view_path = 'themes/' . $theme . '/views/' . $view . '.php';
-
- //fallback to default view if view in theme not found
-
- if (!file_exists($view_path))
- {
- $view_path = 'themes/default/views/' . $view . '.php';
- }
-
- //return
- return $this->_ci_load(array(
- '_ci_view' => $view_path,
- '_ci_vars' => $this->_ci_prepare_view_vars($vars) ,
- '_ci_return' => $return
- ));
- }
-
- // --------------------------------------------------------------------
-
- /**
- * Internal CI Data Loader
- *
- * Used to load views and files.
- *
- * Variables are prefixed with _ci_ to avoid symbol collision with
- * variables made available to view files.
- *
- * @used-by CI_Loader::view()
- * @used-by CI_Loader::file()
- * @param array $_ci_data Data to load
- * @return object
- */
- protected
- function _ci_load($_ci_data)
- {
-
- // Set the default data variables
- foreach (array(
- '_ci_view',
- '_ci_vars',
- '_ci_path',
- '_ci_return'
- ) as $_ci_val)
- {
- $$_ci_val = isset($_ci_data[$_ci_val]) ? $_ci_data[$_ci_val] : FALSE;
- }
- $file_exists = FALSE;
-
- // Set the path to the requested file
-
- if (is_string($_ci_path) && $_ci_path !== '')
- {
- $_ci_x = explode('/', $_ci_path);
- $_ci_file = end($_ci_x);
- }
- else
- {
- $_ci_ext = pathinfo($_ci_view, PATHINFO_EXTENSION);
- $_ci_file = ($_ci_ext === '') ? $_ci_view . '.php' : $_ci_view;
- foreach ($this->_ci_view_paths as $_ci_view_file => $cascade)
- {
-
- /* *** modification for stikked themes ***
- *
- * we are by default in the htdocs/application/views folder, which is bad.
- * for security reasons, themes folder should be outside the application dir.
- * but file_exists() doesn't work with ../../ in filenames :-(
- * so, applying the full FrontControllerPATH here, making ../../ superfluous.
- *
- */
-
- if (file_exists(FCPATH . $_ci_file))
- {
- $_ci_path = FCPATH . $_ci_file;
- $file_exists = TRUE;
- break;
- }
-
- if (!$cascade)
- {
- break;
- }
- }
- }
-
- if (!$file_exists && !file_exists($_ci_path))
- {
- show_error('Unable to load the requested file: ' . $_ci_file);
- }
-
- // This allows anything loaded using $this->load (views, files, etc.)
- // to become accessible from within the Controller and Model functions.
-
- $_ci_CI = & get_instance();
- foreach (get_object_vars($_ci_CI) as $_ci_key => $_ci_var)
- {
-
- if (!isset($this->$_ci_key))
- {
- $this->$_ci_key = & $_ci_CI->$_ci_key;
- }
- }
-
- /*
- * Extract and cache variables
- *
- * You can either set variables using the dedicated $this->load->vars()
- * function or via the second parameter of this function. We'll merge
- * the two types and cache them so that views that are embedded within
- * other views can have access to these variables.
- */
-
- if (is_array($_ci_vars))
- {
- $this->_ci_cached_vars = array_merge($this->_ci_cached_vars, $_ci_vars);
- }
- extract($this->_ci_cached_vars);
-
- /*
- * Buffer the output
- *
- * We buffer the output for two reasons:
- * 1. Speed. You get a significant speed boost.
- * 2. So that the final rendered template can be post-processed by
- * the output class. Why do we need post processing? For one thing,
- * in order to show the elapsed page load time. Unless we can
- * intercept the content right before it's sent to the browser and
- * then stop the timer it won't be accurate.
- */
- ob_start();
-
- // If the PHP installation does not support short tags we'll
- // do a little string replacement, changing the short tags
-
- // to standard PHP echo statements.
-
-
- if (!is_php('5.4') && !ini_get('short_open_tag') && config_item('rewrite_short_tags') === TRUE)
- {
- echo eval('?>' . preg_replace('/;*\s*\?>/', '; ?>', str_replace('<?=', '<?php echo ', file_get_contents($_ci_path))));
- }
- else
- {
- include ($_ci_path); // include() vs include_once() allows for multiple views with the same name
-
-
- }
- log_message('info', 'File loaded: ' . $_ci_path);
-
- // Return the file data if requested
-
- if ($_ci_return === TRUE)
- {
- $buffer = ob_get_contents();
- @ob_end_clean();
- return $buffer;
- }
-
- /*
- * Flush the buffer... or buff the flusher?
- *
- * In order to permit views to be nested within
- * other views, we need to flush the content back out whenever
- * we are beyond the first level of output buffering so that
- * it can be seen and included properly by the first included
- * template and any subsequent ones. Oy!
- */
-
- if (ob_get_level() > $this->_ci_ob_level + 1)
- {
- ob_end_flush();
- }
- else
- {
- $_ci_CI->output->append_output(ob_get_contents());
- @ob_end_clean();
- }
- return $this;
- }
+
+ public function __construct()
+ {
+ parent::__construct();
+ log_message('debug', 'MY_Loader Class Initialized');
+ }
+
+ public function view($view, $vars = array(), $return = false)
+ {
+
+ //theme name
+ $theme = config_item('theme');
+
+ //view path
+ $view_path = 'themes/' . $theme . '/views/' . $view . '.php';
+
+ //fallback to default view if view in theme not found
+
+ if (!file_exists($view_path)) {
+ $view_path = 'themes/default/views/' . $view . '.php';
+ }
+
+ //return
+ return $this->_ci_load(array(
+ '_ci_view' => $view_path,
+ '_ci_vars' => $this->_ci_prepare_view_vars($vars),
+ '_ci_return' => $return,
+ ));
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Internal CI Data Loader
+ *
+ * Used to load views and files.
+ *
+ * Variables are prefixed with _ci_ to avoid symbol collision with
+ * variables made available to view files.
+ *
+ * @used-by CI_Loader::view()
+ * @used-by CI_Loader::file()
+ * @param array $_ci_data Data to load
+ * @return object
+ */
+ protected function _ci_load($_ci_data)
+ {
+
+ // Set the default data variables
+ foreach (array(
+ '_ci_view',
+ '_ci_vars',
+ '_ci_path',
+ '_ci_return',
+ ) as $_ci_val) {
+ $$_ci_val = isset($_ci_data[$_ci_val]) ? $_ci_data[$_ci_val] : false;
+ }
+ $file_exists = false;
+
+ // Set the path to the requested file
+
+ if (is_string($_ci_path) && $_ci_path !== '') {
+ $_ci_x = explode('/', $_ci_path);
+ $_ci_file = end($_ci_x);
+ } else {
+ $_ci_ext = pathinfo($_ci_view, PATHINFO_EXTENSION);
+ $_ci_file = ($_ci_ext === '') ? $_ci_view . '.php' : $_ci_view;
+ foreach ($this->_ci_view_paths as $_ci_view_file => $cascade) {
+
+ /* *** modification for stikked themes ***
+ *
+ * we are by default in the htdocs/application/views folder, which is bad.
+ * for security reasons, themes folder should be outside the application dir.
+ * but file_exists() doesn't work with ../../ in filenames :-(
+ * so, applying the full FrontControllerPATH here, making ../../ superfluous.
+ *
+ */
+
+ if (file_exists(FCPATH . $_ci_file)) {
+ $_ci_path = FCPATH . $_ci_file;
+ $file_exists = true;
+ break;
+ }
+
+ if (!$cascade) {
+ break;
+ }
+ }
+ }
+
+ if (!$file_exists && !file_exists($_ci_path)) {
+ show_error('Unable to load the requested file: ' . $_ci_file);
+ }
+
+ // This allows anything loaded using $this->load (views, files, etc.)
+ // to become accessible from within the Controller and Model functions.
+
+ $_ci_CI = &get_instance();
+ foreach (get_object_vars($_ci_CI) as $_ci_key => $_ci_var) {
+
+ if (!isset($this->$_ci_key)) {
+ $this->$_ci_key = &$_ci_CI->$_ci_key;
+ }
+ }
+
+ /*
+ * Extract and cache variables
+ *
+ * You can either set variables using the dedicated $this->load->vars()
+ * function or via the second parameter of this function. We'll merge
+ * the two types and cache them so that views that are embedded within
+ * other views can have access to these variables.
+ */
+
+ if (is_array($_ci_vars)) {
+ $this->_ci_cached_vars = array_merge($this->_ci_cached_vars, $_ci_vars);
+ }
+ extract($this->_ci_cached_vars);
+
+ /*
+ * Buffer the output
+ *
+ * We buffer the output for two reasons:
+ * 1. Speed. You get a significant speed boost.
+ * 2. So that the final rendered template can be post-processed by
+ * the output class. Why do we need post processing? For one thing,
+ * in order to show the elapsed page load time. Unless we can
+ * intercept the content right before it's sent to the browser and
+ * then stop the timer it won't be accurate.
+ */
+ ob_start();
+
+ // If the PHP installation does not support short tags we'll
+ // do a little string replacement, changing the short tags
+
+ // to standard PHP echo statements.
+
+ if (!is_php('5.4') && !ini_get('short_open_tag') && config_item('rewrite_short_tags') === true) {
+ echo eval('?>' . preg_replace('/;*\s*\?>/', '; ?>', str_replace('<?=', '<?php echo ', file_get_contents($_ci_path))));
+ } else {
+ include $_ci_path; // include() vs include_once() allows for multiple views with the same name
+
+ }
+ log_message('info', 'File loaded: ' . $_ci_path);
+
+ // Return the file data if requested
+
+ if ($_ci_return === true) {
+ $buffer = ob_get_contents();
+ @ob_end_clean();
+ return $buffer;
+ }
+
+ /*
+ * Flush the buffer... or buff the flusher?
+ *
+ * In order to permit views to be nested within
+ * other views, we need to flush the content back out whenever
+ * we are beyond the first level of output buffering so that
+ * it can be seen and included properly by the first included
+ * template and any subsequent ones. Oy!
+ */
+
+ if (ob_get_level() > $this->_ci_ob_level + 1) {
+ ob_end_flush();
+ } else {
+ $_ci_CI->output->append_output(ob_get_contents());
+ @ob_end_clean();
+ }
+ return $this;
+ }
}
diff --git a/htdocs/application/helpers/captcha_helper.php b/htdocs/application/helpers/captcha_helper.php
index 770b6a5..9bcb132 100644
--- a/htdocs/application/helpers/captcha_helper.php
+++ b/htdocs/application/helpers/captcha_helper.php
@@ -1,25 +1,18 @@
-<?php
-/**
- * Class and Function List:
- * Function list:
- * - create_captcha()
- * - display_captcha()
- * - b()
- * Classes list:
- */
+<?php if (!defined('BASEPATH')) {
+ exit('No direct script access allowed');
+}
-if (!defined('BASEPATH')) exit('No direct script access allowed');
/**
* CodeIgniter
*
* An open source application development framework for PHP 5.1.6 or newer
*
- * @package CodeIgniter
- * @author ExpressionEngine Dev Team
- * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc.
- * @license http://codeigniter.com/user_guide/license.html
- * @link http://codeigniter.com
- * @since Version 1.0
+ * @package CodeIgniter
+ * @author ExpressionEngine Dev Team
+ * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc.
+ * @license http://codeigniter.com/user_guide/license.html
+ * @link http://codeigniter.com
+ * @since Version 1.0
* @filesource
*/
@@ -28,11 +21,11 @@ if (!defined('BASEPATH')) exit('No direct script access allowed');
/**
* CodeIgniter CAPTCHA Helper
*
- * @package CodeIgniter
- * @subpackage Helpers
- * @category Helpers
- * @author ExpressionEngine Dev Team
- * @link http://codeigniter.com/user_guide/helpers/xml_helper.html
+ * @package CodeIgniter
+ * @subpackage Helpers
+ * @category Helpers
+ * @author ExpressionEngine Dev Team
+ * @link http://codeigniter.com/user_guide/helpers/xml_helper.html
*/
// ------------------------------------------------------------------------
@@ -40,432 +33,380 @@ if (!defined('BASEPATH')) exit('No direct script access allowed');
/**
* Create CAPTCHA
*
- * @access public
- * @param array array of data for the CAPTCHA
- * @param string path to create the image in
- * @param string URL to the CAPTCHA image folder
- * @param string server path to font
- * @return string
+ * @access public
+ * @param array array of data for the CAPTCHA
+ * @param string path to create the image in
+ * @param string URL to the CAPTCHA image folder
+ * @param string server path to font
+ * @return string
*/
-if (!function_exists('create_captcha'))
-{
-
- function create_captcha($data = '', $img_path = '', $img_url = '', $font_path = '')
- {
- $defaults = array(
- 'word' => '',
- 'img_path' => '',
- 'img_url' => '',
- 'img_width' => '150',
- 'img_height' => '30',
- 'font_path' => '',
- 'expiration' => 7200
- );
- foreach ($defaults as $key => $val)
- {
-
- if (!is_array($data))
- {
-
- if (!isset($$key) OR $$key == '')
- {
- $$key = $val;
- }
- }
- else
- {
- $$key = (!isset($data[$key])) ? $val : $data[$key];
- }
- }
-
- if ($img_path == '' OR $img_url == '')
- {
- return FALSE;
- }
-
- if (!@is_dir($img_path))
- {
- return FALSE;
- }
-
- if (!is_writable($img_path))
- {
- return FALSE;
- }
-
- if (!extension_loaded('gd'))
- {
- return FALSE;
- }
-
- // -----------------------------------
- // Remove old images
-
- // -----------------------------------
-
- list($usec, $sec) = explode(" ", microtime());
- $now = ((float)$usec + (float)$sec);
- $current_dir = @opendir($img_path);
- while ($filename = @readdir($current_dir))
- {
-
- if ($filename != "." and $filename != ".." and $filename != "index.html")
- {
- $name = str_replace(".jpg", "", $filename);
-
- if (($name + $expiration) < $now)
- {
- @unlink($img_path . $filename);
- }
- }
- }
- @closedir($current_dir);
-
- // -----------------------------------
- // Do we have a "word" yet?
-
- // -----------------------------------
-
-
- if ($word == '')
- {
- $pool = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
- $str = '';
- for ($i = 0;$i < 8;$i++)
- {
- $str.= substr($pool, mt_rand(0, strlen($pool) - 1) , 1);
- }
- $word = $str;
- }
-
- // -----------------------------------
- // Determine angle and position
-
- // -----------------------------------
-
- $length = strlen($word);
- $angle = ($length >= 6) ? rand(-($length - 6) , ($length - 6)) : 0;
- $x_axis = rand(6, (360 / $length) - 16);
- $y_axis = ($angle >= 0) ? rand($img_height, $img_width) : rand(6, $img_height);
-
- // -----------------------------------
- // Create image
-
- // -----------------------------------
-
- // PHP.net recommends imagecreatetruecolor(), but it isn't always available
-
-
- if (function_exists('imagecreatetruecolor'))
- {
- $im = imagecreatetruecolor($img_width, $img_height);
- }
- else
- {
- $im = imagecreate($img_width, $img_height);
- }
-
- // -----------------------------------
- // Assign colors
-
- // -----------------------------------
-
- $bg_color = imagecolorallocate($im, 255, 255, 255);
- $border_color = imagecolorallocate($im, 153, 102, 102);
- $text_color = imagecolorallocate($im, 204, 153, 153);
- $grid_color = imagecolorallocate($im, 255, 182, 182);
- $shadow_color = imagecolorallocate($im, 255, 240, 240);
-
- // -----------------------------------
- // Create the rectangle
-
- // -----------------------------------
-
- ImageFilledRectangle($im, 0, 0, $img_width, $img_height, $bg_color);
-
- // -----------------------------------
- // Create the spiral pattern
-
- // -----------------------------------
-
- $theta = 1;
- $thetac = 7;
- $radius = 16;
- $circles = 20;
- $points = 32;
- for ($i = 0;$i < ($circles * $points) - 1;$i++)
- {
- $theta = $theta + $thetac;
- $rad = $radius * ($i / $points);
- $x = ($rad * cos($theta)) + $x_axis;
- $y = ($rad * sin($theta)) + $y_axis;
- $theta = $theta + $thetac;
- $rad1 = $radius * (($i + 1) / $points);
- $x1 = ($rad1 * cos($theta)) + $x_axis;
- $y1 = ($rad1 * sin($theta)) + $y_axis;
- imageline($im, $x, $y, $x1, $y1, $grid_color);
- $theta = $theta - $thetac;
- }
-
- // -----------------------------------
- // Write the text
-
- // -----------------------------------
-
- $use_font = ($font_path != '' AND file_exists($font_path) AND function_exists('imagettftext')) ? TRUE : FALSE;
-
- if ($use_font == FALSE)
- {
- $font_size = 5;
- $x = rand(0, $img_width / ($length / 3));
- $y = 0;
- }
- else
- {
- $font_size = 16;
- $x = rand(0, $img_width / ($length / 1.5));
- $y = $font_size + 2;
- }
- for ($i = 0;$i < strlen($word);$i++)
- {
-
- if ($use_font == FALSE)
- {
- $y = rand(0, $img_height / 2);
- imagestring($im, $font_size, $x, $y, substr($word, $i, 1) , $text_color);
- $x+= ($font_size * 2);
- }
- else
- {
- $y = rand($img_height / 2, $img_height - 3);
- imagettftext($im, $font_size, $angle, $x, $y, $text_color, $font_path, substr($word, $i, 1));
- $x+= $font_size;
- }
- }
-
- // -----------------------------------
- // Create the border
-
- // -----------------------------------
-
- imagerectangle($im, 0, 0, $img_width - 1, $img_height - 1, $border_color);
-
- // -----------------------------------
- // Generate the image
-
- // -----------------------------------
-
- $img_name = $now . '.jpg';
- ImageJPEG($im, $img_path . $img_name);
- $img = "<img src=\"$img_url$img_name\" width=\"$img_width\" height=\"$img_height\" style=\"border:0;\" alt=\" \" />";
- ImageDestroy($im);
- return array(
- 'word' => $word,
- 'time' => $now,
- 'image' => $img
- );
- }
+if (!function_exists('create_captcha')) {
+
+ function create_captcha($data = '', $img_path = '', $img_url = '', $font_path = '')
+ {
+ $defaults = array(
+ 'word' => '',
+ 'img_path' => '',
+ 'img_url' => '',
+ 'img_width' => '150',
+ 'img_height' => '30',
+ 'font_path' => '',
+ 'expiration' => 7200,
+ );
+ foreach ($defaults as $key => $val) {
+
+ if (!is_array($data)) {
+
+ if (!isset($$key) or $$key == '') {
+ $$key = $val;
+ }
+ } else {
+ $$key = (!isset($data[$key])) ? $val : $data[$key];
+ }
+ }
+
+ if ($img_path == '' or $img_url == '') {
+ return false;
+ }
+
+ if (!@is_dir($img_path)) {
+ return false;
+ }
+
+ if (!is_writable($img_path)) {
+ return false;
+ }
+
+ if (!extension_loaded('gd')) {
+ return false;
+ }
+
+ // -----------------------------------
+ // Remove old images
+
+ // -----------------------------------
+
+ list($usec, $sec) = explode(" ", microtime());
+ $now = ((float) $usec + (float) $sec);
+ $current_dir = @opendir($img_path);
+ while ($filename = @readdir($current_dir)) {
+
+ if ($filename != "." and $filename != ".." and $filename != "index.html") {
+ $name = str_replace(".jpg", "", $filename);
+
+ if (($name + $expiration) < $now) {
+ @unlink($img_path . $filename);
+ }
+ }
+ }
+ @closedir($current_dir);
+
+ // -----------------------------------
+ // Do we have a "word" yet?
+
+ // -----------------------------------
+
+ if ($word == '') {
+ $pool = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
+ $str = '';
+ for ($i = 0; $i < 8; $i++) {
+ $str .= substr($pool, mt_rand(0, strlen($pool) - 1), 1);
+ }
+ $word = $str;
+ }
+
+ // -----------------------------------
+ // Determine angle and position
+
+ // -----------------------------------
+
+ $length = strlen($word);
+ $angle = ($length >= 6) ? rand(-($length - 6), ($length - 6)) : 0;
+ $x_axis = rand(6, (360 / $length) - 16);
+ $y_axis = ($angle >= 0) ? rand($img_height, $img_width) : rand(6, $img_height);
+
+ // -----------------------------------
+ // Create image
+
+ // -----------------------------------
+
+ // PHP.net recommends imagecreatetruecolor(), but it isn't always available
+
+ if (function_exists('imagecreatetruecolor')) {
+ $im = imagecreatetruecolor($img_width, $img_height);
+ } else {
+ $im = imagecreate($img_width, $img_height);
+ }
+
+ // -----------------------------------
+ // Assign colors
+
+ // -----------------------------------
+
+ $bg_color = imagecolorallocate($im, 255, 255, 255);
+ $border_color = imagecolorallocate($im, 153, 102, 102);
+ $text_color = imagecolorallocate($im, 204, 153, 153);
+ $grid_color = imagecolorallocate($im, 255, 182, 182);
+ $shadow_color = imagecolorallocate($im, 255, 240, 240);
+
+ // -----------------------------------
+ // Create the rectangle
+
+ // -----------------------------------
+
+ ImageFilledRectangle($im, 0, 0, $img_width, $img_height, $bg_color);
+
+ // -----------------------------------
+ // Create the spiral pattern
+
+ // -----------------------------------
+
+ $theta = 1;
+ $thetac = 7;
+ $radius = 16;
+ $circles = 20;
+ $points = 32;
+ for ($i = 0; $i < ($circles * $points) - 1; $i++) {
+ $theta = $theta + $thetac;
+ $rad = $radius * ($i / $points);
+ $x = ($rad * cos($theta)) + $x_axis;
+ $y = ($rad * sin($theta)) + $y_axis;
+ $theta = $theta + $thetac;
+ $rad1 = $radius * (($i + 1) / $points);
+ $x1 = ($rad1 * cos($theta)) + $x_axis;
+ $y1 = ($rad1 * sin($theta)) + $y_axis;
+ imageline($im, $x, $y, $x1, $y1, $grid_color);
+ $theta = $theta - $thetac;
+ }
+
+ // -----------------------------------
+ // Write the text
+
+ // -----------------------------------
+
+ $use_font = ($font_path != '' and file_exists($font_path) and function_exists('imagettftext')) ? true : false;
+
+ if ($use_font == false) {
+ $font_size = 5;
+ $x = rand(0, $img_width / ($length / 3));
+ $y = 0;
+ } else {
+ $font_size = 16;
+ $x = rand(0, $img_width / ($length / 1.5));
+ $y = $font_size + 2;
+ }
+ for ($i = 0; $i < strlen($word); $i++) {
+
+ if ($use_font == false) {
+ $y = rand(0, $img_height / 2);
+ imagestring($im, $font_size, $x, $y, substr($word, $i, 1), $text_color);
+ $x += ($font_size * 2);
+ } else {
+ $y = rand($img_height / 2, $img_height - 3);
+ imagettftext($im, $font_size, $angle, $x, $y, $text_color, $font_path, substr($word, $i, 1));
+ $x += $font_size;
+ }
+ }
+
+ // -----------------------------------
+ // Create the border
+
+ // -----------------------------------
+
+ imagerectangle($im, 0, 0, $img_width - 1, $img_height - 1, $border_color);
+
+ // -----------------------------------
+ // Generate the image
+
+ // -----------------------------------
+
+ $img_name = $now . '.jpg';
+ ImageJPEG($im, $img_path . $img_name);
+ $img = "<img src=\"$img_url$img_name\" width=\"$img_width\" height=\"$img_height\" style=\"border:0;\" alt=\" \" />";
+ ImageDestroy($im);
+ return array(
+ 'word' => $word,
+ 'time' => $now,
+ 'image' => $img,
+ );
+ }
}
/**
* Display CAPTCHA
*
- * @access public
- * @return string
+ * @access public
+ * @return string
*/
-if (!function_exists('display_captcha'))
-{
-
- function display_captcha($word = '')
- {
- $data = '';
- list($usec, $sec) = explode(" ", microtime());
- $now = ((float)$usec + (float)$sec);
- $defaults = array(
- 'word' => $word,
- 'img_path' => '',
- 'img_url' => '',
- 'img_width' => '180',
- 'img_height' => '40',
- 'font_path' => '',
- 'expiration' => 7200
- );
- foreach ($defaults as $key => $val)
- {
-
- if (!is_array($data))
- {
-
- if (!isset($$key) OR $$key == '')
- {
- $$key = $val;
- }
- }
- else
- {
- $$key = (!isset($data[$key])) ? $val : $data[$key];
- }
- }
-
- if (!extension_loaded('gd'))
- {
- return FALSE;
- }
-
- // -----------------------------------
- // Do we have a "word" yet?
-
- // -----------------------------------
-
-
- if ($word == '')
- {
- $pool = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
- $str = '';
- for ($i = 0;$i < 4;$i++)
- {
- $str.= substr($pool, mt_rand(0, strlen($pool) - 1) , 1);
- }
- $word = $str;
- }
-
- // -----------------------------------
- // Determine angle and position
-
- // -----------------------------------
-
- $length = strlen($word);
- $angle = ($length >= 6) ? mt_rand(-($length - 6) , ($length - 6)) : 0;
- $angle = 10;
- $x_axis = mt_rand(6, (360 / $length) - 16);
- $y_axis = ($angle >= 0) ? mt_rand($img_height, $img_width) : mt_rand(6, $img_height);
-
- // -----------------------------------
- // Create image
-
- // -----------------------------------
-
- // PHP.net recommends imagecreatetruecolor(), but it isn't always available
-
-
- if (function_exists('imagecreatetruecolor'))
- {
- $im = imagecreatetruecolor($img_width, $img_height);
- }
- else
- {
- $im = imagecreate($img_width, $img_height);
- }
-
- // -----------------------------------
- // Assign colors
-
- // -----------------------------------
-
-
- function b()
- {
- return mt_rand(240, 255);
- }
- $bg_color = imagecolorallocate($im, b() , b() , b());
- $border_color = imagecolorallocate($im, 153, 102, 102);
- $text_color = imagecolorallocate($im, 204, 153, 153);
- $grid_color = imagecolorallocate($im, 255, 182, 182);
- $shadow_color = imagecolorallocate($im, 255, 240, 240);
-
- // -----------------------------------
- // Create the rectangle
-
- // -----------------------------------
-
- ImageFilledRectangle($im, 0, 0, $img_width, $img_height, $bg_color);
-
- // -----------------------------------
- // Create the spiral pattern
-
- // -----------------------------------
-
- $theta = 1;
- $thetac = 7;
- $radius = 16;
- $circles = 20;
- $points = 32;
- for ($i = 0;$i < ($circles * $points) - 1;$i++)
- {
- $theta = $theta + $thetac;
- $rad = $radius * ($i / $points);
- $x = ($rad * cos($theta)) + $x_axis;
- $y = ($rad * sin($theta)) + $y_axis;
- $theta = $theta + $thetac;
- $rad1 = $radius * (($i + 1) / $points);
- $x1 = ($rad1 * cos($theta)) + $x_axis;
- $y1 = ($rad1 * sin($theta)) + $y_axis;
- imageline($im, $x, $y, $x1, $y1, $grid_color);
- $theta = $theta - $thetac;
- }
-
- // -----------------------------------
- // Write the text
-
- // -----------------------------------
-
- //get random font
-
- $fn = explode(',', '4,5,6,8,16,17,19,24,26');
- $f = mt_rand(0, count($fn) - 1);
- $font_path = './static/fonts/font' . $fn[$f] . '.ttf';
- $use_font = ($font_path != '' AND file_exists($font_path) AND function_exists('imagettftext')) ? TRUE : FALSE;
-
- if ($use_font == FALSE)
- {
- $font_size = 5;
- $x = mt_rand(0, $img_width / ($length / 3));
- $y = 0;
- }
- else
- {
- $font_size = 16;
- $x = mt_rand(0, $img_width / ($length / 1.5));
- $y = $font_size + 2;
- }
- for ($i = 0;$i < strlen($word);$i++)
- {
-
- if ($use_font == FALSE)
- {
- $y = mt_rand(0, $img_height / 2);
- imagestring($im, $font_size, $x, $y, substr($word, $i, 1) , $text_color);
- $x+= ($font_size * 2);
- }
- else
- {
- $y = mt_rand($img_height / 2, $img_height - 3);
- imagettftext($im, $font_size, $angle, $x, $y, $text_color, $font_path, substr($word, $i, 1));
- $x+= $font_size;
- }
- }
-
- // -----------------------------------
- // Create the border
-
- // -----------------------------------
-
- imagerectangle($im, 0, 0, $img_width - 1, $img_height - 1, $border_color);
-
- // -----------------------------------
- // Generate the image
-
- // -----------------------------------
-
- $img_name = $now . '.jpg';
- echo ImageJPEG($im);
- ImageDestroy($im);
- }
+if (!function_exists('display_captcha')) {
+
+ function display_captcha($word = '')
+ {
+ $data = '';
+ list($usec, $sec) = explode(" ", microtime());
+ $now = ((float) $usec + (float) $sec);
+ $defaults = array(
+ 'word' => $word,
+ 'img_path' => '',
+ 'img_url' => '',
+ 'img_width' => '180',
+ 'img_height' => '40',
+ 'font_path' => '',
+ 'expiration' => 7200,
+ );
+ foreach ($defaults as $key => $val) {
+
+ if (!is_array($data)) {
+
+ if (!isset($$key) or $$key == '') {
+ $$key = $val;
+ }
+ } else {
+ $$key = (!isset($data[$key])) ? $val : $data[$key];
+ }
+ }
+
+ if (!extension_loaded('gd')) {
+ return false;
+ }
+
+ // -----------------------------------
+ // Do we have a "word" yet?
+
+ // -----------------------------------
+
+ if ($word == '') {
+ $pool = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
+ $str = '';
+ for ($i = 0; $i < 4; $i++) {
+ $str .= substr($pool, mt_rand(0, strlen($pool) - 1), 1);
+ }
+ $word = $str;
+ }
+
+ // -----------------------------------
+ // Determine angle and position
+
+ // -----------------------------------
+
+ $length = strlen($word);
+ $angle = ($length >= 6) ? mt_rand(-($length - 6), ($length - 6)) : 0;
+ $angle = 10;
+ $x_axis = mt_rand(6, (360 / $length) - 16);
+ $y_axis = ($angle >= 0) ? mt_rand($img_height, $img_width) : mt_rand(6, $img_height);
+
+ // -----------------------------------
+ // Create image
+
+ // -----------------------------------
+
+ // PHP.net recommends imagecreatetruecolor(), but it isn't always available
+
+ if (function_exists('imagecreatetruecolor')) {
+ $im = imagecreatetruecolor($img_width, $img_height);
+ } else {
+ $im = imagecreate($img_width, $img_height);
+ }
+
+ // -----------------------------------
+ // Assign colors
+
+ // -----------------------------------
+
+ function b()
+ {
+ return mt_rand(240, 255);
+ }
+ $bg_color = imagecolorallocate($im, b(), b(), b());
+ $border_color = imagecolorallocate($im, 153, 102, 102);
+ $text_color = imagecolorallocate($im, 204, 153, 153);
+ $grid_color = imagecolorallocate($im, 255, 182, 182);
+ $shadow_color = imagecolorallocate($im, 255, 240, 240);
+
+ // -----------------------------------
+ // Create the rectangle
+
+ // -----------------------------------
+
+ ImageFilledRectangle($im, 0, 0, $img_width, $img_height, $bg_color);
+
+ // -----------------------------------
+ // Create the spiral pattern
+
+ // -----------------------------------
+
+ $theta = 1;
+ $thetac = 7;
+ $radius = 16;
+ $circles = 20;
+ $points = 32;
+ for ($i = 0; $i < ($circles * $points) - 1; $i++) {
+ $theta = $theta + $thetac;
+ $rad = $radius * ($i / $points);
+ $x = ($rad * cos($theta)) + $x_axis;
+ $y = ($rad * sin($theta)) + $y_axis;
+ $theta = $theta + $thetac;
+ $rad1 = $radius * (($i + 1) / $points);
+ $x1 = ($rad1 * cos($theta)) + $x_axis;
+ $y1 = ($rad1 * sin($theta)) + $y_axis;
+ imageline($im, $x, $y, $x1, $y1, $grid_color);
+ $theta = $theta - $thetac;
+ }
+
+ // -----------------------------------
+ // Write the text
+
+ // -----------------------------------
+
+ //get random font
+
+ $fn = explode(',', '4,5,6,8,16,17,19,24,26');
+ $f = mt_rand(0, count($fn) - 1);
+ $font_path = './static/fonts/font' . $fn[$f] . '.ttf';
+ $use_font = ($font_path != '' and file_exists($font_path) and function_exists('imagettftext')) ? true : false;
+
+ if ($use_font == false) {
+ $font_size = 5;
+ $x = mt_rand(0, $img_width / ($length / 3));
+ $y = 0;
+ } else {
+ $font_size = 16;
+ $x = mt_rand(0, $img_width / ($length / 1.5));
+ $y = $font_size + 2;
+ }
+ for ($i = 0; $i < strlen($word); $i++) {
+
+ if ($use_font == false) {
+ $y = mt_rand(0, $img_height / 2);
+ imagestring($im, $font_size, $x, $y, substr($word, $i, 1), $text_color);
+ $x += ($font_size * 2);
+ } else {
+ $y = mt_rand($img_height / 2, $img_height - 3);
+ imagettftext($im, $font_size, $angle, $x, $y, $text_color, $font_path, substr($word, $i, 1));
+ $x += $font_size;
+ }
+ }
+
+ // -----------------------------------
+ // Create the border
+
+ // -----------------------------------
+
+ imagerectangle($im, 0, 0, $img_width - 1, $img_height - 1, $border_color);
+
+ // -----------------------------------
+ // Generate the image
+
+ // -----------------------------------
+
+ $img_name = $now . '.jpg';
+ echo ImageJPEG($im);
+ ImageDestroy($im);
+ }
}
// ------------------------------------------------------------------------
/* End of file captcha_helper.php */
-
/* Location: ./system/heleprs/captcha_helper.php */
diff --git a/htdocs/application/helpers/json_helper.php b/htdocs/application/helpers/json_helper.php
index 8fe3c02..7adfe03 100644
--- a/htdocs/application/helpers/json_helper.php
+++ b/htdocs/application/helpers/json_helper.php
@@ -1,58 +1,46 @@
-<?php
-/**
- * Class and Function List:
- * Function list:
- * - json_encode()
- * Classes list:
- */
+<?php if (!defined('BASEPATH')) {
+ exit('No direct script access allowed');
+}
+
//If you are on a version of PHP before 5.2, this might help:
+if (!function_exists('json_encode')) {
+
+ function json_encode($data)
+ {
+ switch ($type = gettype($data)) {
+ case 'NULL':
+ return 'null';
+ case 'boolean':
+ return ($data ? 'true' : 'false');
+ case 'integer':
+ case 'double':
+ case 'float':
+ return $data;
+ case 'string':
+ return '"' . addslashes($data) . '"';
+ case 'object':
+ $data = get_object_vars($data);
+ case 'array':
+ $output_index_count = 0;
+ $output_indexed = array();
+ $output_associative = array();
+ foreach ($data as $key => $value) {
+ $output_indexed[] = json_encode($value);
+ $output_associative[] = json_encode($key) . ':' . json_encode($value);
+
+ if ($output_index_count !== null && $output_index_count++ !== $key) {
+ $output_index_count = null;
+ }
+ }
-if (!function_exists('json_encode'))
-{
-
- function json_encode($data)
- {
- switch ($type = gettype($data))
- {
- case 'NULL':
- return 'null';
- case 'boolean':
- return ($data ? 'true' : 'false');
- case 'integer':
- case 'double':
- case 'float':
- return $data;
- case 'string':
- return '"' . addslashes($data) . '"';
- case 'object':
- $data = get_object_vars($data);
- case 'array':
- $output_index_count = 0;
- $output_indexed = array();
- $output_associative = array();
- foreach ($data as $key => $value)
- {
- $output_indexed[] = json_encode($value);
- $output_associative[] = json_encode($key) . ':' . json_encode($value);
-
- if ($output_index_count !== NULL && $output_index_count++ !== $key)
- {
- $output_index_count = NULL;
- }
- }
-
- if ($output_index_count !== NULL)
- {
- return '[' . implode(',', $output_indexed) . ']';
- }
- else
- {
- return '{' . implode(',', $output_associative) . '}';
- }
- default:
- return ''; // Not supported
+ if ($output_index_count !== null) {
+ return '[' . implode(',', $output_indexed) . ']';
+ } else {
+ return '{' . implode(',', $output_associative) . '}';
+ }
+ default:
+ return ''; // Not supported
-
- }
- }
+ }
+ }
}
diff --git a/htdocs/application/helpers/language_helper.php b/htdocs/application/helpers/language_helper.php
index 1439520..14c0220 100644
--- a/htdocs/application/helpers/language_helper.php
+++ b/htdocs/application/helpers/language_helper.php
@@ -1,24 +1,18 @@
-<?php
-/**
- * Class and Function List:
- * Function list:
- * - lang()
- * - random_expire_msg()
- * Classes list:
- */
+<?php if (!defined('BASEPATH')) {
+ exit('No direct script access allowed');
+}
-if (!defined('BASEPATH')) exit('No direct script access allowed');
/**
* CodeIgniter
*
* An open source application development framework for PHP 5.1.6 or newer
*
- * @package CodeIgniter
- * @author ExpressionEngine Dev Team
- * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc.
- * @license http://codeigniter.com/user_guide/license.html
- * @link http://codeigniter.com
- * @since Version 1.0
+ * @package CodeIgniter
+ * @author ExpressionEngine Dev Team
+ * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc.
+ * @license http://codeigniter.com/user_guide/license.html
+ * @link http://codeigniter.com
+ * @since Version 1.0
* @filesource
*/
@@ -27,11 +21,11 @@ if (!defined('BASEPATH')) exit('No direct script access allowed');
/**
* CodeIgniter Language Helpers
*
- * @package CodeIgniter
- * @subpackage Helpers
- * @category Helpers
- * @author ExpressionEngine Dev Team
- * @link http://codeigniter.com/user_guide/helpers/language_helper.html
+ * @package CodeIgniter
+ * @subpackage Helpers
+ * @category Helpers
+ * @author ExpressionEngine Dev Team
+ * @link http://codeigniter.com/user_guide/helpers/language_helper.html
*/
// ------------------------------------------------------------------------
@@ -41,49 +35,45 @@ if (!defined('BASEPATH')) exit('No direct script access allowed');
*
* Fetches a language variable and optionally outputs a form label
*
- * @access public
- * @param string the language line
- * @param string the id of the form element
- * @return string
+ * @access public
+ * @param string the language line
+ * @param string the id of the form element
+ * @return string
*/
-if (!function_exists('lang'))
-{
-
- function lang($index, $id = '')
- {
- $CI = & get_instance();
- $line = $CI->lang->line($index);
-
- if ($id != '')
- {
- $line = '<label for="' . $id . '">' . $line . "</label>";
- }
- return ($line != '' ? $line : '[' . $index . ']');
- }
+if (!function_exists('lang')) {
+
+ function lang($index, $id = '')
+ {
+ $CI = &get_instance();
+ $line = $CI->lang->line($index);
+
+ if ($id != '') {
+ $line = '<label for="' . $id . '">' . $line . "</label>";
+ }
+ return ($line != '' ? $line : '[' . $index . ']');
+ }
}
/**
* Random expire msg
*
* Displays a random expire message
*
- * @access public
- * @return string
+ * @access public
+ * @return string
*/
-if (!function_exists('random_expire_msg'))
-{
-
- function random_expire_msg()
- {
- $CI = & get_instance();
- $expires = $CI->config->item('expires');
- return $expires[rand(0, sizeof($expires) - 1) ];
- }
+if (!function_exists('random_expire_msg')) {
+
+ function random_expire_msg()
+ {
+ $CI = &get_instance();
+ $expires = $CI->config->item('expires');
+ return $expires[rand(0, sizeof($expires) - 1)];
+ }
}
// ------------------------------------------------------------------------
/* End of file language_helper.php */
-
/* Location: ./system/helpers/language_helper.php */
diff --git a/htdocs/application/helpers/recaptcha_helper.php b/htdocs/application/helpers/recaptcha_helper.php
index 7067ab7..3bf9c3e 100644
--- a/htdocs/application/helpers/recaptcha_helper.php
+++ b/htdocs/application/helpers/recaptcha_helper.php
@@ -44,18 +44,18 @@ define("RECAPTCHA_VERIFY_SERVER", "www.google.com");
* @param $data - array of string elements to be encoded
* @return string - encoded request
*/
-function _recaptcha_qsencode ($data) {
- $req = "";
- foreach ( $data as $key => $value )
- $req .= $key . '=' . urlencode( stripslashes($value) ) . '&';
-
- // Cut the last '&'
- $req=substr($req,0,strlen($req)-1);
- return $req;
+function _recaptcha_qsencode($data)
+{
+ $req = "";
+ foreach ($data as $key => $value) {
+ $req .= $key . '=' . urlencode(stripslashes($value)) . '&';
+ }
+
+ // Cut the last '&'
+ $req = substr($req, 0, strlen($req) - 1);
+ return $req;
}
-
-
/**
* Submits an HTTP POST to a reCAPTCHA server
* @param string $host
@@ -64,35 +64,36 @@ function _recaptcha_qsencode ($data) {
* @param int port
* @return array response
*/
-function _recaptcha_http_post($host, $path, $data, $port = 80) {
+function _recaptcha_http_post($host, $path, $data, $port = 80)
+{
- $req = _recaptcha_qsencode ($data);
+ $req = _recaptcha_qsencode($data);
- $http_request = "POST $path HTTP/1.0\r\n";
- $http_request .= "Host: $host\r\n";
- $http_request .= "Content-Type: application/x-www-form-urlencoded;\r\n";
- $http_request .= "Content-Length: " . strlen($req) . "\r\n";
- $http_request .= "User-Agent: reCAPTCHA/PHP\r\n";
- $http_request .= "\r\n";
- $http_request .= $req;
+ $http_request = "POST $path HTTP/1.0\r\n";
+ $http_request .= "Host: $host\r\n";
+ $http_request .= "Content-Type: application/x-www-form-urlencoded;\r\n";
+ $http_request .= "Content-Length: " . strlen($req) . "\r\n";
+ $http_request .= "User-Agent: reCAPTCHA/PHP\r\n";
+ $http_request .= "\r\n";
+ $http_request .= $req;
- $response = '';
- if( false == ( $fs = @fsockopen($host, $port, $errno, $errstr, 10) ) ) {
- die ('Could not open socket');
- }
+ $response = '';
+ if (false == ($fs = @fsockopen($host, $port, $errno, $errstr, 10))) {
+ die('Could not open socket');
+ }
- fwrite($fs, $http_request);
+ fwrite($fs, $http_request);
- while ( !feof($fs) )
- $response .= fgets($fs, 1160); // One TCP-IP packet
- fclose($fs);
- $response = explode("\r\n\r\n", $response, 2);
+ while (!feof($fs)) {
+ $response .= fgets($fs, 1160);
+ }
+ // One TCP-IP packet
+ fclose($fs);
+ $response = explode("\r\n\r\n", $response, 2);
- return $response;
+ return $response;
}
-
-
/**
* Gets the challenge HTML (javascript and non-javascript version).
* This is called from the browser, and the resulting reCAPTCHA HTML widget
@@ -103,96 +104,89 @@ function _recaptcha_http_post($host, $path, $data, $port = 80) {
* @return string - The HTML to be embedded in the user's form.
*/
-function recaptcha_get_html ($pubkey, $error = null, $use_ssl = false)
+function recaptcha_get_html($pubkey, $error = null, $use_ssl = false)
{
- if ($pubkey == null || $pubkey == '') {
- die ("To use reCAPTCHA you must get an API key from <a href='https://www.google.com/recaptcha/admin/create'>https://www.google.com/recaptcha/admin/create</a>");
- }
-
- if ($use_ssl) {
- $server = RECAPTCHA_API_SECURE_SERVER;
- } else {
- $server = RECAPTCHA_API_SERVER;
- }
-
- $errorpart = "";
- if ($error) {
- $errorpart = "&amp;error=" . $error;
- }
- return '<script src=\'https://www.google.com/recaptcha/api.js\'></script>
+ if ($pubkey == null || $pubkey == '') {
+ die("To use reCAPTCHA you must get an API key from <a href='https://www.google.com/recaptcha/admin/create'>https://www.google.com/recaptcha/admin/create</a>");
+ }
+
+ if ($use_ssl) {
+ $server = RECAPTCHA_API_SECURE_SERVER;
+ } else {
+ $server = RECAPTCHA_API_SERVER;
+ }
+
+ $errorpart = "";
+ if ($error) {
+ $errorpart = "&amp;error=" . $error;
+ }
+ return '<script src=\'https://www.google.com/recaptcha/api.js\'></script>
<div class="g-recaptcha" data-sitekey="' . $pubkey . '"></div>';
+ /*return '<script type="text/javascript" src="'. $server . '/challenge?k=' . $pubkey . $errorpart . '"></script>
- /*return '<script type="text/javascript" src="'. $server . '/challenge?k=' . $pubkey . $errorpart . '"></script>
-
- <noscript>
- <iframe src="'. $server . '/noscript?k=' . $pubkey . $errorpart . '" height="300" width="500" frameborder="0"></iframe><br/>
- <textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea>
- <input type="hidden" name="recaptcha_response_field" value="manual_challenge"/>
- </noscript>';*/
+<noscript>
+<iframe src="'. $server . '/noscript?k=' . $pubkey . $errorpart . '" height="300" width="500" frameborder="0"></iframe><br/>
+<textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea>
+<input type="hidden" name="recaptcha_response_field" value="manual_challenge"/>
+</noscript>';*/
}
-
-
-
/**
* A ReCaptchaResponse is returned from recaptcha_check_answer()
*/
-class ReCaptchaResponse {
- var $is_valid;
- var $error;
+class ReCaptchaResponse
+{
+ public $is_valid;
+ public $error;
}
-
/**
- * Calls an HTTP POST function to verify if the user's guess was correct
- * @param string $privkey
- * @param string $remoteip
- * @param string $challenge
- * @param string $response
- * @param array $extra_params an array of extra variables to post to the server
- * @return ReCaptchaResponse
- */
-function recaptcha_check_answer ($privkey, $remoteip, $challenge, $response, $extra_params = array())
+ * Calls an HTTP POST function to verify if the user's guess was correct
+ * @param string $privkey
+ * @param string $remoteip
+ * @param string $challenge
+ * @param string $response
+ * @param array $extra_params an array of extra variables to post to the server
+ * @return ReCaptchaResponse
+ */
+function recaptcha_check_answer($privkey, $remoteip, $challenge, $response, $extra_params = array())
{
- if ($privkey == null || $privkey == '') {
- die ("To use reCAPTCHA you must get an API key from <a href='https://www.google.com/recaptcha/admin/create'>https://www.google.com/recaptcha/admin/create</a>");
- }
-
- if ($remoteip == null || $remoteip == '') {
- die ("For security reasons, you must pass the remote ip to reCAPTCHA");
- }
-
-
-
- //discard spam submissions
- if ($challenge == null || strlen($challenge) == 0 || $response == null || strlen($response) == 0) {
- $recaptcha_response = new ReCaptchaResponse();
- $recaptcha_response->is_valid = false;
- $recaptcha_response->error = 'incorrect-captcha-sol';
- return $recaptcha_response;
- }
-
- $response = _recaptcha_http_post (RECAPTCHA_VERIFY_SERVER, "/recaptcha/api/verify",
- array (
- 'privatekey' => $privkey,
- 'remoteip' => $remoteip,
- 'challenge' => $challenge,
- 'response' => $response
- ) + $extra_params
- );
-
- $answers = explode ("\n", $response [1]);
- $recaptcha_response = new ReCaptchaResponse();
+ if ($privkey == null || $privkey == '') {
+ die("To use reCAPTCHA you must get an API key from <a href='https://www.google.com/recaptcha/admin/create'>https://www.google.com/recaptcha/admin/create</a>");
+ }
+
+ if ($remoteip == null || $remoteip == '') {
+ die("For security reasons, you must pass the remote ip to reCAPTCHA");
+ }
- if (trim ($answers [0]) == 'true') {
- $recaptcha_response->is_valid = true;
- }
- else {
- $recaptcha_response->is_valid = false;
- $recaptcha_response->error = $answers [1];
- }
+ //discard spam submissions
+ if ($challenge == null || strlen($challenge) == 0 || $response == null || strlen($response) == 0) {
+ $recaptcha_response = new ReCaptchaResponse();
+ $recaptcha_response->is_valid = false;
+ $recaptcha_response->error = 'incorrect-captcha-sol';
return $recaptcha_response;
+ }
+
+ $response = _recaptcha_http_post(RECAPTCHA_VERIFY_SERVER, "/recaptcha/api/verify",
+ array(
+ 'privatekey' => $privkey,
+ 'remoteip' => $remoteip,
+ 'challenge' => $challenge,
+ 'response' => $response,
+ ) + $extra_params
+ );
+
+ $answers = explode("\n", $response[1]);
+ $recaptcha_response = new ReCaptchaResponse();
+
+ if (trim($answers[0]) == 'true') {
+ $recaptcha_response->is_valid = true;
+ } else {
+ $recaptcha_response->is_valid = false;
+ $recaptcha_response->error = $answers[1];
+ }
+ return $recaptcha_response;
}
@@ -203,45 +197,48 @@ function recaptcha_check_answer ($privkey, $remoteip, $challenge, $response, $ex
* @param string $domain The domain where the page is hosted
* @param string $appname The name of your application
*/
-function recaptcha_get_signup_url ($domain = null, $appname = null) {
- return "https://www.google.com/recaptcha/admin/create?" . _recaptcha_qsencode (array ('domains' => $domain, 'app' => $appname));
+function recaptcha_get_signup_url($domain = null, $appname = null)
+{
+ return "https://www.google.com/recaptcha/admin/create?" . _recaptcha_qsencode(array('domains' => $domain, 'app' => $appname));
}
-function _recaptcha_aes_pad($val) {
- $block_size = 16;
- $numpad = $block_size - (strlen ($val) % $block_size);
- return str_pad($val, strlen ($val) + $numpad, chr($numpad));
+function _recaptcha_aes_pad($val)
+{
+ $block_size = 16;
+ $numpad = $block_size - (strlen($val) % $block_size);
+ return str_pad($val, strlen($val) + $numpad, chr($numpad));
}
/* Mailhide related code */
-function _recaptcha_aes_encrypt($val,$ky) {
- if (! function_exists ("mcrypt_encrypt")) {
- die ("To use reCAPTCHA Mailhide, you need to have the mcrypt php module installed.");
- }
- $mode=MCRYPT_MODE_CBC;
- $enc=MCRYPT_RIJNDAEL_128;
- $val=_recaptcha_aes_pad($val);
- return mcrypt_encrypt($enc, $ky, $val, $mode, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0");
+function _recaptcha_aes_encrypt($val, $ky)
+{
+ if (!function_exists("mcrypt_encrypt")) {
+ die("To use reCAPTCHA Mailhide, you need to have the mcrypt php module installed.");
+ }
+ $mode = MCRYPT_MODE_CBC;
+ $enc = MCRYPT_RIJNDAEL_128;
+ $val = _recaptcha_aes_pad($val);
+ return mcrypt_encrypt($enc, $ky, $val, $mode, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0");
}
-
-function _recaptcha_mailhide_urlbase64 ($x) {
- return strtr(base64_encode ($x), '+/', '-_');
+function _recaptcha_mailhide_urlbase64($x)
+{
+ return strtr(base64_encode($x), '+/', '-_');
}
/* gets the reCAPTCHA Mailhide url for a given email, public key and private key */
-function recaptcha_mailhide_url($pubkey, $privkey, $email) {
- if ($pubkey == '' || $pubkey == null || $privkey == "" || $privkey == null) {
- die ("To use reCAPTCHA Mailhide, you have to sign up for a public and private key, " .
- "you can do so at <a href='http://www.google.com/recaptcha/mailhide/apikey'>http://www.google.com/recaptcha/mailhide/apikey</a>");
- }
-
-
- $ky = pack('H*', $privkey);
- $cryptmail = _recaptcha_aes_encrypt ($email, $ky);
-
- return "https://www.google.com/recaptcha/mailhide/d?k=" . $pubkey . "&c=" . _recaptcha_mailhide_urlbase64 ($cryptmail);
+function recaptcha_mailhide_url($pubkey, $privkey, $email)
+{
+ if ($pubkey == '' || $pubkey == null || $privkey == "" || $privkey == null) {
+ die("To use reCAPTCHA Mailhide, you have to sign up for a public and private key, " .
+ "you can do so at <a href='http://www.google.com/recaptcha/mailhide/apikey'>http://www.google.com/recaptcha/mailhide/apikey</a>");
+ }
+
+ $ky = pack('H*', $privkey);
+ $cryptmail = _recaptcha_aes_encrypt($email, $ky);
+
+ return "https://www.google.com/recaptcha/mailhide/d?k=" . $pubkey . "&c=" . _recaptcha_mailhide_urlbase64($cryptmail);
}
/**
@@ -249,17 +246,18 @@ function recaptcha_mailhide_url($pubkey, $privkey, $email) {
* eg, given johndoe@example,com return ["john", "example.com"].
* the email is then displayed as john...@example.com
*/
-function _recaptcha_mailhide_email_parts ($email) {
- $arr = preg_split("/@/", $email );
-
- if (strlen ($arr[0]) <= 4) {
- $arr[0] = substr ($arr[0], 0, 1);
- } else if (strlen ($arr[0]) <= 6) {
- $arr[0] = substr ($arr[0], 0, 3);
- } else {
- $arr[0] = substr ($arr[0], 0, 4);
- }
- return $arr;
+function _recaptcha_mailhide_email_parts($email)
+{
+ $arr = preg_split("/@/", $email);
+
+ if (strlen($arr[0]) <= 4) {
+ $arr[0] = substr($arr[0], 0, 1);
+ } else if (strlen($arr[0]) <= 6) {
+ $arr[0] = substr($arr[0], 0, 3);
+ } else {
+ $arr[0] = substr($arr[0], 0, 4);
+ }
+ return $arr;
}
/**
@@ -268,14 +266,12 @@ function _recaptcha_mailhide_email_parts ($email) {
*
* http://www.google.com/recaptcha/mailhide/apikey
*/
-function recaptcha_mailhide_html($pubkey, $privkey, $email) {
- $emailparts = _recaptcha_mailhide_email_parts ($email);
- $url = recaptcha_mailhide_url ($pubkey, $privkey, $email);
-
- return htmlentities($emailparts[0]) . "<a href='" . htmlentities ($url) .
- "' onclick=\"window.open('" . htmlentities ($url) . "', '', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=300'); return false;\" title=\"Reveal this e-mail address\">...</a>@" . htmlentities ($emailparts [1]);
-
-}
+function recaptcha_mailhide_html($pubkey, $privkey, $email)
+{
+ $emailparts = _recaptcha_mailhide_email_parts($email);
+ $url = recaptcha_mailhide_url($pubkey, $privkey, $email);
+ return htmlentities($emailparts[0]) . "<a href='" . htmlentities($url) .
+ "' onclick=\"window.open('" . htmlentities($url) . "', '', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=300'); return false;\" title=\"Reveal this e-mail address\">...</a>@" . htmlentities($emailparts[1]);
-?>
+}
diff --git a/htdocs/application/models/Languages.php b/htdocs/application/models/Languages.php
index dfc7fb9..2ceaff9 100644
--- a/htdocs/application/models/Languages.php
+++ b/htdocs/application/models/Languages.php
@@ -1,62 +1,49 @@
-<?php
-/**
- * Class and Function List:
- * Function list:
- * - __construct()
- * - valid_language()
- * - get_languages()
- * - code_to_description()
- * Classes list:
- * - Languages extends CI_Model
- */
+<?php if (!defined('BASEPATH')) {
+ exit('No direct script access allowed');
+}
class Languages extends CI_Model
{
-
- function __construct()
- {
- parent::__construct();
- $this->load->config('geshi_languages');
- $this->geshi_languages = $this->config->item('geshi_languages');
- $this->favorite_languages = $this->config->item('favorite_languages');
-
- if ($this->favorite_languages === NULL)
- {
- $this->load->config('config');
- $this->favorite_languages = $this->config->item('favorite_languages');
- }
- }
-
- function valid_language($lang)
- {
- return array_key_exists($lang, $this->geshi_languages);
- }
-
- function get_languages()
- {
- $data = array();
-
- if (is_array($this->favorite_languages))
- {
- foreach ($this->favorite_languages as $key)
- {
- $data[$key] = $this->geshi_languages[$key];
- }
- $data["0"] = "-----------------";
- }
- foreach ($this->geshi_languages as $key => $value)
- {
-
- if (!in_array($key, $data))
- {
- $data[$key] = $value;
- }
- }
- return $data;
- }
-
- function code_to_description($code)
- {
- return $this->geshi_languages[$code];
- }
+
+ public function __construct()
+ {
+ parent::__construct();
+ $this->load->config('geshi_languages');
+ $this->geshi_languages = $this->config->item('geshi_languages');
+ $this->favorite_languages = $this->config->item('favorite_languages');
+
+ if ($this->favorite_languages === null) {
+ $this->load->config('config');
+ $this->favorite_languages = $this->config->item('favorite_languages');
+ }
+ }
+
+ public function valid_language($lang)
+ {
+ return array_key_exists($lang, $this->geshi_languages);
+ }
+
+ public function get_languages()
+ {
+ $data = array();
+
+ if (is_array($this->favorite_languages)) {
+ foreach ($this->favorite_languages as $key) {
+ $data[$key] = $this->geshi_languages[$key];
+ }
+ $data["0"] = "-----------------";
+ }
+ foreach ($this->geshi_languages as $key => $value) {
+
+ if (!in_array($key, $data)) {
+ $data[$key] = $value;
+ }
+ }
+ return $data;
+ }
+
+ public function code_to_description($code)
+ {
+ return $this->geshi_languages[$code];
+ }
}
diff --git a/htdocs/application/models/Pastes.php b/htdocs/application/models/Pastes.php
index 9f0612d..bdffd1d 100644
--- a/htdocs/application/models/Pastes.php
+++ b/htdocs/application/models/Pastes.php
@@ -1,1084 +1,904 @@
-<?php
-/**
- * Class and Function List:
- * Function list:
- * - __construct()
- * - countPastes()
- * - countReplies()
- * - createPaste()
- * - _get_url()
- * - curl_connect()
- * - _shorten_url()
- * - checkPaste()
- * - getPaste()
- * - calculate_hits()
- * - getReplies()
- * - getLists()
- * - getTrends()
- * - getSpamLists()
- * - cron()
- * - delete_paste()
- * - random_paste()
- * - _format_diff()
- * - _strip_bad_multibyte_chars()
- * Classes list:
- * - Pastes extends CI_Model
- */
+<?php if (!defined('BASEPATH')) {
+ exit('No direct script access allowed');
+}
class Pastes extends CI_Model
{
-
- function __construct()
- {
- parent::__construct();
- }
-
- function countPastes($ip_address = false)
- {
- $this->db->where('private', 0);
-
- if ($ip_address)
- {
- $this->db->where('ip_address', $ip_address);
- }
- $query = $this->db->get('pastes');
- return $query->num_rows();
- }
-
- function countReplies($pid)
- {
- $this->db->where('replyto', $pid);
- $query = $this->db->get('pastes');
- return $query->num_rows();
- }
-
- function createPaste()
- {
- $data['created'] = time();
-
- //this is SO evil… saving the «raw» data with htmlspecialchars :-( (but I have to leave this, because of backwards-compatibility)
- $data['raw'] = htmlspecialchars($this->_strip_bad_multibyte_chars($this->input->post('code')));
- $data['lang'] = htmlspecialchars($this->input->post('lang'));
- $data['replyto'] = ($this->input->post('reply') === null ? '0' : $this->input->post('reply'));
-
- if ($this->input->post('name'))
- {
- $data['name'] = htmlspecialchars($this->input->post('name'));
- }
- else
- {
- $data['name'] = $this->config->item('unknown_poster');
-
- if ($data['name'] == 'random')
- {
- $nouns = $this->config->item('nouns');
- $adjectives = $this->config->item('adjectives');
- $data['name'] = $adjectives[array_rand($adjectives) ] . " " . $nouns[array_rand($nouns) ];
- }
- }
-
- if ($this->input->post('title'))
- {
- $data['title'] = htmlspecialchars($this->input->post('title'));
- }
- else
- {
- $data['title'] = $this->config->item('unknown_title');
- }
- $data['private'] = ($this->input->post('private') === null ? '0' : $this->input->post('private'));
- do
- {
- $data['pid'] = substr(md5(md5(mt_rand(0, 1000000) . time())) , rand(0, 24) , 8);
- $this->db->select('id');
- $this->db->where('pid', $data['pid']);
- $query = $this->db->get('pastes');
-
- if ($query->num_rows > 0 or $data['pid'] == 'download')
- {
- $n = 0;
- break;
- }
- else
- {
- $n = 1;
- break;
- }
- }
- while ($n == 0);
- $burn = false;
-
- if ($this->input->post('expire') == '0')
- {
- $data['expire'] = 0;
- }
- else
- if ($this->input->post('expire') == 'burn')
- {
- $burn = true;
- $data['toexpire'] = 1;
- $data['expire'] = 0;
- $data['private'] = 1;
- }
- else
- {
- $format = 'Y-m-d H:i:s';
- $data['toexpire'] = 1;
- $data['expire'] = time() + (60 * $this->input->post('expire'));
- }
-
- if ($this->input->post('snipurl') == false)
- {
- $data['snipurl'] = false;
- }
- else
- {
- $url = $this->_get_url($data['pid']);
- $shorturl = $this->_shorten_url($url);
- $data['snipurl'] = $shorturl;
- }
- $data['ip_address'] = $this->input->ip_address();
- $this->db->insert('pastes', $data);
-
- if ($burn)
- {
- $CItemp =& get_instance();
- echo '<!DOCTYPE html><html><head><title>Warning!</title></head><body>';
- echo '<pre>Copy this URL:</pre>';
- echo '<span style="background-color: black; color: white">' . site_url('view/'.$data['pid']) . "</span>\n";
- if ($data['snipurl'] !== false)
- {
- echo '<br>Shorturl: ' . $shorturl . '">' . $shorturl . '<br>';
- }
- echo "<pre>It will become invalid on visit (will be deleted after first read)</pre><br />\n";
- echo '<a href="' . base_url() . '" class="title">Return to ' . $CItemp->config->item('site_name') . '</a></body></html>';
- exit;
- }
- else
- {
- return 'view/' . $data['pid'];
- }
- }
- private
- function _get_url($pid)
- {
- $override_url = $this->config->item('displayurl_override');
- return ($override_url ? str_replace('$id', $pid, $override_url) : site_url('view/' . $pid));
- }
- /**
- * Simple cURL connect // Used by _shorten_url
- * @param array $opt_array
- * @return mixed or boolean false on failure
- */
- private
- function curl_connect($opt_array)
- {
- $ch = curl_init();
- curl_setopt_array($ch, $opt_array);
- $resp = curl_exec($ch);
- curl_close($ch);
- return (empty($resp) ? false : $resp);
- }
- private
- function _shorten_url($url)
- {
-
- // Check if url shortening should be used
- $url_shortening_api = $this->config->item('url_shortening_use');
- $API_DB = array(
- "googl",
- "goo.gl",
- "bitly",
- "bit.ly",
- "yourls",
- "gwgd",
- "polr",
- "random"
- );
-
- if ($url_shortening_api !== false)
- {
-
- if (in_array($url_shortening_api, $API_DB, true))
- {
-
- if ($url_shortening_api === "random")
- {
- $url_shortening_consider = $this->config->item('random_url_engines');
-
- if (!is_array($url_shortening_consider))
- {
-
- if ($url_shortening_consider = @explode(",", preg_replace("/[^a-zA-Z0-9.]+/", "", $url_shortening_consider)))
- {
-
- if (count($url_shortening_consider) > 1)
- {
- foreach ($url_shortening_consider as $key => $api)
- {
-
- if (($key = array_search($api, $API_DB)) === false)
- {
- unset($API_DB[$key]);
- }
- }
- }
- }
- }
- else
- {
-
- if (count($url_shortening_consider) > 1)
- {
- foreach ($url_shortening_consider as $key => $api)
- {
-
- if (($key = array_search($api, $API_DB)) === false)
- {
- unset($API_DB[$key]);
- }
- }
- }
- }
-
- // We will use random API in this case
- $url_shortening_api = false; //Prepare for use in while loop
-
- // Run through while loop as long as an API which satisfy requirement's isn't found.
-
- // As satisfied API is considerer any API which is filled and not empty
-
- while ($url_shortening_api === false && $url_shortening_api !== "random")
- {
- $RAND_API = $API_DB[mt_rand(0, count($API_DB) - 1) ];
- switch ($RAND_API)
- {
- case "yourls":
- $var_yourls_url = $this->config->item('yourls_url');
- $var_yourls_signature = $this->config->item('yourls_signature');
-
- if (!empty($var_yourls_url) && !empty($v_yourls_signature))
- {
- $url_shortening_api = "yourls";
- }
- break;
- case "gwgd":
- case "gw.gd":
- $var_gwgd_url = $this->config->item('gwgd_url');
-
- if (!empty($var_gwgd_url))
- {
- $url_shortening_api = "gwgd";
- }
- break;
- case "googl":
- case "google":
- case "goo.gl":
- $var_googl_url_api = $this->config->item('googl_url_api');
-
- if (!empty($var_googl_url_api))
- {
- $url_shortening_api = "googl";
- }
- break;
- case "bitly":
- case "bit.ly":
- $var_bitly_url_api = $this->config->item('bitly_url_api');
-
- if (!empty($var_bitly_url_api))
- {
- $url_shortening_api = "bitly";
- }
- break;
- case "polr":
- $var_polr_url = $this->config->item('polr_url');
- $var_polr_api = $this->config->item('polr_api');
- if ((!empty($var_polr_url)) && (!empty($var_polr_api)))
- {
- $url_shortening_api = "polr";
- }
- break;
- default:
- $url_shortening_api = false;
- break;
- }
- }
- }
-
- // switch: Check which engine should be used
- switch ($url_shortening_api)
- {
- case "yourls":
- $config_yourls_url = $this->config->item('yourls_url');
- $config_yourls_signature = $this->config->item('yourls_signature');
- $timestamp = time();
-
- // grab title to avoid 404s in yourls
-
- if ($this->input->post('title'))
- {
- $yourl_title = htmlspecialchars($this->input->post('title'));
- }
- else
- {
- $yourl_title = $this->config->item('unknown_title');
- }
- $prep_data = array(
- CURLOPT_URL => $config_yourls_url . 'yourls-api.php',
- CURLOPT_RETURNTRANSFER => true,
- CURLOPT_POST => true,
- CURLOPT_POSTFIELDS => array(
- 'url' => $url,
- 'format' => 'simple',
- 'action' => 'shorturl',
- 'title' => $yourl_title,
- 'signature' => md5($timestamp . $config_yourls_signature) ,
- 'timestamp' => $timestamp
- )
- );
- $fetchResp = $this->curl_connect($prep_data);
- $shorturl = ((strlen($fetchResp) > 4) ? $fetchResp : false);
- break;
- case "gwgd":
- case "gw.gd":
-
- //use gwgd
- $url = urlencode($url);
- $config_gwgd_url = $this->config->item('gwgd_url');
- $gwgd_url = ($config_gwgd_url ? $config_gwgd_url : 'http://gw.gd/');
-
- // Prepare CURL options array
- $prep_data = array(
- CURLOPT_URL => $gwgd_url . 'api.php?long=' . $url,
- CURLOPT_RETURNTRANSFER => true,
- CURLOPT_ENCODING => 'identity'
- );
- $fetchResp = $this->curl_connect($prep_data);
- $shorturl = ((strlen($fetchResp) > 4) ? $fetchResp : false);
- break;
- case "googl":
- case "google":
- case "goo.gl":
-
- // Prepare CURL options array
- $prep_data = array(
- CURLOPT_URL => 'https://www.googleapis.com/urlshortener/v1/url?key=' . $this->config->item('googl_url_api') ,
- CURLOPT_RETURNTRANSFER => true,
- CURLOPT_SSL_VERIFYPEER => false,
- CURLOPT_HEADER => false,
- CURLOPT_HTTPHEADER => array(
- 'Content-type:application/json'
- ) ,
- CURLOPT_POST => true,
- CURLOPT_POSTFIELDS => json_encode(array(
- 'longUrl' => $url
- ))
- );
- $shorturl = @json_decode($this->curl_connect($prep_data));
- $shorturl = ((isset($shorturl->id)) ? $shorturl->id : false);
- break;
- case "bitly":
- case "bit.ly":
- $config_bitly_api = $this->config->item('bitly_url_api');
- $url = urlencode($url);
-
- // Prepare CURL options array
- $prep_data = array(
- CURLOPT_URL => "https://api-ssl.bitly.com/v3/shorten?access_token={$config_bitly_api}&longUrl={$url}&format=txt",
- CURLOPT_RETURNTRANSFER => true,
- CURLOPT_SSL_VERIFYPEER => false
- );
- $fetchResp = $this->curl_connect($prep_data);
- $shorturl = ((strlen($fetchResp) > 4) ? $fetchResp : false);
- break;
- case "polr":
- $config_polr_url = $this->config->item('polr_url');
- $config_polr_api = $this->config->item('polr_api');
- $url = urlencode($url);
-
- // Prepare CURL options array
- $prep_data = array(
- CURLOPT_URL => "{$config_polr_url}/api/v2/action/shorten?key={$config_polr_api}&url={$url}&is_secret=false",
- CURLOPT_RETURNTRANSFER => true,
- CURLOPT_SSL_VERIFYPEER => false
- );
- $fetchResp = $this->curl_connect($prep_data);
- $shorturl = ((strlen($fetchResp) > 4) ? $fetchResp : false);
+
+ public function __construct()
+ {
+ parent::__construct();
+ }
+
+ public function countPastes($ip_address = false)
+ {
+ $this->db->where('private', 0);
+
+ if ($ip_address) {
+ $this->db->where('ip_address', $ip_address);
+ }
+ $query = $this->db->get('pastes');
+ return $query->num_rows();
+ }
+
+ public function countReplies($pid)
+ {
+ $this->db->where('replyto', $pid);
+ $query = $this->db->get('pastes');
+ return $query->num_rows();
+ }
+
+ public function createPaste()
+ {
+ $data['created'] = time();
+
+ //this is SO evil… saving the «raw» data with htmlspecialchars :-( (but I have to leave this, because of backwards-compatibility)
+ $data['raw'] = htmlspecialchars($this->_strip_bad_multibyte_chars($this->input->post('code')));
+ $data['lang'] = htmlspecialchars($this->input->post('lang'));
+ $data['replyto'] = ($this->input->post('reply') === null ? '0' : $this->input->post('reply'));
+
+ if ($this->input->post('name')) {
+ $data['name'] = htmlspecialchars($this->input->post('name'));
+ } else {
+ $data['name'] = $this->config->item('unknown_poster');
+
+ if ($data['name'] == 'random') {
+ $nouns = $this->config->item('nouns');
+ $adjectives = $this->config->item('adjectives');
+ $data['name'] = $adjectives[array_rand($adjectives)] . " " . $nouns[array_rand($nouns)];
+ }
+ }
+
+ if ($this->input->post('title')) {
+ $data['title'] = htmlspecialchars($this->input->post('title'));
+ } else {
+ $data['title'] = $this->config->item('unknown_title');
+ }
+ $data['private'] = ($this->input->post('private') === null ? '0' : $this->input->post('private'));
+
+ do {
+ $data['pid'] = substr(md5(md5(mt_rand(0, 1000000) . time())), rand(0, 24), 8);
+ $this->db->select('id');
+ $this->db->where('pid', $data['pid']);
+ $query = $this->db->get('pastes');
+
+ if ($query->num_rows > 0 or $data['pid'] == 'download') {
+ $n = 0;
+ break;
+ } else {
+ $n = 1;
+ break;
+ }
+ } while ($n == 0);
+
+ $burn = false;
+ if ($this->input->post('expire') == '0') {
+ $data['expire'] = 0;
+ } else if ($this->input->post('expire') == 'burn') {
+ $burn = true;
+ $data['toexpire'] = 1;
+ $data['expire'] = 0;
+ $data['private'] = 1;
+ } else {
+ $format = 'Y-m-d H:i:s';
+ $data['toexpire'] = 1;
+ $data['expire'] = time() + (60 * $this->input->post('expire'));
+ }
+
+ if ($this->input->post('snipurl') == false) {
+ $data['snipurl'] = false;
+ } else {
+ $url = $this->_get_url($data['pid']);
+ $shorturl = $this->_shorten_url($url);
+ $data['snipurl'] = $shorturl;
+ }
+ $data['ip_address'] = $this->input->ip_address();
+ $this->db->insert('pastes', $data);
+
+ if ($burn) {
+ $CItemp = &get_instance();
+ echo '<!DOCTYPE html><html><head><title>Warning!</title></head><body>';
+ echo '<pre>Copy this URL:</pre>';
+ echo '<span style="background-color: black; color: white">' . site_url('view/' . $data['pid']) . "</span>\n";
+ if ($data['snipurl'] !== false) {
+ echo '<br>Shorturl: ' . $shorturl . '">' . $shorturl . '<br>';
+ }
+ echo "<pre>It will become invalid on visit (will be deleted after first read)</pre><br />\n";
+ echo '<a href="' . base_url() . '" class="title">Return to ' . $CItemp->config->item('site_name') . '</a></body></html>';
+ exit;
+ } else {
+ return 'view/' . $data['pid'];
+ }
+ }
+
+ private function _get_url($pid)
+ {
+ $override_url = $this->config->item('displayurl_override');
+ return ($override_url ? str_replace('$id', $pid, $override_url) : site_url('view/' . $pid));
+ }
+
+ /**
+ * Simple cURL connect // Used by _shorten_url
+ * @param array $opt_array
+ * @return mixed or boolean false on failure
+ */
+ private function curl_connect($opt_array)
+ {
+ $ch = curl_init();
+ curl_setopt_array($ch, $opt_array);
+ $resp = curl_exec($ch);
+ curl_close($ch);
+ return (empty($resp) ? false : $resp);
+ }
+
+ private function _shorten_url($url)
+ {
+
+ // Check if url shortening should be used
+ $url_shortening_api = $this->config->item('url_shortening_use');
+ $API_DB = array(
+ "googl",
+ "goo.gl",
+ "bitly",
+ "bit.ly",
+ "yourls",
+ "gwgd",
+ "polr",
+ "random",
+ );
+
+ if ($url_shortening_api !== false) {
+
+ if (in_array($url_shortening_api, $API_DB, true)) {
+
+ if ($url_shortening_api === "random") {
+ $url_shortening_consider = $this->config->item('random_url_engines');
+
+ if (!is_array($url_shortening_consider)) {
+
+ if ($url_shortening_consider = @explode(",", preg_replace("/[^a-zA-Z0-9.]+/", "", $url_shortening_consider))) {
+
+ if (count($url_shortening_consider) > 1) {
+ foreach ($url_shortening_consider as $key => $api) {
+
+ if (($key = array_search($api, $API_DB)) === false) {
+ unset($API_DB[$key]);
+ }
+ }
+ }
+ }
+ } else {
+
+ if (count($url_shortening_consider) > 1) {
+ foreach ($url_shortening_consider as $key => $api) {
+
+ if (($key = array_search($api, $API_DB)) === false) {
+ unset($API_DB[$key]);
+ }
+ }
+ }
+ }
+
+ // We will use random API in this case
+ $url_shortening_api = false; //Prepare for use in while loop
+ // Run through while loop as long as an API which satisfy requirement's isn't found.
+ // As satisfied API is considerer any API which is filled and not empty
+ while ($url_shortening_api === false && $url_shortening_api !== "random") {
+ $RAND_API = $API_DB[mt_rand(0, count($API_DB) - 1)];
+ switch ($RAND_API) {
+ case "yourls":
+ $var_yourls_url = $this->config->item('yourls_url');
+ $var_yourls_signature = $this->config->item('yourls_signature');
+
+ if (!empty($var_yourls_url) && !empty($v_yourls_signature)) {
+ $url_shortening_api = "yourls";
+ }
+ break;
+ case "gwgd":
+ case "gw.gd":
+ $var_gwgd_url = $this->config->item('gwgd_url');
+
+ if (!empty($var_gwgd_url)) {
+ $url_shortening_api = "gwgd";
+ }
+ break;
+ case "googl":
+ case "google":
+ case "goo.gl":
+ $var_googl_url_api = $this->config->item('googl_url_api');
+
+ if (!empty($var_googl_url_api)) {
+ $url_shortening_api = "googl";
+ }
+ break;
+ case "bitly":
+ case "bit.ly":
+ $var_bitly_url_api = $this->config->item('bitly_url_api');
+
+ if (!empty($var_bitly_url_api)) {
+ $url_shortening_api = "bitly";
+ }
+ break;
+ case "polr":
+ $var_polr_url = $this->config->item('polr_url');
+ $var_polr_api = $this->config->item('polr_api');
+ if ((!empty($var_polr_url)) && (!empty($var_polr_api))) {
+ $url_shortening_api = "polr";
+ }
+ break;
+ default:
+ $url_shortening_api = false;
break;
- default:
- $shorturl = false;
- break;
- }
- }
- else
- {
- $shorturl = false;
- }
- }
- else
- {
-
- // Backward compatibility - Falling back to legacy mode
- $config_yourls_url = $this->config->item('yourls_url');
-
- if ($config_yourls_url)
- {
-
- //use yourls
- $config_yourls_signature = $this->config->item('yourls_signature');
- $timestamp = time();
-
- // grab title to avoid 404s in yourls
-
- if ($this->input->post('title'))
- {
- $yourl_title = htmlspecialchars($this->input->post('title'));
- }
- else
- {
- $yourl_title = $this->config->item('unknown_title');
- }
- $prep_data = array(
- CURLOPT_URL => $config_yourls_url . 'yourls-api.php',
- CURLOPT_RETURNTRANSFER => true,
- CURLOPT_POST => true,
- CURLOPT_POSTFIELDS => array(
- 'url' => $url,
- 'format' => 'simple',
- 'action' => 'shorturl',
- 'title' => $yourl_title,
- 'signature' => md5($timestamp . $config_yourls_signature) ,
- 'timestamp' => $timestamp
- )
- );
- $fetchResp = $this->curl_connect($prep_data);
- $shorturl = ((strlen($fetchResp) > 4) ? $fetchResp : false);
- }
- else
- {
-
- //use gdgw
- $url = urlencode($url);
- $config_gwgd_url = $this->config->item('gwgd_url');
- $gwgd_url = ($config_gwgd_url ? $config_gwgd_url : 'http://gw.gd/');
-
- // Prepare CURL options array
- $prep_data = array(
- CURLOPT_URL => $gwgd_url . 'api.php?long=' . $url,
- CURLOPT_RETURNTRANSFER => true,
- CURLOPT_ENCODING => 'identity'
- );
- $fetchResp = $this->curl_connect($prep_data);
- $shorturl = ((strlen($fetchResp) > 4) ? $fetchResp : false);
- }
- }
- return $shorturl;
- }
-
- function checkPaste($seg = 2)
- {
-
- if ($this->uri->segment($seg) == "")
- {
- return false;
- }
- else
- {
- $this->db->where('pid', $this->uri->segment($seg));
- $query = $this->db->get('pastes');
-
- if ($query->num_rows() > 0)
- {
- return true;
- }
- else
- {
- return false;
- }
- }
- }
-
- function getPaste($seg = 2, $replies = false, $diff = false)
- {
-
- if ($this->uri->segment($seg) == '')
- {
- redirect('');
- }
- else
- {
- $pid = $this->uri->segment($seg);
- $data['script'] = 'jquery.js';
- }
- $this->load->library('process');
- $this->db->where('pid', $pid);
- $query = $this->db->get('pastes');
- foreach ($query->result_array() as $row)
- {
- $data['title'] = $row['title'];
- $data['pid'] = $row['pid'];
- $data['name'] = $row['name'];
- $data['lang_code'] = $row['lang'];
- $data['lang'] = $this->languages->code_to_description($row['lang']);
- $data['paste'] = $this->process->syntax(htmlspecialchars_decode($row['raw']) , $row['lang']);
- $data['created'] = $row['created'];
- $data['private'] = $row['private'];
- $data['expire'] = $row['expire'];
- $data['toexpire'] = $row['toexpire'];
- $data['url'] = $this->_get_url($row['pid']);
- $data['raw'] = $row['raw'];
- $data['hits'] = $row['hits'];
- $data['hits_updated'] = $row['hits_updated'];
- $data['snipurl'] = $row['snipurl'];
- $inreply = $row['replyto'];
- }
-
- if ($inreply)
- {
- $this->db->select('name, title');
- $this->db->where('pid', $inreply);
- $query = $this->db->get('pastes');
-
- if ($query->num_rows() > 0)
- {
- foreach ($query->result_array() as $row)
- {
- $data['inreply']['title'] = $row['title'];
- $data['inreply']['name'] = $row['name'];
- $data['inreply']['url'] = site_url('view/' . $inreply);
- }
- }
- else
- {
- $data['inreply'] = false;
- }
-
- if ($diff)
- {
- $this->db->select('raw');
- $this->db->where('pid', $inreply);
- $query = $this->db->get('pastes');
-
- if ($query->num_rows() > 0)
- {
- foreach ($query->result_array() as $row)
- {
-
- //diff
- //yes, I'm aware, two times htmlspecialchars_decode(). Needs to be, since it's saved that way in the DB from the original stikked author ages ago ;)
-
- include_once (APPPATH . '/libraries/finediff.php');
- $from_text = htmlspecialchars_decode(utf8_decode($row['raw']));
- $to_text = htmlspecialchars_decode(utf8_decode($data['raw']));
- $opcodes = FineDiff::getDiffOpcodes($from_text, $to_text, FineDiff::$wordGranularity);
- $to_text = FineDiff::renderToTextFromOpcodes($from_text, $opcodes);
- $data['paste'] = htmlspecialchars_decode($this->_format_diff(nl2br(FineDiff::renderDiffToHTMLFromOpcodes($from_text, $opcodes))));
- }
- }
- else
- {
- $data['inreply'] = false;
- }
- }
- }
-
- if ($replies)
- {
- $amount = $this->config->item('per_page');
- $page = ($this->uri->segment(3) ? $this->uri->segment(3) : 0);
- $this->db->select('title, name, created, pid, lang');
- $this->db->where('replyto', $data['pid']);
- $this->db->order_by('id', 'desc');
- $this->db->limit($amount);
- $query = $this->db->get('pastes', $amount, $page);
-
- if ($query->num_rows() > 0)
- {
- $n = 0;
- foreach ($query->result_array() as $row)
- {
- $data['replies'][$n]['title'] = $row['title'];
- $data['replies'][$n]['name'] = $row['name'];
- $data['replies'][$n]['lang'] = $row['lang'];
- $data['replies'][$n]['created'] = $row['created'];
- $data['replies'][$n]['pid'] = $row['pid'];
- $n++;
- }
- $config['base_url'] = site_url('view/' . $data['pid']);
- $config['total_rows'] = $this->countReplies($data['pid']);
- $config['per_page'] = $amount;
- $config['num_links'] = 9;
- $config['full_tag_open'] = '<div class="pages">';
- $config['full_tag_close'] = '</div>';
- $config['uri_segment'] = 3;
- $this->load->library('pagination');
- $this->pagination->initialize($config);
- $data['pages'] = $this->pagination->create_links();
- }
- else
- {
- $replies = false;
- }
- }
-
- /*
- * Hits
- * First check if record already exists. If it does, do not insert.
- * INSERT IGNORE INTO does not work for postgres.
- */
- $this->db->select('count(paste_id) as count');
- $this->db->where('paste_id', $pid);
- $this->db->where('ip_address', $this->input->ip_address());
- $query = $this->db->get('trending');
- $hits_count = $query->result_array();
- $hits_count = $hits_count[0]['count'];
-
- if ($hits_count == 0)
- {
- $this->db->insert('trending', array(
- 'paste_id' => $pid,
- 'ip_address' => $this->input->ip_address() ,
- 'created' => time() ,
- ));
- }
-
- //update hits counter every minute
-
- if (time() > (60 + $data['hits_updated']))
- {
- $this->calculate_hits($pid, $data['hits']);
- }
-
- //burn if necessary
-
- if ($data['expire'] == 0 and $data['toexpire'] == 1)
- {
- $this->delete_paste($data['pid']);
- }
- return $data;
- }
-
- function calculate_hits($pid, $current_hits)
- {
- $this->db->select('count(paste_id) as count');
- $this->db->where('paste_id', $pid);
- $query = $this->db->get('trending');
- $hits_count = $query->result_array();
- $hits_count = $hits_count[0]['count'];
-
- if ($hits_count != $current_hits)
- {
-
- //update
- $this->db->where('pid', $pid);
- $this->db->update('pastes', array(
- 'hits' => $hits_count,
- 'hits_updated' => time() ,
- ));
- }
- }
-
- function getReplies($seg = 3)
- {
- $amount = $this->config->item('per_page');
-
- if ($this->uri->segment($seg) == '')
- {
- redirect('');
- }
- else
- {
- $pid = $this->uri->segment($seg);
- }
- $this->db->select('title, name, created, pid, raw, lang');
- $this->db->where('replyto', $pid);
- $this->db->order_by('id', 'desc');
- $this->db->limit($amount);
- $query = $this->db->get('pastes', $amount);
-
- if ($query->num_rows() > 0)
- {
- $n = 0;
- foreach ($query->result_array() as $row)
- {
- $data['replies'][$n]['title'] = $row['title'];
- $data['replies'][$n]['name'] = $row['name'];
- $data['replies'][$n]['lang'] = $row['lang'];
- $data['replies'][$n]['created'] = $row['created'];
- $data['replies'][$n]['pid'] = $row['pid'];
-
- if ($this->uri->segment(2) == 'rss')
- {
- $data['replies'][$n]['paste'] = $this->process->syntax(htmlspecialchars_decode($row['raw']) , $row['lang']);
- $data['replies'][$n]['raw'] = $row['raw'];
- }
- $n++;
- }
- }
- return $data;
- }
-
- function getLists($root = 'lists/', $seg = 2)
- {
- $this->load->library('pagination');
- $this->load->library('process');
- $amount = $this->config->item('per_page');
- $page = ($this->uri->segment($seg) ? $this->uri->segment($seg) : 0);
- $search = $this->input->get('search');
- $TABLE = $this->config->item('db_prefix') . "pastes";
-
- if ($search)
- {
- $search = '%' . $search . '%';
-
- // count total results
- $sql = "SELECT id FROM $TABLE WHERE private = 0 AND (title LIKE ? OR raw LIKE ?)";
- $query = $this->db->query($sql, array(
- $search,
- $search,
- ));
- $total_rows = $query->num_rows();
-
- // query
-
- if ($this->db->dbdriver == "postgre")
- {
- $sql = "SELECT id, title, name, created, pid, lang, raw FROM $TABLE WHERE private = 0 AND (title LIKE ? OR raw LIKE ?) ORDER BY created DESC LIMIT $amount OFFSET $page";
- }
- else
- if ($root == 'api/recent')
- {
- $sql = "SELECT id, title, name, created, pid, lang, raw FROM $TABLE WHERE private = 0 AND (title LIKE ? OR raw LIKE ?) ORDER BY created DESC LIMIT 0,15";
- }
- else
- {
- $sql = "SELECT id, title, name, created, pid, lang, raw FROM $TABLE WHERE private = 0 AND (title LIKE ? OR raw LIKE ?) ORDER BY created DESC LIMIT $page,$amount";
- }
- $query = $this->db->query($sql, array(
- $search,
- $search,
- ));
- }
- else
- {
-
- // count total results
- $sql = "SELECT id FROM $TABLE WHERE private = 0";
- $query = $this->db->query($sql);
- $total_rows = $query->num_rows();
-
- // query
-
- if ($this->db->dbdriver == "postgre")
- {
- $sql = "SELECT id, title, name, created, pid, lang, raw FROM $TABLE WHERE private = 0 ORDER BY created DESC LIMIT $amount OFFSET $page";
- }
- else
- if ($root == 'api/recent')
- {
- $sql = "SELECT id, title, name, created, pid, lang, raw FROM $TABLE WHERE private = 0 ORDER BY created DESC LIMIT 0,15";
- }
- else
- {
- $sql = "SELECT id, title, name, created, pid, lang, raw FROM $TABLE WHERE private = 0 ORDER BY created DESC LIMIT $page,$amount";
- }
- $query = $this->db->query($sql);
- }
-
- if ($query->num_rows() > 0)
- {
- $n = 0;
- foreach ($query->result_array() as $row)
- {
- $data['pastes'][$n]['id'] = $row['id'];
- $data['pastes'][$n]['title'] = $row['title'];
- $data['pastes'][$n]['name'] = $row['name'];
- $data['pastes'][$n]['created'] = $row['created'];
- $data['pastes'][$n]['lang'] = $this->languages->code_to_description($row['lang']);
- $data['pastes'][$n]['pid'] = $row['pid'];
-
- if ($this->uri->segment(2) == 'rss')
- {
- $data['pastes'][$n]['paste'] = $this->process->syntax(htmlspecialchars_decode($row['raw']) , $row['lang']);
- }
- $data['pastes'][$n]['raw'] = $row['raw'];
- $n++;
- }
- }
- $config['base_url'] = site_url($root);
- $config['total_rows'] = $total_rows;
- $config['per_page'] = $amount;
- $config['num_links'] = 9;
- $config['full_tag_open'] = '<div class="pages">';
- $config['full_tag_close'] = '</div>';
- $config['uri_segment'] = $seg;
- $searchparams = ($this->input->get('search') ? '?search=' . $this->input->get('search') : '');
- $config['first_url'] = '0' . $searchparams;
- $config['suffix'] = $searchparams;
- $this->pagination->initialize($config);
- $data['pages'] = $this->pagination->create_links();
- return $data;
- }
-
- function getTrends($root = 'trends/', $seg = 2)
- {
- $this->load->library('pagination');
- $amount = $this->config->item('per_page');
- $page = ($this->uri->segment(2) ? $this->uri->segment(2) : 0);
- $search = $this->input->get('search');
- $TABLE = $this->config->item('db_prefix') . "pastes";
-
- if ($search)
- {
- $search = '%' . $search . '%';
-
- // count total results
- $sql = "SELECT id FROM $TABLE WHERE private = 0 AND (title LIKE ? OR raw LIKE ?)";
- $query = $this->db->query($sql, array(
- $search,
- $search,
- ));
- $total_rows = $query->num_rows();
-
- // query
-
- if ($this->db->dbdriver == "postgre")
- {
- $sql = "SELECT id, title, name, created, pid, lang, raw, hits FROM $TABLE WHERE private = 0 AND (title LIKE ? OR raw LIKE ?) ORDER BY hits DESC, created DESC LIMIT $amount OFFSET $page";
- }
- else
- if ($root == "api/trending")
- {
- $sql = "SELECT id, title, name, created, pid, lang, raw, hits FROM $TABLE WHERE private = 0 AND (title LIKE ? OR raw LIKE ?) ORDER BY hits DESC, created DESC LIMIT 0,15";
- }
- else
- {
- $sql = "SELECT id, title, name, created, pid, lang, raw, hits FROM $TABLE WHERE private = 0 AND (title LIKE ? OR raw LIKE ?) ORDER BY hits DESC, created DESC LIMIT $page,$amount";
- }
- $query = $this->db->query($sql, array(
- $search,
- $search,
- ));
- }
- else
- {
-
- // count total results
- $sql = "SELECT id FROM $TABLE WHERE private = 0";
- $query = $this->db->query($sql);
- $total_rows = $query->num_rows();
-
- // query
-
- if ($this->db->dbdriver == "postgre")
- {
- $sql = "SELECT id, title, name, created, pid, lang, raw, hits FROM $TABLE WHERE private = 0 ORDER BY hits DESC, created DESC LIMIT $amount OFFSET $page";
- }
- else
- if ($root == "api/trending")
- {
- $sql = "SELECT id, title, name, created, pid, lang, raw, hits FROM $TABLE WHERE private = 0 ORDER BY hits DESC, created DESC LIMIT 0,15";
- }
- else
- {
- $sql = "SELECT id, title, name, created, pid, lang, raw, hits FROM $TABLE WHERE private = 0 ORDER BY hits DESC, created DESC LIMIT $page,$amount";
- }
- $query = $this->db->query($sql);
- }
-
- if ($query->num_rows() > 0)
- {
- $n = 0;
- foreach ($query->result_array() as $row)
- {
- $data['pastes'][$n]['id'] = $row['id'];
- $data['pastes'][$n]['title'] = $row['title'];
- $data['pastes'][$n]['name'] = $row['name'];
- $data['pastes'][$n]['created'] = $row['created'];
- $data['pastes'][$n]['lang'] = $this->languages->code_to_description($row['lang']);
- $data['pastes'][$n]['pid'] = $row['pid'];
- $data['pastes'][$n]['raw'] = $row['raw'];
- $data['pastes'][$n]['hits'] = $row['hits'];
- $n++;
- }
- }
- $config['base_url'] = site_url($root);
- $config['total_rows'] = $total_rows;
- $config['per_page'] = $amount;
- $config['num_links'] = 9;
- $config['full_tag_open'] = '<div class="pages">';
- $config['full_tag_close'] = '</div>';
- $config['uri_segment'] = $seg;
- $searchparams = ($this->input->get('search') ? '?search=' . $this->input->get('search') : '');
- $config['first_url'] = '0' . $searchparams;
- $config['suffix'] = $searchparams;
- $this->pagination->initialize($config);
- $data['pages'] = $this->pagination->create_links();
- return $data;
- }
-
- function getSpamLists($root = 'spamadmin/', $seg = 2, $ip_address = false)
- {
- $this->load->library('pagination');
- $this->load->library('process');
- $amount = $this->config->item('per_page');
- $page = ($this->uri->segment($seg) ? $this->uri->segment($seg) : 0);
- $this->db->select('id, title, name, created, pid, lang, ip_address');
- $this->db->where('private', 0);
-
- if ($ip_address)
- {
- $this->db->where('ip_address', $ip_address);
- }
- $this->db->order_by('created', 'desc');
- $query = $this->db->get('pastes', $amount, $page);
-
- if ($query->num_rows() > 0)
- {
- $n = 0;
- foreach ($query->result_array() as $row)
- {
- $data['pastes'][$n]['id'] = $row['id'];
- $data['pastes'][$n]['title'] = $row['title'];
- $data['pastes'][$n]['name'] = $row['name'];
- $data['pastes'][$n]['created'] = $row['created'];
- $data['pastes'][$n]['lang'] = $row['lang'];
- $data['pastes'][$n]['pid'] = $row['pid'];
- $data['pastes'][$n]['ip_address'] = $row['ip_address'];
- $n++;
- }
- }
-
- //pagination
- $config['base_url'] = site_url($root);
- $config['total_rows'] = $this->countPastes($ip_address);
- $config['per_page'] = $amount;
- $config['num_links'] = 9;
- $config['full_tag_open'] = '<div class="pages">';
- $config['full_tag_close'] = '</div>';
- $config['uri_segment'] = $seg;
- $this->pagination->initialize($config);
- $data['pages'] = $this->pagination->create_links();
-
- //total spam attempts
- $this->db->select('SUM(spam_attempts) as sum');
- $query = $this->db->get('blocked_ips');
- $q = $query->result_array();
- $data['total_spam_attempts'] = ($q[0]['sum'] != '' ? $q[0]['sum'] : 0);
-
- //return
- return $data;
- }
-
- function cron()
- {
- $now = now();
- $this->db->select('pid,expire');
- $this->db->where('toexpire', '1');
- $query = $this->db->get('pastes');
- foreach ($query->result_array() as $row)
- {
- $stamp = $row['expire'];
-
- if ($now > $stamp AND $stamp != 0)
- {
- $this->delete_paste($row['pid']);
- }
- }
- return;
- }
-
- function delete_paste($pid)
- {
- $this->db->where('pid', $pid);
- $this->db->delete('pastes');
-
- // delete from trending
- $this->db->where('paste_id', $pid);
- $this->db->delete('trending');
- return;
- }
-
- function random_paste()
- {
- $this->load->library('process');
- $this->db->order_by('id', 'RANDOM');
- $this->db->limit(1);
- $this->db->where('private', '0');
- $query = $this->db->get('pastes');
-
- if ($query->num_rows() > 0)
- {
- foreach ($query->result_array() as $row)
- {
- $data['title'] = $row['title'];
- $data['pid'] = $row['pid'];
- $data['name'] = $row['name'];
- $data['lang_code'] = $row['lang'];
- $data['lang'] = $this->languages->code_to_description($row['lang']);
- $data['paste'] = $this->process->syntax(htmlspecialchars_decode($row['raw']) , $row['lang']);
- $data['created'] = $row['created'];
- $data['url'] = $this->_get_url($row['pid']);
- $data['raw'] = $row['raw'];
- $data['hits'] = $row['hits'];
- $data['hits_updated'] = $row['hits_updated'];
- $data['snipurl'] = $row['snipurl'];
- $inreply = $row['replyto'];
- }
-
- if ($inreply)
- {
- $this->db->select('name, title');
- $this->db->where('pid', $inreply);
- $query = $this->db->get('pastes');
-
- if ($query->num_rows() > 0)
- {
- foreach ($query->result_array() as $row)
- {
- $data['inreply']['title'] = $row['title'];
- $data['inreply']['name'] = $row['name'];
- $data['inreply']['url'] = site_url('view/' . $inreply);
- }
- }
- else
- {
- $data['inreply'] = false;
- }
- }
- return $data;
- }
- return false;
- }
- private
- function _format_diff($text)
- {
- $text = str_replace("\t", '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;', $text);
- $text = str_replace("<br />", '<br/>', $text);
- $text = str_replace(" ", '&nbsp;', $text);
- $text = '<div class="text" style="font-family:monospace; font: normal normal 1em/1.2em monospace;">' . $text . '</div>';
- return $text;
- }
- private
- function _strip_bad_multibyte_chars($str)
- {
- $result = '';
- $length = strlen($str);
- for ($i = 0;$i < $length;$i++)
- {
-
- // Replace four-byte characters (11110www 10zzzzzz 10yyyyyy 10xxxxxx)
- $ord = ord($str[$i]);
-
- if ($ord >= 240 && $ord <= 244)
- {
- $result.= '?';
- $i+= 3;
- }
- else
- {
- $result.= $str[$i];
- }
- }
- return $result;
- }
+ }
+ }
+ }
+
+ // switch: Check which engine should be used
+ switch ($url_shortening_api) {
+ case "yourls":
+ $config_yourls_url = $this->config->item('yourls_url');
+ $config_yourls_signature = $this->config->item('yourls_signature');
+ $timestamp = time();
+
+ // grab title to avoid 404s in yourls
+ if ($this->input->post('title')) {
+ $yourl_title = htmlspecialchars($this->input->post('title'));
+ } else {
+ $yourl_title = $this->config->item('unknown_title');
+ }
+ $prep_data = array(
+ CURLOPT_URL => $config_yourls_url . 'yourls-api.php',
+ CURLOPT_RETURNTRANSFER => true,
+ CURLOPT_POST => true,
+ CURLOPT_POSTFIELDS => array(
+ 'url' => $url,
+ 'format' => 'simple',
+ 'action' => 'shorturl',
+ 'title' => $yourl_title,
+ 'signature' => md5($timestamp . $config_yourls_signature),
+ 'timestamp' => $timestamp,
+ ),
+ );
+ $fetchResp = $this->curl_connect($prep_data);
+ $shorturl = ((strlen($fetchResp) > 4) ? $fetchResp : false);
+ break;
+ case "gwgd":
+ case "gw.gd":
+
+ //use gwgd
+ $url = urlencode($url);
+ $config_gwgd_url = $this->config->item('gwgd_url');
+ $gwgd_url = ($config_gwgd_url ? $config_gwgd_url : 'http://gw.gd/');
+
+ // Prepare CURL options array
+ $prep_data = array(
+ CURLOPT_URL => $target . $gwgd_url . 'api.php?long=' . $url,
+ CURLOPT_RETURNTRANSFER => true,
+ CURLOPT_ENCODING => 'identity',
+ );
+ $fetchResp = $this->curl_connect($prep_data);
+ $shorturl = ((strlen($fetchResp) > 4) ? $fetchResp : false);
+ break;
+ case "googl":
+ case "google":
+ case "goo.gl":
+
+ // Prepare CURL options array
+ $prep_data = array(
+ CURLOPT_URL => 'https://www.googleapis.com/urlshortener/v1/url?key=' . $this->config->item('googl_url_api'),
+ CURLOPT_RETURNTRANSFER => true,
+ CURLOPT_SSL_VERIFYPEER => false,
+ CURLOPT_HEADER => false,
+ CURLOPT_HTTPHEADER => array(
+ 'Content-type:application/json',
+ ),
+ CURLOPT_POST => true,
+ CURLOPT_POSTFIELDS => json_encode(array(
+ 'longUrl' => $url,
+ )),
+ );
+ $shorturl = @json_decode($this->curl_connect($prep_data));
+ $shorturl = ((isset($shorturl->id)) ? $shorturl->id : false);
+ break;
+ case "bitly":
+ case "bit.ly":
+ $config_bitly_api = $this->config->item('bitly_url_api');
+ $url = urlencode($url);
+
+ // Prepare CURL options array
+ $prep_data = array(
+ CURLOPT_URL => "https://api-ssl.bitly.com/v3/shorten?access_token={$config_bitly_api}&longUrl={$url}&format=txt",
+ CURLOPT_RETURNTRANSFER => true,
+ CURLOPT_SSL_VERIFYPEER => false,
+ );
+ $fetchResp = $this->curl_connect($prep_data);
+ $shorturl = ((strlen($fetchResp) > 4) ? $fetchResp : false);
+ break;
+ case "polr":
+ $config_polr_url = $this->config->item('polr_url');
+ $config_polr_api = $this->config->item('polr_api');
+ $url = urlencode($url);
+
+ // Prepare CURL options array
+ $prep_data = array(
+ CURLOPT_URL => "{$config_polr_url}/api/v2/action/shorten?key={$config_polr_api}&url={$url}&is_secret=false",
+ CURLOPT_RETURNTRANSFER => true,
+ CURLOPT_SSL_VERIFYPEER => false,
+ );
+ $fetchResp = $this->curl_connect($prep_data);
+ $shorturl = ((strlen($fetchResp) > 4) ? $fetchResp : false);
+ break;
+ default:
+ $shorturl = false;
+ break;
+ }
+ } else {
+ $shorturl = false;
+ }
+ } else {
+
+ // Backward compatibility - Falling back to legacy mode
+ $config_yourls_url = $this->config->item('yourls_url');
+
+ if ($config_yourls_url) {
+
+ //use yourls
+ $config_yourls_signature = $this->config->item('yourls_signature');
+ $timestamp = time();
+
+ // grab title to avoid 404s in yourls
+ if ($this->input->post('title')) {
+ $yourl_title = htmlspecialchars($this->input->post('title'));
+ } else {
+ $yourl_title = $this->config->item('unknown_title');
+ }
+ $prep_data = array(
+ CURLOPT_URL => $config_yourls_url . 'yourls-api.php',
+ CURLOPT_RETURNTRANSFER => true,
+ CURLOPT_POST => true,
+ CURLOPT_POSTFIELDS => array(
+ 'url' => $url,
+ 'format' => 'simple',
+ 'action' => 'shorturl',
+ 'title' => $yourl_title,
+ 'signature' => md5($timestamp . $config_yourls_signature),
+ 'timestamp' => $timestamp,
+ ),
+ );
+ $fetchResp = $this->curl_connect($prep_data);
+ $shorturl = ((strlen($fetchResp) > 4) ? $fetchResp : false);
+ } else {
+
+ //use gdgw
+ $url = urlencode($url);
+ $config_gwgd_url = $this->config->item('gwgd_url');
+ $gwgd_url = ($config_gwgd_url ? $config_gwgd_url : 'http://gw.gd/');
+
+ // Prepare CURL options array
+ $prep_data = array(
+ CURLOPT_URL => $target . $gwgd_url . 'api.php?long=' . $url,
+ CURLOPT_RETURNTRANSFER => true,
+ CURLOPT_ENCODING => 'identity',
+ );
+ $fetchResp = $this->curl_connect($prep_data);
+ $shorturl = ((strlen($fetchResp) > 4) ? $fetchResp : false);
+ }
+ }
+ return $shorturl;
+ }
+
+ public function checkPaste($seg = 2)
+ {
+
+ if ($this->uri->segment($seg) == "") {
+ return false;
+ } else {
+ $this->db->where('pid', $this->uri->segment($seg));
+ $query = $this->db->get('pastes');
+
+ if ($query->num_rows() > 0) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+ }
+
+ public function getPaste($seg = 2, $replies = false, $diff = false)
+ {
+
+ if ($this->uri->segment($seg) == '') {
+ redirect('');
+ } else {
+ $pid = $this->uri->segment($seg);
+ $data['script'] = 'jquery.js';
+ }
+ $this->load->library('process');
+ $this->db->where('pid', $pid);
+ $query = $this->db->get('pastes');
+ foreach ($query->result_array() as $row) {
+ $data['title'] = $row['title'];
+ $data['pid'] = $row['pid'];
+ $data['name'] = $row['name'];
+ $data['lang_code'] = $row['lang'];
+ $data['lang'] = $this->languages->code_to_description($row['lang']);
+ $data['paste'] = $this->process->syntax(htmlspecialchars_decode($row['raw']), $row['lang']);
+ $data['created'] = $row['created'];
+ $data['private'] = $row['private'];
+ $data['expire'] = $row['expire'];
+ $data['toexpire'] = $row['toexpire'];
+ $data['url'] = $this->_get_url($row['pid']);
+ $data['raw'] = $row['raw'];
+ $data['hits'] = $row['hits'];
+ $data['hits_updated'] = $row['hits_updated'];
+ $data['snipurl'] = $row['snipurl'];
+ $inreply = $row['replyto'];
+ }
+
+ if ($inreply) {
+ $this->db->select('name, title');
+ $this->db->where('pid', $inreply);
+ $query = $this->db->get('pastes');
+
+ if ($query->num_rows() > 0) {
+ foreach ($query->result_array() as $row) {
+ $data['inreply']['title'] = $row['title'];
+ $data['inreply']['name'] = $row['name'];
+ $data['inreply']['url'] = site_url('view/' . $inreply);
+ }
+ } else {
+ $data['inreply'] = false;
+ }
+
+ if ($diff) {
+ $this->db->select('raw');
+ $this->db->where('pid', $inreply);
+ $query = $this->db->get('pastes');
+
+ if ($query->num_rows() > 0) {
+ foreach ($query->result_array() as $row) {
+
+ //diff
+ //yes, I'm aware, two times htmlspecialchars_decode(). Needs to be, since it's saved that way in the DB from the original stikked author ages ago ;)
+ include_once APPPATH . '/libraries/finediff.php';
+ $from_text = htmlspecialchars_decode(utf8_decode($row['raw']));
+ $to_text = htmlspecialchars_decode(utf8_decode($data['raw']));
+ $opcodes = FineDiff::getDiffOpcodes($from_text, $to_text, FineDiff::$wordGranularity);
+ $to_text = FineDiff::renderToTextFromOpcodes($from_text, $opcodes);
+ $data['paste'] = htmlspecialchars_decode($this->_format_diff(nl2br(FineDiff::renderDiffToHTMLFromOpcodes($from_text, $opcodes))));
+ }
+ } else {
+ $data['inreply'] = false;
+ }
+ }
+ }
+
+ if ($replies) {
+ $amount = $this->config->item('per_page');
+ $page = ($this->uri->segment(3) ? $this->uri->segment(3) : 0);
+ $this->db->select('title, name, created, pid, lang');
+ $this->db->where('replyto', $data['pid']);
+ $this->db->order_by('id', 'desc');
+ $this->db->limit($amount);
+ $query = $this->db->get('pastes', $amount, $page);
+
+ if ($query->num_rows() > 0) {
+ $n = 0;
+ foreach ($query->result_array() as $row) {
+ $data['replies'][$n]['title'] = $row['title'];
+ $data['replies'][$n]['name'] = $row['name'];
+ $data['replies'][$n]['lang'] = $row['lang'];
+ $data['replies'][$n]['created'] = $row['created'];
+ $data['replies'][$n]['pid'] = $row['pid'];
+ $n++;
+ }
+ $config['base_url'] = site_url('view/' . $data['pid']);
+ $config['total_rows'] = $this->countReplies($data['pid']);
+ $config['per_page'] = $amount;
+ $config['num_links'] = 9;
+ $config['full_tag_open'] = '<div class="pages">';
+ $config['full_tag_close'] = '</div>';
+ $config['uri_segment'] = 3;
+ $this->load->library('pagination');
+ $this->pagination->initialize($config);
+ $data['pages'] = $this->pagination->create_links();
+ } else {
+ $replies = false;
+ }
+ }
+
+ /*
+ * Hits
+ * First check if record already exists. If it does, do not insert.
+ * INSERT IGNORE INTO does not work for postgres.
+ */
+ $this->db->select('count(paste_id) as count');
+ $this->db->where('paste_id', $pid);
+ $this->db->where('ip_address', $this->input->ip_address());
+ $query = $this->db->get('trending');
+ $hits_count = $query->result_array();
+ $hits_count = $hits_count[0]['count'];
+
+ if ($hits_count == 0) {
+ $this->db->insert('trending', array(
+ 'paste_id' => $pid,
+ 'ip_address' => $this->input->ip_address(),
+ 'created' => time(),
+ ));
+ }
+
+ //update hits counter every minute
+ if (time() > (60 + $data['hits_updated'])) {
+ $this->calculate_hits($pid, $data['hits']);
+ }
+
+ //burn if necessary
+ if ($data['expire'] == 0 and $data['toexpire'] == 1) {
+ $this->delete_paste($data['pid']);
+ }
+ return $data;
+ }
+
+ public function calculate_hits($pid, $current_hits)
+ {
+ $this->db->select('count(paste_id) as count');
+ $this->db->where('paste_id', $pid);
+ $query = $this->db->get('trending');
+ $hits_count = $query->result_array();
+ $hits_count = $hits_count[0]['count'];
+
+ if ($hits_count != $current_hits) {
+
+ //update
+ $this->db->where('pid', $pid);
+ $this->db->update('pastes', array(
+ 'hits' => $hits_count,
+ 'hits_updated' => time(),
+ ));
+ }
+ }
+
+ public function getReplies($seg = 3)
+ {
+ $amount = $this->config->item('per_page');
+
+ if ($this->uri->segment($seg) == '') {
+ redirect('');
+ } else {
+ $pid = $this->uri->segment($seg);
+ }
+ $this->db->select('title, name, created, pid, raw, lang');
+ $this->db->where('replyto', $pid);
+ $this->db->order_by('id', 'desc');
+ $this->db->limit($amount);
+ $query = $this->db->get('pastes', $amount);
+
+ if ($query->num_rows() > 0) {
+ $n = 0;
+ foreach ($query->result_array() as $row) {
+ $data['replies'][$n]['title'] = $row['title'];
+ $data['replies'][$n]['name'] = $row['name'];
+ $data['replies'][$n]['lang'] = $row['lang'];
+ $data['replies'][$n]['created'] = $row['created'];
+ $data['replies'][$n]['pid'] = $row['pid'];
+
+ if ($this->uri->segment(2) == 'rss') {
+ $data['replies'][$n]['paste'] = $this->process->syntax(htmlspecialchars_decode($row['raw']), $row['lang']);
+ $data['replies'][$n]['raw'] = $row['raw'];
+ }
+ $n++;
+ }
+ }
+ return $data;
+ }
+
+ public function getLists($root = 'lists/', $seg = 2)
+ {
+ $this->load->library('pagination');
+ $this->load->library('process');
+ $amount = $this->config->item('per_page');
+ $page = ($this->uri->segment($seg) ? $this->uri->segment($seg) : 0);
+ $search = $this->input->get('search');
+ $TABLE = $this->config->item('db_prefix') . "pastes";
+
+ if ($search) {
+ $search = '%' . $search . '%';
+
+ // count total results
+ $sql = "SELECT id FROM $TABLE WHERE private = 0 AND (title LIKE ? OR raw LIKE ?)";
+ $query = $this->db->query($sql, array(
+ $search,
+ $search,
+ ));
+ $total_rows = $query->num_rows();
+
+ // query
+ if ($this->db->dbdriver == "postgre") {
+ $sql = "SELECT id, title, name, created, pid, lang, raw FROM $TABLE WHERE private = 0 AND (title LIKE ? OR raw LIKE ?) ORDER BY created DESC LIMIT $amount OFFSET $page";
+ } else if ($root == 'api/recent') {
+ $sql = "SELECT id, title, name, created, pid, lang, raw FROM $TABLE WHERE private = 0 AND (title LIKE ? OR raw LIKE ?) ORDER BY created DESC LIMIT 0,15";
+ } else {
+ $sql = "SELECT id, title, name, created, pid, lang, raw FROM $TABLE WHERE private = 0 AND (title LIKE ? OR raw LIKE ?) ORDER BY created DESC LIMIT $page,$amount";
+ }
+ $query = $this->db->query($sql, array(
+ $search,
+ $search,
+ ));
+ } else {
+
+ // count total results
+ $sql = "SELECT id FROM $TABLE WHERE private = 0";
+ $query = $this->db->query($sql);
+ $total_rows = $query->num_rows();
+
+ // query
+ if ($this->db->dbdriver == "postgre") {
+ $sql = "SELECT id, title, name, created, pid, lang, raw FROM $TABLE WHERE private = 0 ORDER BY created DESC LIMIT $amount OFFSET $page";
+ } else if ($root == 'api/recent') {
+ $sql = "SELECT id, title, name, created, pid, lang, raw FROM $TABLE WHERE private = 0 ORDER BY created DESC LIMIT 0,15";
+ } else {
+ $sql = "SELECT id, title, name, created, pid, lang, raw FROM $TABLE WHERE private = 0 ORDER BY created DESC LIMIT $page,$amount";
+ }
+ $query = $this->db->query($sql);
+ }
+
+ if ($query->num_rows() > 0) {
+ $n = 0;
+ foreach ($query->result_array() as $row) {
+ $data['pastes'][$n]['id'] = $row['id'];
+ $data['pastes'][$n]['title'] = $row['title'];
+ $data['pastes'][$n]['name'] = $row['name'];
+ $data['pastes'][$n]['created'] = $row['created'];
+ $data['pastes'][$n]['lang'] = $this->languages->code_to_description($row['lang']);
+ $data['pastes'][$n]['pid'] = $row['pid'];
+
+ if ($this->uri->segment(2) == 'rss') {
+ $data['pastes'][$n]['paste'] = $this->process->syntax(htmlspecialchars_decode($row['raw']), $row['lang']);
+ }
+ $data['pastes'][$n]['raw'] = $row['raw'];
+ $n++;
+ }
+ }
+ $config['base_url'] = site_url($root);
+ $config['total_rows'] = $total_rows;
+ $config['per_page'] = $amount;
+ $config['num_links'] = 9;
+ $config['full_tag_open'] = '<div class="pages">';
+ $config['full_tag_close'] = '</div>';
+ $config['uri_segment'] = $seg;
+ $searchparams = ($this->input->get('search') ? '?search=' . $this->input->get('search') : '');
+ $config['first_url'] = '0' . $searchparams;
+ $config['suffix'] = $searchparams;
+ $this->pagination->initialize($config);
+ $data['pages'] = $this->pagination->create_links();
+ return $data;
+ }
+
+ public function getTrends($root = 'trends/', $seg = 2)
+ {
+ $this->load->library('pagination');
+ $amount = $this->config->item('per_page');
+ $page = ($this->uri->segment(2) ? $this->uri->segment(2) : 0);
+ $search = $this->input->get('search');
+ $TABLE = $this->config->item('db_prefix') . "pastes";
+
+ if ($search) {
+ $search = '%' . $search . '%';
+
+ // count total results
+ $sql = "SELECT id FROM $TABLE WHERE private = 0 AND (title LIKE ? OR raw LIKE ?)";
+ $query = $this->db->query($sql, array(
+ $search,
+ $search,
+ ));
+ $total_rows = $query->num_rows();
+
+ // query
+ if ($this->db->dbdriver == "postgre") {
+ $sql = "SELECT id, title, name, created, pid, lang, raw, hits FROM $TABLE WHERE private = 0 AND (title LIKE ? OR raw LIKE ?) ORDER BY hits DESC, created DESC LIMIT $amount OFFSET $page";
+ } else if ($root == "api/trending") {
+ $sql = "SELECT id, title, name, created, pid, lang, raw, hits FROM $TABLE WHERE private = 0 AND (title LIKE ? OR raw LIKE ?) ORDER BY hits DESC, created DESC LIMIT 0,15";
+ } else {
+ $sql = "SELECT id, title, name, created, pid, lang, raw, hits FROM $TABLE WHERE private = 0 AND (title LIKE ? OR raw LIKE ?) ORDER BY hits DESC, created DESC LIMIT $page,$amount";
+ }
+ $query = $this->db->query($sql, array(
+ $search,
+ $search,
+ ));
+ } else {
+
+ // count total results
+ $sql = "SELECT id FROM $TABLE WHERE private = 0";
+ $query = $this->db->query($sql);
+ $total_rows = $query->num_rows();
+
+ // query
+ if ($this->db->dbdriver == "postgre") {
+ $sql = "SELECT id, title, name, created, pid, lang, raw, hits FROM $TABLE WHERE private = 0 ORDER BY hits DESC, created DESC LIMIT $amount OFFSET $page";
+ } else if ($root == "api/trending") {
+ $sql = "SELECT id, title, name, created, pid, lang, raw, hits FROM $TABLE WHERE private = 0 ORDER BY hits DESC, created DESC LIMIT 0,15";
+ } else {
+ $sql = "SELECT id, title, name, created, pid, lang, raw, hits FROM $TABLE WHERE private = 0 ORDER BY hits DESC, created DESC LIMIT $page,$amount";
+ }
+ $query = $this->db->query($sql);
+ }
+
+ if ($query->num_rows() > 0) {
+ $n = 0;
+ foreach ($query->result_array() as $row) {
+ $data['pastes'][$n]['id'] = $row['id'];
+ $data['pastes'][$n]['title'] = $row['title'];
+ $data['pastes'][$n]['name'] = $row['name'];
+ $data['pastes'][$n]['created'] = $row['created'];
+ $data['pastes'][$n]['lang'] = $this->languages->code_to_description($row['lang']);
+ $data['pastes'][$n]['pid'] = $row['pid'];
+ $data['pastes'][$n]['raw'] = $row['raw'];
+ $data['pastes'][$n]['hits'] = $row['hits'];
+ $n++;
+ }
+ }
+ $config['base_url'] = site_url($root);
+ $config['total_rows'] = $total_rows;
+ $config['per_page'] = $amount;
+ $config['num_links'] = 9;
+ $config['full_tag_open'] = '<div class="pages">';
+ $config['full_tag_close'] = '</div>';
+ $config['uri_segment'] = $seg;
+ $searchparams = ($this->input->get('search') ? '?search=' . $this->input->get('search') : '');
+ $config['first_url'] = '0' . $searchparams;
+ $config['suffix'] = $searchparams;
+ $this->pagination->initialize($config);
+ $data['pages'] = $this->pagination->create_links();
+ return $data;
+ }
+
+ public function getSpamLists($root = 'spamadmin/', $seg = 2, $ip_address = false)
+ {
+ $this->load->library('pagination');
+ $this->load->library('process');
+ $amount = $this->config->item('per_page');
+ $page = ($this->uri->segment($seg) ? $this->uri->segment($seg) : 0);
+ $this->db->select('id, title, name, created, pid, lang, ip_address');
+ $this->db->where('private', 0);
+
+ if ($ip_address) {
+ $this->db->where('ip_address', $ip_address);
+ }
+ $this->db->order_by('created', 'desc');
+ $query = $this->db->get('pastes', $amount, $page);
+
+ if ($query->num_rows() > 0) {
+ $n = 0;
+ foreach ($query->result_array() as $row) {
+ $data['pastes'][$n]['id'] = $row['id'];
+ $data['pastes'][$n]['title'] = $row['title'];
+ $data['pastes'][$n]['name'] = $row['name'];
+ $data['pastes'][$n]['created'] = $row['created'];
+ $data['pastes'][$n]['lang'] = $row['lang'];
+ $data['pastes'][$n]['pid'] = $row['pid'];
+ $data['pastes'][$n]['ip_address'] = $row['ip_address'];
+ $n++;
+ }
+ }
+
+ //pagination
+ $config['base_url'] = site_url($root);
+ $config['total_rows'] = $this->countPastes($ip_address);
+ $config['per_page'] = $amount;
+ $config['num_links'] = 9;
+ $config['full_tag_open'] = '<div class="pages">';
+ $config['full_tag_close'] = '</div>';
+ $config['uri_segment'] = $seg;
+ $this->pagination->initialize($config);
+ $data['pages'] = $this->pagination->create_links();
+
+ //total spam attempts
+ $this->db->select('SUM(spam_attempts) as sum');
+ $query = $this->db->get('blocked_ips');
+ $q = $query->result_array();
+ $data['total_spam_attempts'] = ($q[0]['sum'] != '' ? $q[0]['sum'] : 0);
+
+ //return
+ return $data;
+ }
+
+ public function cron()
+ {
+ $now = now();
+ $this->db->select('pid,expire');
+ $this->db->where('toexpire', '1');
+ $query = $this->db->get('pastes');
+ foreach ($query->result_array() as $row) {
+ $stamp = $row['expire'];
+
+ if ($now > $stamp and $stamp != 0) {
+ $this->delete_paste($row['pid']);
+ }
+ }
+ return;
+ }
+
+ public function delete_paste($pid)
+ {
+ $this->db->where('pid', $pid);
+ $this->db->delete('pastes');
+
+ // delete from trending
+ $this->db->where('paste_id', $pid);
+ $this->db->delete('trending');
+ return;
+ }
+
+ public function random_paste()
+ {
+ $this->load->library('process');
+ $this->db->order_by('id', 'RANDOM');
+ $this->db->limit(1);
+ $this->db->where('private', '0');
+ $query = $this->db->get('pastes');
+
+ if ($query->num_rows() > 0) {
+ foreach ($query->result_array() as $row) {
+ $data['title'] = $row['title'];
+ $data['pid'] = $row['pid'];
+ $data['name'] = $row['name'];
+ $data['lang_code'] = $row['lang'];
+ $data['lang'] = $this->languages->code_to_description($row['lang']);
+ $data['paste'] = $this->process->syntax(htmlspecialchars_decode($row['raw']), $row['lang']);
+ $data['created'] = $row['created'];
+ $data['url'] = $this->_get_url($row['pid']);
+ $data['raw'] = $row['raw'];
+ $data['hits'] = $row['hits'];
+ $data['hits_updated'] = $row['hits_updated'];
+ $data['snipurl'] = $row['snipurl'];
+ $inreply = $row['replyto'];
+ }
+
+ if ($inreply) {
+ $this->db->select('name, title');
+ $this->db->where('pid', $inreply);
+ $query = $this->db->get('pastes');
+
+ if ($query->num_rows() > 0) {
+ foreach ($query->result_array() as $row) {
+ $data['inreply']['title'] = $row['title'];
+ $data['inreply']['name'] = $row['name'];
+ $data['inreply']['url'] = site_url('view/' . $inreply);
+ }
+ } else {
+ $data['inreply'] = false;
+ }
+ }
+ return $data;
+ }
+ return false;
+ }
+
+ private function _format_diff($text)
+ {
+ $text = str_replace("\t", '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;', $text);
+ $text = str_replace("<br />", '<br/>', $text);
+ $text = str_replace(" ", '&nbsp;', $text);
+ $text = '<div class="text" style="font-family:monospace; font: normal normal 1em/1.2em monospace;">' . $text . '</div>';
+ return $text;
+ }
+
+ private function _strip_bad_multibyte_chars($str)
+ {
+ $result = '';
+ $length = strlen($str);
+ for ($i = 0; $i < $length; $i++) {
+
+ // Replace four-byte characters (11110www 10zzzzzz 10yyyyyy 10xxxxxx)
+ $ord = ord($str[$i]);
+
+ if ($ord >= 240 && $ord <= 244) {
+ $result .= '?';
+ $i += 3;
+ } else {
+ $result .= $str[$i];
+ }
+ }
+ return $result;
+ }
}
diff --git a/htdocs/index.php b/htdocs/index.php
index 3e75f0a..924d557 100644
--- a/htdocs/index.php
+++ b/htdocs/index.php
@@ -26,13 +26,13 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
- * @package CodeIgniter
- * @author EllisLab Dev Team
- * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
- * @copyright Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http://bcit.ca/)
- * @license http://opensource.org/licenses/MIT MIT License
- * @link https://codeigniter.com
- * @since Version 1.0.0
+ * @package CodeIgniter
+ * @author EllisLab Dev Team
+ * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
+ * @copyright Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http://bcit.ca/)
+ * @license http://opensource.org/licenses/MIT MIT License
+ * @link https://codeigniter.com
+ * @since Version 1.0.0
* @filesource
*/
@@ -53,7 +53,7 @@
*
* NOTE: If you change these, also change the error_reporting() code below
*/
- define('ENVIRONMENT', isset($_SERVER['CI_ENV']) ? $_SERVER['CI_ENV'] : 'development');
+define('ENVIRONMENT', isset($_SERVER['CI_ENV']) ? $_SERVER['CI_ENV'] : 'development');
/*
*---------------------------------------------------------------
@@ -63,30 +63,26 @@
* Different environments will require different levels of error reporting.
* By default development will show errors but testing and live will hide them.
*/
-switch (ENVIRONMENT)
-{
- case 'development':
- error_reporting(-1);
- ini_set('display_errors', 1);
- break;
+switch (ENVIRONMENT) {
+ case 'development':
+ error_reporting(-1);
+ ini_set('display_errors', 1);
+ break;
- case 'testing':
- case 'production':
- ini_set('display_errors', 0);
- if (version_compare(PHP_VERSION, '5.3', '>='))
- {
- error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED);
- }
- else
- {
- error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_USER_NOTICE);
- }
- break;
+ case 'testing':
+ case 'production':
+ ini_set('display_errors', 0);
+ if (version_compare(PHP_VERSION, '5.3', '>=')) {
+ error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED);
+ } else {
+ error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_USER_NOTICE);
+ }
+ break;
- default:
- header('HTTP/1.1 503 Service Unavailable.', TRUE, 503);
- echo 'The application environment is not set correctly.';
- exit(1); // EXIT_ERROR
+ default:
+ header('HTTP/1.1 503 Service Unavailable.', true, 503);
+ echo 'The application environment is not set correctly.';
+ exit(1); // EXIT_ERROR
}
/*
@@ -97,7 +93,7 @@ switch (ENVIRONMENT)
* This variable must contain the name of your "system" directory.
* Set the path if it is not in the same directory as this file.
*/
- $system_path = 'system';
+$system_path = 'system';
/*
*---------------------------------------------------------------
@@ -114,7 +110,7 @@ switch (ENVIRONMENT)
*
* NO TRAILING SLASH!
*/
- $application_folder = 'application';
+$application_folder = 'application';
/*
*---------------------------------------------------------------
@@ -129,8 +125,7 @@ switch (ENVIRONMENT)
*
* NO TRAILING SLASH!
*/
- $view_folder = 'themes/default/views';
-
+$view_folder = 'themes/default/views';
/*
* --------------------------------------------------------------------
@@ -151,16 +146,15 @@ switch (ENVIRONMENT)
*
* Un-comment the $routing array below to use this feature
*/
- // The directory name, relative to the "controllers" directory. Leave blank
- // if your controller is not in a sub-directory within the "controllers" one
- // $routing['directory'] = '';
-
- // The controller class file name. Example: mycontroller
- // $routing['controller'] = '';
+// The directory name, relative to the "controllers" directory. Leave blank
+// if your controller is not in a sub-directory within the "controllers" one
+// $routing['directory'] = '';
- // The controller function you wish to be called.
- // $routing['function'] = '';
+// The controller class file name. Example: mycontroller
+// $routing['controller'] = '';
+// The controller function you wish to be called.
+// $routing['function'] = '';
/*
* -------------------------------------------------------------------
@@ -176,9 +170,7 @@ switch (ENVIRONMENT)
*
* Un-comment the $assign_to_config array below to use this feature
*/
- // $assign_to_config['name_of_config_item'] = 'value of config item';
-
-
+// $assign_to_config['name_of_config_item'] = 'value of config item';
// --------------------------------------------------------------------
// END OF USER CONFIGURABLE SETTINGS. DO NOT EDIT BELOW THIS LINE
@@ -190,120 +182,97 @@ switch (ENVIRONMENT)
* ---------------------------------------------------------------
*/
- // Set the current directory correctly for CLI requests
- if (defined('STDIN'))
- {
- chdir(dirname(__FILE__));
- }
+// Set the current directory correctly for CLI requests
+if (defined('STDIN')) {
+ chdir(dirname(__FILE__));
+}
- if (($_temp = realpath($system_path)) !== FALSE)
- {
- $system_path = $_temp.DIRECTORY_SEPARATOR;
- }
- else
- {
- // Ensure there's a trailing slash
- $system_path = strtr(
- rtrim($system_path, '/\\'),
- '/\\',
- DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR
- ).DIRECTORY_SEPARATOR;
- }
+if (($_temp = realpath($system_path)) !== false) {
+ $system_path = $_temp . DIRECTORY_SEPARATOR;
+} else {
+ // Ensure there's a trailing slash
+ $system_path = strtr(
+ rtrim($system_path, '/\\'),
+ '/\\',
+ DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR
+ ) . DIRECTORY_SEPARATOR;
+}
- // Is the system path correct?
- if ( ! is_dir($system_path))
- {
- header('HTTP/1.1 503 Service Unavailable.', TRUE, 503);
- echo 'Your system folder path does not appear to be set correctly. Please open the following file and correct this: '.pathinfo(__FILE__, PATHINFO_BASENAME);
- exit(3); // EXIT_CONFIG
- }
+// Is the system path correct?
+if (!is_dir($system_path)) {
+ header('HTTP/1.1 503 Service Unavailable.', true, 503);
+ echo 'Your system folder path does not appear to be set correctly. Please open the following file and correct this: ' . pathinfo(__FILE__, PATHINFO_BASENAME);
+ exit(3); // EXIT_CONFIG
+}
/*
* -------------------------------------------------------------------
* Now that we know the path, set the main path constants
* -------------------------------------------------------------------
*/
- // The name of THIS file
- define('SELF', pathinfo(__FILE__, PATHINFO_BASENAME));
+// The name of THIS file
+define('SELF', pathinfo(__FILE__, PATHINFO_BASENAME));
- // Path to the system directory
- define('BASEPATH', $system_path);
+// Path to the system directory
+define('BASEPATH', $system_path);
- // Path to the front controller (this file) directory
- define('FCPATH', dirname(__FILE__).DIRECTORY_SEPARATOR);
+// Path to the front controller (this file) directory
+define('FCPATH', dirname(__FILE__) . DIRECTORY_SEPARATOR);
- // Name of the "system" directory
- define('SYSDIR', basename(BASEPATH));
+// Name of the "system" directory
+define('SYSDIR', basename(BASEPATH));
- // The path to the "application" directory
- if (is_dir($application_folder))
- {
- if (($_temp = realpath($application_folder)) !== FALSE)
- {
- $application_folder = $_temp;
- }
- else
- {
- $application_folder = strtr(
- rtrim($application_folder, '/\\'),
- '/\\',
- DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR
- );
- }
- }
- elseif (is_dir(BASEPATH.$application_folder.DIRECTORY_SEPARATOR))
- {
- $application_folder = BASEPATH.strtr(
- trim($application_folder, '/\\'),
- '/\\',
- DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR
- );
- }
- else
- {
- header('HTTP/1.1 503 Service Unavailable.', TRUE, 503);
- echo 'Your application folder path does not appear to be set correctly. Please open the following file and correct this: '.SELF;
- exit(3); // EXIT_CONFIG
- }
+// The path to the "application" directory
+if (is_dir($application_folder)) {
+ if (($_temp = realpath($application_folder)) !== false) {
+ $application_folder = $_temp;
+ } else {
+ $application_folder = strtr(
+ rtrim($application_folder, '/\\'),
+ '/\\',
+ DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR
+ );
+ }
+} elseif (is_dir(BASEPATH . $application_folder . DIRECTORY_SEPARATOR)) {
+ $application_folder = BASEPATH . strtr(
+ trim($application_folder, '/\\'),
+ '/\\',
+ DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR
+ );
+} else {
+ header('HTTP/1.1 503 Service Unavailable.', true, 503);
+ echo 'Your application folder path does not appear to be set correctly. Please open the following file and correct this: ' . SELF;
+ exit(3); // EXIT_CONFIG
+}
- define('APPPATH', $application_folder.DIRECTORY_SEPARATOR);
+define('APPPATH', $application_folder . DIRECTORY_SEPARATOR);
- // The path to the "views" directory
- if ( ! isset($view_folder[0]) && is_dir(APPPATH.'views'.DIRECTORY_SEPARATOR))
- {
- $view_folder = APPPATH.'views';
- }
- elseif (is_dir($view_folder))
- {
- if (($_temp = realpath($view_folder)) !== FALSE)
- {
- $view_folder = $_temp;
- }
- else
- {
- $view_folder = strtr(
- rtrim($view_folder, '/\\'),
- '/\\',
- DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR
- );
- }
- }
- elseif (is_dir(APPPATH.$view_folder.DIRECTORY_SEPARATOR))
- {
- $view_folder = APPPATH.strtr(
- trim($view_folder, '/\\'),
- '/\\',
- DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR
- );
- }
- else
- {
- header('HTTP/1.1 503 Service Unavailable.', TRUE, 503);
- echo 'Your view folder path does not appear to be set correctly. Please open the following file and correct this: '.SELF;
- exit(3); // EXIT_CONFIG
- }
+// The path to the "views" directory
+if (!isset($view_folder[0]) && is_dir(APPPATH . 'views' . DIRECTORY_SEPARATOR)) {
+ $view_folder = APPPATH . 'views';
+} elseif (is_dir($view_folder)) {
+ if (($_temp = realpath($view_folder)) !== false) {
+ $view_folder = $_temp;
+ } else {
+ $view_folder = strtr(
+ rtrim($view_folder, '/\\'),
+ '/\\',
+ DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR
+ );
+ }
+} elseif (is_dir(APPPATH . $view_folder . DIRECTORY_SEPARATOR)) {
+ $view_folder = APPPATH . strtr(
+ trim($view_folder, '/\\'),
+ '/\\',
+ DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR
+ );
+} else {
+ header('HTTP/1.1 503 Service Unavailable.', true, 503);
+ echo 'Your view folder path does not appear to be set correctly. Please open the following file and correct this: ' . SELF;
+ exit(3); // EXIT_CONFIG
+}
- define('VIEWPATH', $view_folder.DIRECTORY_SEPARATOR);
+define('VIEWPATH', $view_folder . DIRECTORY_SEPARATOR);
/*
* --------------------------------------------------------------------
@@ -312,4 +281,4 @@ switch (ENVIRONMENT)
*
* And away we go...
*/
-require_once BASEPATH.'core/CodeIgniter.php';
+require_once BASEPATH . 'core/CodeIgniter.php';

© 2014-2024 Faster IT GmbH | imprint | privacy policy