mirror of
https://github.com/claudehohl/Stikked.git
synced 2025-04-25 20:41:20 -05:00
apply new code formatter
phpfmt using PSR-2 coding style
This commit is contained in:
parent
c687068fd4
commit
26cd691cea
@ -2,9 +2,5 @@ You want to improve Stikked? Always welcome! Send us your pull request and you w
|
|||||||
|
|
||||||
Some guidelines:
|
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:
|
* Coding style: PSR-2. For PHP files (not views/themes), please run phpfmt (https://marketplace.visualstudio.com/items?itemName=kokororin.vscode-phpfmt).
|
||||||
```
|
|
||||||
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
|
|
||||||
* Other people may modify your contribution. Don't take that personal; we all want to improve Stikked. Your input is always welcome!
|
* Other people may modify your contribution. Don't take that personal; we all want to improve Stikked. Your input is always welcome!
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
|
<?php if (!defined('BASEPATH')) {
|
||||||
|
exit('No direct script access allowed');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Site Name
|
* Site Name
|
||||||
@ -159,7 +161,6 @@ $config['cron_key'] = '';
|
|||||||
$config['url_shortening_use'] = 'off';
|
$config['url_shortening_use'] = 'off';
|
||||||
$config['random_url_engines'] = 'googl,bitly'; // Used only in random mode, read comment above for more info
|
$config['random_url_engines'] = 'googl,bitly'; // Used only in random mode, read comment above for more info
|
||||||
|
|
||||||
|
|
||||||
// Yourls
|
// Yourls
|
||||||
$config['yourls_url'] = '';
|
$config['yourls_url'] = '';
|
||||||
$config['yourls_signature'] = '';
|
$config['yourls_signature'] = '';
|
||||||
@ -178,7 +179,6 @@ $config['bitly_url_api'] = '';
|
|||||||
$config['polr_url'] = '';
|
$config['polr_url'] = '';
|
||||||
$config['polr_api'] = '';
|
$config['polr_api'] = '';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Credentials for the backup URL
|
* Credentials for the backup URL
|
||||||
*
|
*
|
||||||
|
@ -1,11 +1,6 @@
|
|||||||
<?php
|
<?php if (!defined('BASEPATH')) {
|
||||||
/**
|
exit('No direct script access allowed');
|
||||||
* Class and Function List:
|
}
|
||||||
* Function list:
|
|
||||||
* Classes list:
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (!defined('BASEPATH')) exit('No direct script access allowed');
|
|
||||||
|
|
||||||
//codemirror languages
|
//codemirror languages
|
||||||
$config['ace_languages'] = array(
|
$config['ace_languages'] = array(
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
<?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.
|
* This file is part of Auth_Ldap.
|
||||||
|
|
||||||
@ -56,4 +59,3 @@ $config['roles'] = array(1 => 'User',
|
|||||||
5 => 'Administrator');
|
5 => 'Administrator');
|
||||||
$config['member_attribute'] = 'memberUid';
|
$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)
|
||||||
?>
|
|
||||||
|
@ -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
|
| AUTO-LOADER
|
||||||
@ -39,7 +42,6 @@
|
|||||||
|
|
||||||
$autoload['packages'] = array();
|
$autoload['packages'] = array();
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
| -------------------------------------------------------------------
|
| -------------------------------------------------------------------
|
||||||
| Auto-load Libraries
|
| Auto-load Libraries
|
||||||
@ -54,7 +56,6 @@ $autoload['packages'] = array();
|
|||||||
|
|
||||||
$autoload['libraries'] = array('database', 'carabiner');
|
$autoload['libraries'] = array('database', 'carabiner');
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
| -------------------------------------------------------------------
|
| -------------------------------------------------------------------
|
||||||
| Auto-load Helper Files
|
| Auto-load Helper Files
|
||||||
@ -66,7 +67,6 @@ $autoload['libraries'] = array('database', 'carabiner');
|
|||||||
|
|
||||||
$autoload['helper'] = array('url', 'date', 'language');
|
$autoload['helper'] = array('url', 'date', 'language');
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
| -------------------------------------------------------------------
|
| -------------------------------------------------------------------
|
||||||
| Auto-load Config files
|
| Auto-load Config files
|
||||||
@ -82,7 +82,6 @@ $autoload['helper'] = array('url', 'date', 'language');
|
|||||||
|
|
||||||
$autoload['config'] = array('stikked');
|
$autoload['config'] = array('stikked');
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
| -------------------------------------------------------------------
|
| -------------------------------------------------------------------
|
||||||
| Auto-load Language files
|
| Auto-load Language files
|
||||||
@ -98,7 +97,6 @@ $autoload['config'] = array('stikked');
|
|||||||
|
|
||||||
$autoload['language'] = array('stikked');
|
$autoload['language'] = array('stikked');
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
| -------------------------------------------------------------------
|
| -------------------------------------------------------------------
|
||||||
| Auto-load Models
|
| Auto-load Models
|
||||||
@ -111,6 +109,5 @@ $autoload['language'] = array('stikked');
|
|||||||
|
|
||||||
$autoload['model'] = array();
|
$autoload['model'] = array();
|
||||||
|
|
||||||
|
|
||||||
/* End of file autoload.php */
|
/* End of file autoload.php */
|
||||||
/* Location: ./application/config/autoload.php */
|
/* Location: ./application/config/autoload.php */
|
||||||
|
@ -1,11 +1,6 @@
|
|||||||
<?php
|
<?php if (!defined('BASEPATH')) {
|
||||||
/**
|
exit('No direct script access allowed');
|
||||||
* Class and Function List:
|
}
|
||||||
* Function list:
|
|
||||||
* Classes list:
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (!defined('BASEPATH')) exit('No direct script access allowed');
|
|
||||||
|
|
||||||
//codemirror languages
|
//codemirror languages
|
||||||
$config['codemirror_languages'] = array(
|
$config['codemirror_languages'] = array(
|
||||||
@ -13,16 +8,16 @@ $config['codemirror_languages'] = array(
|
|||||||
'mode' => 'htmlmixed',
|
'mode' => 'htmlmixed',
|
||||||
'js' => array(
|
'js' => array(
|
||||||
array(
|
array(
|
||||||
'codemirror/mode/xml/xml.js'
|
'codemirror/mode/xml/xml.js',
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'codemirror/mode/javascript/javascript.js'
|
'codemirror/mode/javascript/javascript.js',
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'codemirror/mode/css/css.js'
|
'codemirror/mode/css/css.js',
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'codemirror/mode/htmlmixed/htmlmixed.js'
|
'codemirror/mode/htmlmixed/htmlmixed.js',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -30,7 +25,7 @@ $config['codemirror_languages'] = array(
|
|||||||
'mode' => 'css',
|
'mode' => 'css',
|
||||||
'js' => array(
|
'js' => array(
|
||||||
array(
|
array(
|
||||||
'codemirror/mode/css/css.js'
|
'codemirror/mode/css/css.js',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -38,7 +33,7 @@ $config['codemirror_languages'] = array(
|
|||||||
'mode' => 'javascript',
|
'mode' => 'javascript',
|
||||||
'js' => array(
|
'js' => array(
|
||||||
array(
|
array(
|
||||||
'codemirror/mode/javascript/javascript.js'
|
'codemirror/mode/javascript/javascript.js',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -46,19 +41,19 @@ $config['codemirror_languages'] = array(
|
|||||||
'mode' => 'php',
|
'mode' => 'php',
|
||||||
'js' => array(
|
'js' => array(
|
||||||
array(
|
array(
|
||||||
'codemirror/mode/xml/xml.js'
|
'codemirror/mode/xml/xml.js',
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'codemirror/mode/javascript/javascript.js'
|
'codemirror/mode/javascript/javascript.js',
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'codemirror/mode/css/css.js'
|
'codemirror/mode/css/css.js',
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'codemirror/mode/clike/clike.js'
|
'codemirror/mode/clike/clike.js',
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'codemirror/mode/php/php.js'
|
'codemirror/mode/php/php.js',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -66,7 +61,7 @@ $config['codemirror_languages'] = array(
|
|||||||
'mode' => 'python',
|
'mode' => 'python',
|
||||||
'js' => array(
|
'js' => array(
|
||||||
array(
|
array(
|
||||||
'codemirror/mode/python/python.js'
|
'codemirror/mode/python/python.js',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -74,7 +69,7 @@ $config['codemirror_languages'] = array(
|
|||||||
'mode' => 'ruby',
|
'mode' => 'ruby',
|
||||||
'js' => array(
|
'js' => array(
|
||||||
array(
|
array(
|
||||||
'codemirror/mode/ruby/ruby.js'
|
'codemirror/mode/ruby/ruby.js',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -82,7 +77,7 @@ $config['codemirror_languages'] = array(
|
|||||||
'mode' => 'text/x-lua',
|
'mode' => 'text/x-lua',
|
||||||
'js' => array(
|
'js' => array(
|
||||||
array(
|
array(
|
||||||
'codemirror/mode/lua/lua.js'
|
'codemirror/mode/lua/lua.js',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -90,7 +85,7 @@ $config['codemirror_languages'] = array(
|
|||||||
'mode' => 'text/x-sh',
|
'mode' => 'text/x-sh',
|
||||||
'js' => array(
|
'js' => array(
|
||||||
array(
|
array(
|
||||||
'codemirror/mode/shell/shell.js'
|
'codemirror/mode/shell/shell.js',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -98,7 +93,7 @@ $config['codemirror_languages'] = array(
|
|||||||
'mode' => 'text/x-go',
|
'mode' => 'text/x-go',
|
||||||
'js' => array(
|
'js' => array(
|
||||||
array(
|
array(
|
||||||
'codemirror/mode/go/go.js'
|
'codemirror/mode/go/go.js',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -106,7 +101,7 @@ $config['codemirror_languages'] = array(
|
|||||||
'mode' => 'text/x-csrc',
|
'mode' => 'text/x-csrc',
|
||||||
'js' => array(
|
'js' => array(
|
||||||
array(
|
array(
|
||||||
'codemirror/mode/clike/clike.js'
|
'codemirror/mode/clike/clike.js',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -114,7 +109,7 @@ $config['codemirror_languages'] = array(
|
|||||||
'mode' => 'text/x-c++src',
|
'mode' => 'text/x-c++src',
|
||||||
'js' => array(
|
'js' => array(
|
||||||
array(
|
array(
|
||||||
'codemirror/mode/clike/clike.js'
|
'codemirror/mode/clike/clike.js',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -122,7 +117,7 @@ $config['codemirror_languages'] = array(
|
|||||||
'mode' => 'diff',
|
'mode' => 'diff',
|
||||||
'js' => array(
|
'js' => array(
|
||||||
array(
|
array(
|
||||||
'codemirror/mode/diff/diff.js'
|
'codemirror/mode/diff/diff.js',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -130,7 +125,7 @@ $config['codemirror_languages'] = array(
|
|||||||
'mode' => 'stex',
|
'mode' => 'stex',
|
||||||
'js' => array(
|
'js' => array(
|
||||||
array(
|
array(
|
||||||
'codemirror/mode/stex/stex.js'
|
'codemirror/mode/stex/stex.js',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -138,7 +133,7 @@ $config['codemirror_languages'] = array(
|
|||||||
'mode' => 'sql',
|
'mode' => 'sql',
|
||||||
'js' => array(
|
'js' => array(
|
||||||
array(
|
array(
|
||||||
'codemirror/mode/sql/sql.js'
|
'codemirror/mode/sql/sql.js',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -146,7 +141,7 @@ $config['codemirror_languages'] = array(
|
|||||||
'mode' => 'xml',
|
'mode' => 'xml',
|
||||||
'js' => array(
|
'js' => array(
|
||||||
array(
|
array(
|
||||||
'codemirror/mode/xml/xml.js'
|
'codemirror/mode/xml/xml.js',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -161,7 +156,7 @@ $config['codemirror_languages'] = array(
|
|||||||
'mode' => 'apl',
|
'mode' => 'apl',
|
||||||
'js' => array(
|
'js' => array(
|
||||||
array(
|
array(
|
||||||
'codemirror/mode/apl/apl.js'
|
'codemirror/mode/apl/apl.js',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -169,7 +164,7 @@ $config['codemirror_languages'] = array(
|
|||||||
'mode' => 'asterisk',
|
'mode' => 'asterisk',
|
||||||
'js' => array(
|
'js' => array(
|
||||||
array(
|
array(
|
||||||
'codemirror/mode/asterisk/asterisk.js'
|
'codemirror/mode/asterisk/asterisk.js',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -198,7 +193,7 @@ $config['codemirror_languages'] = array(
|
|||||||
'mode' => 'text/x-csrc',
|
'mode' => 'text/x-csrc',
|
||||||
'js' => array(
|
'js' => array(
|
||||||
array(
|
array(
|
||||||
'codemirror/mode/clike/clike.js'
|
'codemirror/mode/clike/clike.js',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -206,7 +201,7 @@ $config['codemirror_languages'] = array(
|
|||||||
'mode' => 'text/x-csrc',
|
'mode' => 'text/x-csrc',
|
||||||
'js' => array(
|
'js' => array(
|
||||||
array(
|
array(
|
||||||
'codemirror/mode/clike/clike.js'
|
'codemirror/mode/clike/clike.js',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -224,7 +219,7 @@ $config['codemirror_languages'] = array(
|
|||||||
'mode' => 'text/x-coffeescript',
|
'mode' => 'text/x-coffeescript',
|
||||||
'js' => array(
|
'js' => array(
|
||||||
array(
|
array(
|
||||||
'codemirror/mode/coffeescript/coffeescript.js'
|
'codemirror/mode/coffeescript/coffeescript.js',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -232,7 +227,7 @@ $config['codemirror_languages'] = array(
|
|||||||
'mode' => 'text/x-csharp',
|
'mode' => 'text/x-csharp',
|
||||||
'js' => array(
|
'js' => array(
|
||||||
array(
|
array(
|
||||||
'codemirror/mode/clike/clike.js'
|
'codemirror/mode/clike/clike.js',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -241,7 +236,7 @@ $config['codemirror_languages'] = array(
|
|||||||
'mode' => 'd',
|
'mode' => 'd',
|
||||||
'js' => array(
|
'js' => array(
|
||||||
array(
|
array(
|
||||||
'codemirror/mode/d/d.js'
|
'codemirror/mode/d/d.js',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -255,7 +250,7 @@ $config['codemirror_languages'] = array(
|
|||||||
'mode' => 'javascript',
|
'mode' => 'javascript',
|
||||||
'js' => array(
|
'js' => array(
|
||||||
array(
|
array(
|
||||||
'codemirror/mode/javascript/javascript.js'
|
'codemirror/mode/javascript/javascript.js',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -266,7 +261,7 @@ $config['codemirror_languages'] = array(
|
|||||||
'mode' => 'erlang',
|
'mode' => 'erlang',
|
||||||
'js' => array(
|
'js' => array(
|
||||||
array(
|
array(
|
||||||
'codemirror/mode/erlang/erlang.js'
|
'codemirror/mode/erlang/erlang.js',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -289,7 +284,7 @@ $config['codemirror_languages'] = array(
|
|||||||
'mode' => 'go',
|
'mode' => 'go',
|
||||||
'js' => array(
|
'js' => array(
|
||||||
array(
|
array(
|
||||||
'codemirror/mode/go/go.js'
|
'codemirror/mode/go/go.js',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -297,7 +292,7 @@ $config['codemirror_languages'] = array(
|
|||||||
'mode' => 'text/x-groovy',
|
'mode' => 'text/x-groovy',
|
||||||
'js' => array(
|
'js' => array(
|
||||||
array(
|
array(
|
||||||
'codemirror/mode/groovy/groovy.js'
|
'codemirror/mode/groovy/groovy.js',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -306,7 +301,7 @@ $config['codemirror_languages'] = array(
|
|||||||
'mode' => 'text/x-haskell',
|
'mode' => 'text/x-haskell',
|
||||||
'js' => array(
|
'js' => array(
|
||||||
array(
|
array(
|
||||||
'codemirror/mode/haskell/haskell.js'
|
'codemirror/mode/haskell/haskell.js',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -314,7 +309,7 @@ $config['codemirror_languages'] = array(
|
|||||||
'mode' => 'text/x-haxe',
|
'mode' => 'text/x-haxe',
|
||||||
'js' => array(
|
'js' => array(
|
||||||
array(
|
array(
|
||||||
'codemirror/mode/haxe/haxe.js'
|
'codemirror/mode/haxe/haxe.js',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -324,16 +319,16 @@ $config['codemirror_languages'] = array(
|
|||||||
'mode' => 'htmlmixed',
|
'mode' => 'htmlmixed',
|
||||||
'js' => array(
|
'js' => array(
|
||||||
array(
|
array(
|
||||||
'codemirror/mode/xml/xml.js'
|
'codemirror/mode/xml/xml.js',
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'codemirror/mode/javascript/javascript.js'
|
'codemirror/mode/javascript/javascript.js',
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'codemirror/mode/css/css.js'
|
'codemirror/mode/css/css.js',
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'codemirror/mode/htmlmixed/htmlmixed.js'
|
'codemirror/mode/htmlmixed/htmlmixed.js',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -348,7 +343,7 @@ $config['codemirror_languages'] = array(
|
|||||||
'mode' => 'text/x-java',
|
'mode' => 'text/x-java',
|
||||||
'js' => array(
|
'js' => array(
|
||||||
array(
|
array(
|
||||||
'codemirror/mode/clike/clike.js'
|
'codemirror/mode/clike/clike.js',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -356,7 +351,7 @@ $config['codemirror_languages'] = array(
|
|||||||
'mode' => 'text/x-java',
|
'mode' => 'text/x-java',
|
||||||
'js' => array(
|
'js' => array(
|
||||||
array(
|
array(
|
||||||
'codemirror/mode/clike/clike.js'
|
'codemirror/mode/clike/clike.js',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -364,7 +359,7 @@ $config['codemirror_languages'] = array(
|
|||||||
'mode' => 'javascript',
|
'mode' => 'javascript',
|
||||||
'js' => array(
|
'js' => array(
|
||||||
array(
|
array(
|
||||||
'codemirror/mode/javascript/javascript.js'
|
'codemirror/mode/javascript/javascript.js',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -391,7 +386,7 @@ $config['codemirror_languages'] = array(
|
|||||||
'mode' => 'mirc',
|
'mode' => 'mirc',
|
||||||
'js' => array(
|
'js' => array(
|
||||||
array(
|
array(
|
||||||
'codemirror/mode/mirc/mirc.js'
|
'codemirror/mode/mirc/mirc.js',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -404,7 +399,7 @@ $config['codemirror_languages'] = array(
|
|||||||
'mode' => 'sql',
|
'mode' => 'sql',
|
||||||
'js' => array(
|
'js' => array(
|
||||||
array(
|
array(
|
||||||
'codemirror/mode/sql/sql.js'
|
'codemirror/mode/sql/sql.js',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -418,7 +413,7 @@ $config['codemirror_languages'] = array(
|
|||||||
'mode' => 'text/x-ocaml',
|
'mode' => 'text/x-ocaml',
|
||||||
'js' => array(
|
'js' => array(
|
||||||
array(
|
array(
|
||||||
'codemirror/mode/ocaml/ocaml.js'
|
'codemirror/mode/ocaml/ocaml.js',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -431,7 +426,7 @@ $config['codemirror_languages'] = array(
|
|||||||
'mode' => 'text/x-pascal',
|
'mode' => 'text/x-pascal',
|
||||||
'js' => array(
|
'js' => array(
|
||||||
array(
|
array(
|
||||||
'codemirror/mode/pascal/pascal.js'
|
'codemirror/mode/pascal/pascal.js',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -441,7 +436,7 @@ $config['codemirror_languages'] = array(
|
|||||||
'mode' => 'perl',
|
'mode' => 'perl',
|
||||||
'js' => array(
|
'js' => array(
|
||||||
array(
|
array(
|
||||||
'codemirror/mode/perl/perl.js'
|
'codemirror/mode/perl/perl.js',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -449,7 +444,7 @@ $config['codemirror_languages'] = array(
|
|||||||
'mode' => 'perl',
|
'mode' => 'perl',
|
||||||
'js' => array(
|
'js' => array(
|
||||||
array(
|
array(
|
||||||
'codemirror/mode/perl/perl.js'
|
'codemirror/mode/perl/perl.js',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -462,7 +457,7 @@ $config['codemirror_languages'] = array(
|
|||||||
'mode' => 'sql',
|
'mode' => 'sql',
|
||||||
'js' => array(
|
'js' => array(
|
||||||
array(
|
array(
|
||||||
'codemirror/mode/sql/sql.js'
|
'codemirror/mode/sql/sql.js',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -477,7 +472,7 @@ $config['codemirror_languages'] = array(
|
|||||||
'mode' => 'text/x-properties',
|
'mode' => 'text/x-properties',
|
||||||
'js' => array(
|
'js' => array(
|
||||||
array(
|
array(
|
||||||
'codemirror/mode/properties/properties.js'
|
'codemirror/mode/properties/properties.js',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -487,7 +482,7 @@ $config['codemirror_languages'] = array(
|
|||||||
'mode' => 'text/x-q',
|
'mode' => 'text/x-q',
|
||||||
'js' => array(
|
'js' => array(
|
||||||
array(
|
array(
|
||||||
'codemirror/mode/q/q.js'
|
'codemirror/mode/q/q.js',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -503,7 +498,7 @@ $config['codemirror_languages'] = array(
|
|||||||
'mode' => 'scala',
|
'mode' => 'scala',
|
||||||
'js' => array(
|
'js' => array(
|
||||||
array(
|
array(
|
||||||
'codemirror/mode/clike/clike.js'
|
'codemirror/mode/clike/clike.js',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -511,7 +506,7 @@ $config['codemirror_languages'] = array(
|
|||||||
'mode' => 'text/x-scheme',
|
'mode' => 'text/x-scheme',
|
||||||
'js' => array(
|
'js' => array(
|
||||||
array(
|
array(
|
||||||
'codemirror/mode/scheme/scheme.js'
|
'codemirror/mode/scheme/scheme.js',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -524,7 +519,7 @@ $config['codemirror_languages'] = array(
|
|||||||
'mode' => 'text/x-tcl',
|
'mode' => 'text/x-tcl',
|
||||||
'js' => array(
|
'js' => array(
|
||||||
array(
|
array(
|
||||||
'codemirror/mode/tcl/tcl.js'
|
'codemirror/mode/tcl/tcl.js',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -539,7 +534,7 @@ $config['codemirror_languages'] = array(
|
|||||||
'mode' => 'text/x-vb',
|
'mode' => 'text/x-vb',
|
||||||
'js' => array(
|
'js' => array(
|
||||||
array(
|
array(
|
||||||
'codemirror/mode/vb/vb.js'
|
'codemirror/mode/vb/vb.js',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -547,7 +542,7 @@ $config['codemirror_languages'] = array(
|
|||||||
'mode' => 'text/x-verilog',
|
'mode' => 'text/x-verilog',
|
||||||
'js' => array(
|
'js' => array(
|
||||||
array(
|
array(
|
||||||
'codemirror/mode/verilog/verilog.js'
|
'codemirror/mode/verilog/verilog.js',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -565,7 +560,7 @@ $config['codemirror_languages'] = array(
|
|||||||
'mode' => 'text/x-yaml',
|
'mode' => 'text/x-yaml',
|
||||||
'js' => array(
|
'js' => array(
|
||||||
array(
|
array(
|
||||||
'codemirror/mode/yaml/yaml.js'
|
'codemirror/mode/yaml/yaml.js',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -573,7 +568,7 @@ $config['codemirror_languages'] = array(
|
|||||||
'mode' => 'text/x-z80',
|
'mode' => 'text/x-z80',
|
||||||
'js' => array(
|
'js' => array(
|
||||||
array(
|
array(
|
||||||
'codemirror/mode/z80/z80.js'
|
'codemirror/mode/z80/z80.js',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
<?php if (!defined('BASEPATH')) {
|
||||||
|
exit('No direct script access allowed');
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
@ -101,8 +103,7 @@ $config['charset'] = 'UTF-8';
|
|||||||
| setting this variable to TRUE (boolean). See the user guide for details.
|
| setting this variable to TRUE (boolean). See the user guide for details.
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
$config['enable_hooks'] = FALSE;
|
$config['enable_hooks'] = false;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
@ -118,7 +119,6 @@ $config['enable_hooks'] = FALSE;
|
|||||||
*/
|
*/
|
||||||
$config['subclass_prefix'] = 'MY_';
|
$config['subclass_prefix'] = 'MY_';
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
| Allowed URL Characters
|
| Allowed URL Characters
|
||||||
@ -138,7 +138,6 @@ $config['subclass_prefix'] = 'MY_';
|
|||||||
*/
|
*/
|
||||||
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-';
|
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-';
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
| Enable Query Strings
|
| Enable Query Strings
|
||||||
@ -164,8 +163,8 @@ $config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-';
|
|||||||
| use segment based URLs.
|
| use segment based URLs.
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
$config['allow_get_array'] = TRUE;
|
$config['allow_get_array'] = true;
|
||||||
$config['enable_query_strings'] = FALSE;
|
$config['enable_query_strings'] = false;
|
||||||
$config['controller_trigger'] = 'c';
|
$config['controller_trigger'] = 'c';
|
||||||
$config['function_trigger'] = 'm';
|
$config['function_trigger'] = 'm';
|
||||||
$config['directory_trigger'] = 'd'; // experimental not currently in use
|
$config['directory_trigger'] = 'd'; // experimental not currently in use
|
||||||
@ -288,9 +287,9 @@ $config['sess_driver'] = 'database';
|
|||||||
$config['sess_cookie_name'] = 'stikked';
|
$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_save_path'] = 'sessions';
|
||||||
$config['sess_match_ip'] = FALSE;
|
$config['sess_match_ip'] = false;
|
||||||
$config['sess_time_to_update'] = 300;
|
$config['sess_time_to_update'] = 300;
|
||||||
$config['sess_regenerate_destroy'] = FALSE;
|
$config['sess_regenerate_destroy'] = false;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
@ -310,8 +309,8 @@ $config['sess_regenerate_destroy'] = FALSE;
|
|||||||
$config['cookie_prefix'] = '';
|
$config['cookie_prefix'] = '';
|
||||||
$config['cookie_domain'] = '';
|
$config['cookie_domain'] = '';
|
||||||
$config['cookie_path'] = '/';
|
$config['cookie_path'] = '/';
|
||||||
$config['cookie_secure'] = FALSE;
|
$config['cookie_secure'] = false;
|
||||||
$config['cookie_httponly'] = FALSE;
|
$config['cookie_httponly'] = false;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
@ -322,7 +321,7 @@ $config['cookie_httponly'] = FALSE;
|
|||||||
| COOKIE data is encountered
|
| COOKIE data is encountered
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
$config['global_xss_filtering'] = FALSE;
|
$config['global_xss_filtering'] = false;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
@ -336,7 +335,7 @@ $config['global_xss_filtering'] = FALSE;
|
|||||||
| 'csrf_cookie_name' = The cookie name
|
| 'csrf_cookie_name' = The cookie name
|
||||||
| 'csrf_expire' = The number in seconds the token should expire.
|
| '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_token_name'] = 'csrf_test_name';
|
||||||
$config['csrf_cookie_name'] = 'csrf_cookie_name';
|
$config['csrf_cookie_name'] = 'csrf_cookie_name';
|
||||||
$config['csrf_expire'] = 7200;
|
$config['csrf_expire'] = 7200;
|
||||||
@ -358,7 +357,7 @@ $config['csrf_expire'] = 7200;
|
|||||||
| by the output class. Do not 'echo' any values with compression enabled.
|
| by the output class. Do not 'echo' any values with compression enabled.
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
$config['compress_output'] = FALSE;
|
$config['compress_output'] = false;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
@ -373,7 +372,6 @@ $config['compress_output'] = FALSE;
|
|||||||
*/
|
*/
|
||||||
$config['time_reference'] = 'local';
|
$config['time_reference'] = 'local';
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
| Rewrite PHP Short Tags
|
| Rewrite PHP Short Tags
|
||||||
@ -384,8 +382,7 @@ $config['time_reference'] = 'local';
|
|||||||
| in your view files. Options are TRUE or FALSE (boolean)
|
| in your view files. Options are TRUE or FALSE (boolean)
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
$config['rewrite_short_tags'] = FALSE;
|
$config['rewrite_short_tags'] = false;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
<?php
|
<?php defined('BASEPATH') or exit('No direct script access allowed');
|
||||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
@ -11,7 +10,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
|||||||
| of this setting
|
| of this setting
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
defined('SHOW_DEBUG_BACKTRACE') OR define('SHOW_DEBUG_BACKTRACE', TRUE);
|
defined('SHOW_DEBUG_BACKTRACE') or define('SHOW_DEBUG_BACKTRACE', true);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
@ -26,10 +25,10 @@ defined('SHOW_DEBUG_BACKTRACE') OR define('SHOW_DEBUG_BACKTRACE', TRUE);
|
|||||||
| always be used to set the mode correctly.
|
| always be used to set the mode correctly.
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
defined('FILE_READ_MODE') OR define('FILE_READ_MODE', 0644);
|
defined('FILE_READ_MODE') or define('FILE_READ_MODE', 0644);
|
||||||
defined('FILE_WRITE_MODE') OR define('FILE_WRITE_MODE', 0666);
|
defined('FILE_WRITE_MODE') or define('FILE_WRITE_MODE', 0666);
|
||||||
defined('DIR_READ_MODE') OR define('DIR_READ_MODE', 0755);
|
defined('DIR_READ_MODE') or define('DIR_READ_MODE', 0755);
|
||||||
defined('DIR_WRITE_MODE') OR define('DIR_WRITE_MODE', 0755);
|
defined('DIR_WRITE_MODE') or define('DIR_WRITE_MODE', 0755);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
@ -39,14 +38,14 @@ defined('DIR_WRITE_MODE') OR define('DIR_WRITE_MODE', 0755);
|
|||||||
| These modes are used when working with fopen()/popen()
|
| These modes are used when working with fopen()/popen()
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
defined('FOPEN_READ') OR define('FOPEN_READ', 'rb');
|
defined('FOPEN_READ') or define('FOPEN_READ', 'rb');
|
||||||
defined('FOPEN_READ_WRITE') OR define('FOPEN_READ_WRITE', 'r+b');
|
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_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_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_WRITE_CREATE') or define('FOPEN_WRITE_CREATE', 'ab');
|
||||||
defined('FOPEN_READ_WRITE_CREATE') OR define('FOPEN_READ_WRITE_CREATE', 'a+b');
|
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_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_WRITE_CREATE_STRICT') or define('FOPEN_READ_WRITE_CREATE_STRICT', 'x+b');
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
@ -73,13 +72,13 @@ defined('FOPEN_READ_WRITE_CREATE_STRICT') OR define('FOPEN_READ_WRITE_CREA
|
|||||||
| http://tldp.org/LDP/abs/html/exitcodes.html
|
| http://tldp.org/LDP/abs/html/exitcodes.html
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
defined('EXIT_SUCCESS') OR define('EXIT_SUCCESS', 0); // no errors
|
defined('EXIT_SUCCESS') or define('EXIT_SUCCESS', 0); // no errors
|
||||||
defined('EXIT_ERROR') OR define('EXIT_ERROR', 1); // generic error
|
defined('EXIT_ERROR') or define('EXIT_ERROR', 1); // generic error
|
||||||
defined('EXIT_CONFIG') OR define('EXIT_CONFIG', 3); // configuration 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_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_CLASS') or define('EXIT_UNKNOWN_CLASS', 5); // unknown class
|
||||||
defined('EXIT_UNKNOWN_METHOD') OR define('EXIT_UNKNOWN_METHOD', 6); // unknown class member
|
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_USER_INPUT') or define('EXIT_USER_INPUT', 7); // invalid user input
|
||||||
defined('EXIT_DATABASE') OR define('EXIT_DATABASE', 8); // database error
|
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_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__AUTO_MAX') or define('EXIT__AUTO_MAX', 125); // highest automatically-assigned error code
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php if (!defined('BASEPATH')) {
|
||||||
if (!defined('BASEPATH')) exit('No direct script access allowed');
|
exit('No direct script access allowed');
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
| -------------------------------------------------------------------
|
| -------------------------------------------------------------------
|
||||||
| DATABASE CONNECTIVITY SETTINGS
|
| DATABASE CONNECTIVITY SETTINGS
|
||||||
@ -71,39 +73,33 @@ if (!defined('BASEPATH')) exit('No direct script access allowed');
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
$active_group = 'default';
|
$active_group = 'default';
|
||||||
$query_builder = TRUE;
|
$query_builder = true;
|
||||||
$CI = &get_instance();
|
$CI = &get_instance();
|
||||||
|
|
||||||
if ($CI->config->item('db_driver') == 'sqlite')
|
if ($CI->config->item('db_driver') == 'sqlite') {
|
||||||
{
|
|
||||||
$db['default']['database'] = $CI->config->item('db_database') . '.db';
|
$db['default']['database'] = $CI->config->item('db_database') . '.db';
|
||||||
$db['default']['dbdriver'] = 'sqlite3';
|
$db['default']['dbdriver'] = 'sqlite3';
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$db['default']['hostname'] = $CI->config->item('db_hostname');
|
$db['default']['hostname'] = $CI->config->item('db_hostname');
|
||||||
$db['default']['username'] = $CI->config->item('db_username');
|
$db['default']['username'] = $CI->config->item('db_username');
|
||||||
$db['default']['password'] = $CI->config->item('db_password');
|
$db['default']['password'] = $CI->config->item('db_password');
|
||||||
$db['default']['database'] = $CI->config->item('db_database');
|
$db['default']['database'] = $CI->config->item('db_database');
|
||||||
if (null !== $CI->config->item('db_driver'))
|
if (null !== $CI->config->item('db_driver')) {
|
||||||
{
|
|
||||||
$db['default']['dbdriver'] = $CI->config->item('db_driver');
|
$db['default']['dbdriver'] = $CI->config->item('db_driver');
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$db['default']['dbdriver'] = 'mysqli';
|
$db['default']['dbdriver'] = 'mysqli';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$db['default']['dbprefix'] = $CI->config->item('db_prefix');
|
$db['default']['dbprefix'] = $CI->config->item('db_prefix');
|
||||||
$db['default']['pconnect'] = FALSE;
|
$db['default']['pconnect'] = false;
|
||||||
$db['default']['db_debug'] = TRUE;
|
$db['default']['db_debug'] = true;
|
||||||
$db['default']['cache_on'] = FALSE;
|
$db['default']['cache_on'] = false;
|
||||||
$db['default']['cachedir'] = '';
|
$db['default']['cachedir'] = '';
|
||||||
$db['default']['char_set'] = 'utf8';
|
$db['default']['char_set'] = 'utf8';
|
||||||
$db['default']['dbcollat'] = 'utf8_general_ci';
|
$db['default']['dbcollat'] = 'utf8_general_ci';
|
||||||
$db['default']['swap_pre'] = '';
|
$db['default']['swap_pre'] = '';
|
||||||
$db['default']['autoinit'] = TRUE;
|
$db['default']['autoinit'] = true;
|
||||||
$db['default']['stricton'] = FALSE;
|
$db['default']['stricton'] = false;
|
||||||
|
|
||||||
/* End of file database.php */
|
/* End of file database.php */
|
||||||
/* Location: ./application/config/database.php */
|
/* Location: ./application/config/database.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');
|
||||||
|
}
|
||||||
|
|
||||||
$_doctypes = array(
|
$_doctypes = array(
|
||||||
'xhtml11' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">',
|
'xhtml11' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">',
|
||||||
@ -8,7 +10,7 @@ $_doctypes = array(
|
|||||||
'html5' => '<!DOCTYPE html>',
|
'html5' => '<!DOCTYPE html>',
|
||||||
'html4-strict' => '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">',
|
'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-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">'
|
'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 */
|
/* End of file doctypes.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
|
| Foreign Characters
|
||||||
@ -57,7 +60,7 @@ $foreign_characters = array(
|
|||||||
'/IJ/' => 'IJ',
|
'/IJ/' => 'IJ',
|
||||||
'/ij/' => 'ij',
|
'/ij/' => 'ij',
|
||||||
'/Œ/' => 'OE',
|
'/Œ/' => 'OE',
|
||||||
'/ƒ/' => 'f'
|
'/ƒ/' => 'f',
|
||||||
);
|
);
|
||||||
|
|
||||||
/* End of file foreign_chars.php */
|
/* End of file foreign_chars.php */
|
||||||
|
@ -1,11 +1,6 @@
|
|||||||
<?php
|
<?php if (!defined('BASEPATH')) {
|
||||||
/**
|
exit('No direct script access allowed');
|
||||||
* Class and Function List:
|
}
|
||||||
* Function list:
|
|
||||||
* Classes list:
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (!defined('BASEPATH')) exit('No direct script access allowed');
|
|
||||||
|
|
||||||
//geshi languages
|
//geshi languages
|
||||||
$config['geshi_languages'] = array(
|
$config['geshi_languages'] = array(
|
||||||
|
@ -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
|
| Hooks
|
||||||
@ -10,7 +13,5 @@
|
|||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* End of file hooks.php */
|
/* End of file hooks.php */
|
||||||
/* Location: ./application/config/hooks.php */
|
/* Location: ./application/config/hooks.php */
|
@ -1,4 +1,4 @@
|
|||||||
<?php defined('BASEPATH') OR exit('No direct script access allowed');
|
<?php defined('BASEPATH') or exit('No direct script access allowed');
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
| Enable/Disable Migrations
|
| Enable/Disable Migrations
|
||||||
@ -8,8 +8,7 @@
|
|||||||
| whenever you intend to do a schema migration.
|
| whenever you intend to do a schema migration.
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
$config['migration_enabled'] = FALSE;
|
$config['migration_enabled'] = false;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
@ -23,7 +22,6 @@ $config['migration_enabled'] = FALSE;
|
|||||||
*/
|
*/
|
||||||
$config['migration_version'] = 0;
|
$config['migration_version'] = 0;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
| Migrations Path
|
| Migrations Path
|
||||||
@ -36,6 +34,5 @@ $config['migration_version'] = 0;
|
|||||||
*/
|
*/
|
||||||
$config['migration_path'] = APPPATH . 'migrations/';
|
$config['migration_path'] = APPPATH . 'migrations/';
|
||||||
|
|
||||||
|
|
||||||
/* End of file migration.php */
|
/* End of file migration.php */
|
||||||
/* Location: ./application/config/migration.php */
|
/* Location: ./application/config/migration.php */
|
@ -1,5 +1,4 @@
|
|||||||
<?php
|
<?php defined('BASEPATH') or exit('No direct script access allowed');
|
||||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
| -------------------------------------------------------------------
|
| -------------------------------------------------------------------
|
||||||
@ -180,5 +179,5 @@ return array(
|
|||||||
'odt' => 'application/vnd.oasis.opendocument.text',
|
'odt' => 'application/vnd.oasis.opendocument.text',
|
||||||
'odm' => 'application/vnd.oasis.opendocument.text-master',
|
'odm' => 'application/vnd.oasis.opendocument.text-master',
|
||||||
'ott' => 'application/vnd.oasis.opendocument.text-template',
|
'ott' => 'application/vnd.oasis.opendocument.text-template',
|
||||||
'oth' => 'application/vnd.oasis.opendocument.text-web'
|
'oth' => 'application/vnd.oasis.opendocument.text-web',
|
||||||
);
|
);
|
||||||
|
@ -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
|
| Profiler Sections
|
||||||
@ -11,7 +14,5 @@
|
|||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* End of file profiler.php */
|
/* End of file profiler.php */
|
||||||
/* Location: ./application/config/profiler.php */
|
/* Location: ./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');
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
| -------------------------------------------------------------------------
|
| -------------------------------------------------------------------------
|
||||||
| URI ROUTING
|
| URI ROUTING
|
||||||
|
@ -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
|
| SMILEYS
|
||||||
@ -58,7 +61,7 @@ $smileys = array(
|
|||||||
':vampire:' => array('vampire.gif', '19', '19', 'vampire'),
|
':vampire:' => array('vampire.gif', '19', '19', 'vampire'),
|
||||||
':snake:' => array('snake.gif', '19', '19', 'snake'),
|
':snake:' => array('snake.gif', '19', '19', 'snake'),
|
||||||
':exclaim:' => array('exclaim.gif', '19', '19', 'excaim'),
|
':exclaim:' => array('exclaim.gif', '19', '19', 'excaim'),
|
||||||
':question:' => array('question.gif', '19', '19', 'question') // no comma after last item
|
':question:' => array('question.gif', '19', '19', 'question'), // no comma after last item
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
|
<?php if (!defined('BASEPATH')) {
|
||||||
|
exit('No direct script access allowed');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Site Name
|
* Site Name
|
||||||
@ -159,7 +161,6 @@ $config['cron_key'] = '';
|
|||||||
$config['url_shortening_use'] = 'off';
|
$config['url_shortening_use'] = 'off';
|
||||||
$config['random_url_engines'] = 'googl,bitly'; // Used only in random mode, read comment above for more info
|
$config['random_url_engines'] = 'googl,bitly'; // Used only in random mode, read comment above for more info
|
||||||
|
|
||||||
|
|
||||||
// Yourls
|
// Yourls
|
||||||
$config['yourls_url'] = '';
|
$config['yourls_url'] = '';
|
||||||
$config['yourls_signature'] = '';
|
$config['yourls_signature'] = '';
|
||||||
@ -178,7 +179,6 @@ $config['bitly_url_api'] = '';
|
|||||||
$config['polr_url'] = '';
|
$config['polr_url'] = '';
|
||||||
$config['polr_api'] = '';
|
$config['polr_api'] = '';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Credentials for the backup URL
|
* Credentials for the backup URL
|
||||||
*
|
*
|
||||||
|
@ -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
|
| USER AGENT TYPES
|
||||||
@ -41,10 +44,9 @@ $platforms = array (
|
|||||||
'bsdi' => 'BSDi',
|
'bsdi' => 'BSDi',
|
||||||
'openbsd' => 'OpenBSD',
|
'openbsd' => 'OpenBSD',
|
||||||
'gnu' => 'GNU/Linux',
|
'gnu' => 'GNU/Linux',
|
||||||
'unix' => 'Unknown Unix OS'
|
'unix' => 'Unknown Unix OS',
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
// The order of this array should NOT be changed. Many browsers return
|
// The order of this array should NOT be changed. Many browsers return
|
||||||
// multiple browser types so we want to identify the sub-type first.
|
// multiple browser types so we want to identify the sub-type first.
|
||||||
$browsers = array(
|
$browsers = array(
|
||||||
@ -69,7 +71,7 @@ $browsers = array(
|
|||||||
'Links' => 'Links',
|
'Links' => 'Links',
|
||||||
'hotjava' => 'HotJava',
|
'hotjava' => 'HotJava',
|
||||||
'amaya' => 'Amaya',
|
'amaya' => 'Amaya',
|
||||||
'IBrowse' => 'IBrowse'
|
'IBrowse' => 'IBrowse',
|
||||||
);
|
);
|
||||||
|
|
||||||
$mobiles = array(
|
$mobiles = array(
|
||||||
@ -159,7 +161,7 @@ $mobiles = array(
|
|||||||
'up.link' => "Generic Mobile",
|
'up.link' => "Generic Mobile",
|
||||||
'up.browser' => "Generic Mobile",
|
'up.browser' => "Generic Mobile",
|
||||||
'smartphone' => "Generic Mobile",
|
'smartphone' => "Generic Mobile",
|
||||||
'cellphone' => "Generic Mobile"
|
'cellphone' => "Generic Mobile",
|
||||||
);
|
);
|
||||||
|
|
||||||
// There are hundreds of bots but these are the most common.
|
// There are hundreds of bots but these are the most common.
|
||||||
@ -171,7 +173,7 @@ $robots = array(
|
|||||||
'askjeeves' => 'AskJeeves',
|
'askjeeves' => 'AskJeeves',
|
||||||
'fastcrawler' => 'FastCrawler',
|
'fastcrawler' => 'FastCrawler',
|
||||||
'infoseek' => 'InfoSeek Robot 1.0',
|
'infoseek' => 'InfoSeek Robot 1.0',
|
||||||
'lycos' => 'Lycos'
|
'lycos' => 'Lycos',
|
||||||
);
|
);
|
||||||
|
|
||||||
/* End of file user_agents.php */
|
/* End of file user_agents.php */
|
||||||
|
@ -1,41 +1,28 @@
|
|||||||
<?php
|
<?php if (!defined('BASEPATH')) {
|
||||||
/**
|
exit('No direct script access allowed');
|
||||||
* Class and Function List:
|
}
|
||||||
* Function list:
|
|
||||||
* - __construct()
|
include_once 'application/controllers/Main.php';
|
||||||
* - index()
|
|
||||||
* - create()
|
|
||||||
* - paste()
|
|
||||||
* - random()
|
|
||||||
* - recent()
|
|
||||||
* - trending()
|
|
||||||
* - langs()
|
|
||||||
* Classes list:
|
|
||||||
* - Api extends Main
|
|
||||||
*/
|
|
||||||
include_once ('application/controllers/Main.php');
|
|
||||||
|
|
||||||
class Api extends Main
|
class Api extends Main
|
||||||
{
|
{
|
||||||
|
|
||||||
function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
|
||||||
if (config_item('disable_api'))
|
if (config_item('disable_api')) {
|
||||||
{
|
|
||||||
die("The API has been disabled\n");
|
die("The API has been disabled\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
// if ldap is configured and no api token is configured, fail the request
|
// if ldap is configured and no api token is configured, fail the request
|
||||||
if ((config_item('require_auth') == true) && (config_item('apikey') == ''))
|
if ((config_item('require_auth') == true) && (config_item('apikey') == '')) {
|
||||||
{
|
|
||||||
die("API key not configured");
|
die("API key not configured");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function index()
|
public function index()
|
||||||
{
|
{
|
||||||
$languages = $this->languages->get_languages();
|
$languages = $this->languages->get_languages();
|
||||||
$languages = array_keys($languages);
|
$languages = array_keys($languages);
|
||||||
@ -44,60 +31,47 @@ class Api extends Main
|
|||||||
$this->load->view('api_help', $data);
|
$this->load->view('api_help', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
function create()
|
public function create()
|
||||||
{
|
{
|
||||||
|
|
||||||
if (config_item('apikey') != $this->input->get('apikey') && config_item('soft_api') == false)
|
if (config_item('apikey') != $this->input->get('apikey') && config_item('soft_api') == false) {
|
||||||
{
|
|
||||||
die("Invalid API key\n");
|
die("Invalid API key\n");
|
||||||
}
|
}
|
||||||
$this->load->model('pastes');
|
$this->load->model('pastes');
|
||||||
$this->load->library('form_validation'); //needed by parent class
|
$this->load->library('form_validation'); //needed by parent class
|
||||||
|
|
||||||
|
if (!$this->input->post('text')) {
|
||||||
if (!$this->input->post('text'))
|
|
||||||
{
|
|
||||||
$data['msg'] = 'Error: Missing paste text';
|
$data['msg'] = 'Error: Missing paste text';
|
||||||
$this->load->view('view/api', $data);
|
$this->load->view('view/api', $data);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
|
|
||||||
if (!$this->input->post('lang'))
|
if (!$this->input->post('lang')) {
|
||||||
{
|
|
||||||
$_POST['lang'] = 'text';
|
$_POST['lang'] = 'text';
|
||||||
}
|
}
|
||||||
$_POST['code'] = $this->input->post('text');
|
$_POST['code'] = $this->input->post('text');
|
||||||
|
|
||||||
if ($this->config->item('private_only'))
|
if ($this->config->item('private_only')) {
|
||||||
{
|
|
||||||
$_POST['private'] = 1;
|
$_POST['private'] = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//validations
|
//validations
|
||||||
|
|
||||||
if (!$this->_valid_ip())
|
if (!$this->_valid_ip()) {
|
||||||
{
|
|
||||||
die("You are not allowed to paste\n");
|
die("You are not allowed to paste\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config_item('soft_api') == true && (config_item('apikey') == $this->input->get('apikey')))
|
if (config_item('soft_api') == true && (config_item('apikey') == $this->input->get('apikey'))) {
|
||||||
{
|
|
||||||
|
|
||||||
//pass
|
//pass
|
||||||
|
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
|
|
||||||
if (!$this->_blockwords_check())
|
if (!$this->_blockwords_check()) {
|
||||||
{
|
|
||||||
die("Your paste contains blocked words\n");
|
die("Your paste contains blocked words\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$this->input->post('expire'))
|
if (!$this->input->post('expire')) {
|
||||||
{
|
|
||||||
$_POST['expire'] = config_item('default_expiration');
|
$_POST['expire'] = config_item('default_expiration');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -108,27 +82,22 @@ class Api extends Main
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function paste()
|
public function paste()
|
||||||
{
|
{
|
||||||
|
|
||||||
if (config_item('apikey') != $this->input->get('apikey'))
|
if (config_item('apikey') != $this->input->get('apikey')) {
|
||||||
{
|
|
||||||
die("Invalid API key\n");
|
die("Invalid API key\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config_item('private_only'))
|
if (config_item('private_only')) {
|
||||||
{
|
|
||||||
show_404();
|
show_404();
|
||||||
}
|
}
|
||||||
$this->load->model('pastes');
|
$this->load->model('pastes');
|
||||||
$check = $this->pastes->checkPaste(3);
|
$check = $this->pastes->checkPaste(3);
|
||||||
|
|
||||||
if ($check)
|
if ($check) {
|
||||||
{
|
|
||||||
$data = $this->pastes->getPaste(3);
|
$data = $this->pastes->getPaste(3);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$data = array(
|
$data = array(
|
||||||
'message' => 'Not found',
|
'message' => 'Not found',
|
||||||
);
|
);
|
||||||
@ -136,16 +105,14 @@ class Api extends Main
|
|||||||
echo json_encode($data);
|
echo json_encode($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
function random()
|
public function random()
|
||||||
{
|
{
|
||||||
|
|
||||||
if (config_item('apikey') != $this->input->get('apikey'))
|
if (config_item('apikey') != $this->input->get('apikey')) {
|
||||||
{
|
|
||||||
die("Invalid API key\n");
|
die("Invalid API key\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config_item('private_only'))
|
if (config_item('private_only')) {
|
||||||
{
|
|
||||||
show_404();
|
show_404();
|
||||||
}
|
}
|
||||||
$this->load->model('pastes');
|
$this->load->model('pastes');
|
||||||
@ -153,24 +120,21 @@ class Api extends Main
|
|||||||
echo json_encode($data);
|
echo json_encode($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
function recent()
|
public function recent()
|
||||||
{
|
{
|
||||||
|
|
||||||
if (config_item('apikey') != $this->input->get('apikey'))
|
if (config_item('apikey') != $this->input->get('apikey')) {
|
||||||
{
|
|
||||||
die("Invalid API key\n");
|
die("Invalid API key\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config_item('private_only'))
|
if (config_item('private_only')) {
|
||||||
{
|
|
||||||
show_404();
|
show_404();
|
||||||
}
|
}
|
||||||
$this->load->model('pastes');
|
$this->load->model('pastes');
|
||||||
$pastes = $this->pastes->getLists('api/recent');
|
$pastes = $this->pastes->getLists('api/recent');
|
||||||
$pastes = $pastes['pastes'];
|
$pastes = $pastes['pastes'];
|
||||||
$data = array();
|
$data = array();
|
||||||
foreach ($pastes as $paste)
|
foreach ($pastes as $paste) {
|
||||||
{
|
|
||||||
$data[] = array(
|
$data[] = array(
|
||||||
'pid' => $paste['pid'],
|
'pid' => $paste['pid'],
|
||||||
'title' => $paste['title'],
|
'title' => $paste['title'],
|
||||||
@ -182,24 +146,21 @@ class Api extends Main
|
|||||||
echo json_encode($data);
|
echo json_encode($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
function trending()
|
public function trending()
|
||||||
{
|
{
|
||||||
|
|
||||||
if (config_item('apikey') != $this->input->get('apikey'))
|
if (config_item('apikey') != $this->input->get('apikey')) {
|
||||||
{
|
|
||||||
die("Invalid API key\n");
|
die("Invalid API key\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config_item('private_only'))
|
if (config_item('private_only')) {
|
||||||
{
|
|
||||||
show_404();
|
show_404();
|
||||||
}
|
}
|
||||||
$this->load->model('pastes');
|
$this->load->model('pastes');
|
||||||
$pastes = $this->pastes->getTrends('api/trending', 2);
|
$pastes = $this->pastes->getTrends('api/trending', 2);
|
||||||
$pastes = $pastes['pastes'];
|
$pastes = $pastes['pastes'];
|
||||||
$data = array();
|
$data = array();
|
||||||
foreach ($pastes as $paste)
|
foreach ($pastes as $paste) {
|
||||||
{
|
|
||||||
$data[] = array(
|
$data[] = array(
|
||||||
'pid' => $paste['pid'],
|
'pid' => $paste['pid'],
|
||||||
'title' => $paste['title'],
|
'title' => $paste['title'],
|
||||||
@ -212,10 +173,9 @@ class Api extends Main
|
|||||||
echo json_encode($data);
|
echo json_encode($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
function langs()
|
public function langs()
|
||||||
{
|
|
||||||
if (config_item('apikey') != $this->input->get('apikey'))
|
|
||||||
{
|
{
|
||||||
|
if (config_item('apikey') != $this->input->get('apikey')) {
|
||||||
die("Invalid API key\n");
|
die("Invalid API key\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,17 +1,6 @@
|
|||||||
<?php
|
<?php if (!defined('BASEPATH')) {
|
||||||
/**
|
exit('No direct script access allowed');
|
||||||
* 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');
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is part of Auth_Ldap.
|
* This file is part of Auth_Ldap.
|
||||||
@ -41,7 +30,7 @@ if (!defined('BASEPATH')) exit('No direct script access allowed');
|
|||||||
class Auth extends CI_Controller
|
class Auth extends CI_Controller
|
||||||
{
|
{
|
||||||
|
|
||||||
function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
$this->load->helper('form');
|
$this->load->helper('form');
|
||||||
@ -51,18 +40,17 @@ class Auth extends CI_Controller
|
|||||||
$this->load->library('table');
|
$this->load->library('table');
|
||||||
}
|
}
|
||||||
|
|
||||||
function index()
|
public function index()
|
||||||
{
|
{
|
||||||
$this->session->keep_flashdata('tried_to');
|
$this->session->keep_flashdata('tried_to');
|
||||||
$this->login();
|
$this->login();
|
||||||
}
|
}
|
||||||
|
|
||||||
function login($errorMsg = NULL)
|
public function login($errorMsg = null)
|
||||||
{
|
{
|
||||||
$this->session->keep_flashdata('tried_to');
|
$this->session->keep_flashdata('tried_to');
|
||||||
|
|
||||||
if (!$this->auth_ldap->is_authenticated())
|
if (!$this->auth_ldap->is_authenticated()) {
|
||||||
{
|
|
||||||
|
|
||||||
// Set up rules for form validation
|
// Set up rules for form validation
|
||||||
$rules = $this->form_validation;
|
$rules = $this->form_validation;
|
||||||
@ -71,56 +59,43 @@ class Auth extends CI_Controller
|
|||||||
|
|
||||||
// Do the login...
|
// Do the login...
|
||||||
|
|
||||||
if ($rules->run() && $this->auth_ldap->login($rules->set_value('username') , $rules->set_value('password')))
|
if ($rules->run() && $this->auth_ldap->login($rules->set_value('username'), $rules->set_value('password'))) {
|
||||||
{
|
|
||||||
|
|
||||||
// Login WIN!
|
// Login WIN!
|
||||||
|
|
||||||
if ($this->session->flashdata('tried_to'))
|
if ($this->session->flashdata('tried_to')) {
|
||||||
{
|
|
||||||
redirect($this->session->flashdata('tried_to'));
|
redirect($this->session->flashdata('tried_to'));
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
redirect('/');
|
redirect('/');
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
|
|
||||||
// Login FAIL
|
// Login FAIL
|
||||||
$this->session->set_flashdata('login_error', 'Incorrect username or password.');
|
$this->session->set_flashdata('login_error', 'Incorrect username or password.');
|
||||||
$this->load->view('auth/login_form');
|
$this->load->view('auth/login_form');
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
|
|
||||||
// Already logged in...
|
// Already logged in...
|
||||||
redirect('/');
|
redirect('/');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function logout()
|
public function logout()
|
||||||
{
|
{
|
||||||
|
|
||||||
if ($this->session->userdata('logged_in'))
|
if ($this->session->userdata('logged_in')) {
|
||||||
{
|
|
||||||
$data['name'] = $this->session->userdata('cn');
|
$data['name'] = $this->session->userdata('cn');
|
||||||
$data['username'] = $this->session->userdata('username');
|
$data['username'] = $this->session->userdata('username');
|
||||||
$data['logged_in'] = TRUE;
|
$data['logged_in'] = true;
|
||||||
$this->auth_ldap->logout();
|
$this->auth_ldap->logout();
|
||||||
}
|
} else {
|
||||||
else
|
$data['logged_in'] = false;
|
||||||
{
|
|
||||||
$data['logged_in'] = FALSE;
|
|
||||||
}
|
}
|
||||||
redirect('/');
|
redirect('/');
|
||||||
}
|
}
|
||||||
public
|
public function alpha_dash_dot($str)
|
||||||
function alpha_dash_dot($str)
|
|
||||||
{
|
{
|
||||||
return (!preg_match("/^([-a-z0-9_\-\.])+$/i", $str)) ? FALSE : TRUE;
|
return (!preg_match("/^([-a-z0-9_\-\.])+$/i", $str)) ? false : true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
|
@ -1,17 +1,11 @@
|
|||||||
<?php
|
<?php if (!defined('BASEPATH')) {
|
||||||
/**
|
exit('No direct script access allowed');
|
||||||
* Class and Function List:
|
}
|
||||||
* Function list:
|
|
||||||
* - __construct()
|
|
||||||
* - index()
|
|
||||||
* Classes list:
|
|
||||||
* - Backup extends CI_Controller
|
|
||||||
*/
|
|
||||||
|
|
||||||
class Backup extends CI_Controller
|
class Backup extends CI_Controller
|
||||||
{
|
{
|
||||||
|
|
||||||
function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
|
||||||
@ -19,15 +13,14 @@ class Backup extends CI_Controller
|
|||||||
$user = $this->config->item('backup_user');
|
$user = $this->config->item('backup_user');
|
||||||
$pass = $this->config->item('backup_pass');
|
$pass = $this->config->item('backup_pass');
|
||||||
|
|
||||||
if ($user == '' || $pass == '' || !isset($_SERVER['PHP_AUTH_USER']) || $_SERVER['PHP_AUTH_USER'] != $user || $_SERVER['PHP_AUTH_PW'] != $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('WWW-Authenticate: Basic realm="Backup"');
|
||||||
header('HTTP/1.0 401 Unauthorized');
|
header('HTTP/1.0 401 Unauthorized');
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function index()
|
public function index()
|
||||||
{
|
{
|
||||||
|
|
||||||
// Load the DB utility class
|
// Load the DB utility class
|
||||||
|
@ -1,31 +1,24 @@
|
|||||||
<?php
|
<?php if (!defined('BASEPATH')) {
|
||||||
/**
|
exit('No direct script access allowed');
|
||||||
* Class and Function List:
|
}
|
||||||
* Function list:
|
|
||||||
* - __construct()
|
|
||||||
* - index()
|
|
||||||
* - view()
|
|
||||||
* Classes list:
|
|
||||||
* - Iphone extends CI_Controller
|
|
||||||
*/
|
|
||||||
|
|
||||||
class Iphone extends CI_Controller
|
class Iphone extends CI_Controller
|
||||||
{
|
{
|
||||||
|
|
||||||
function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
$this->load->model('languages');
|
$this->load->model('languages');
|
||||||
}
|
}
|
||||||
|
|
||||||
function index()
|
public function index()
|
||||||
{
|
{
|
||||||
$this->load->model('pastes');
|
$this->load->model('pastes');
|
||||||
$data = $this->pastes->getLists('iphone/');
|
$data = $this->pastes->getLists('iphone/');
|
||||||
$this->load->view('iphone/recent', $data);
|
$this->load->view('iphone/recent', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
function view()
|
public function view()
|
||||||
{
|
{
|
||||||
$this->load->model('pastes');
|
$this->load->model('pastes');
|
||||||
$data = $this->pastes->getPaste(3);
|
$data = $this->pastes->getPaste(3);
|
||||||
|
@ -1,50 +1,18 @@
|
|||||||
<?php
|
<?php if (!defined('BASEPATH')) {
|
||||||
/**
|
exit('No direct script access allowed');
|
||||||
* 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
|
|
||||||
*/
|
|
||||||
|
|
||||||
class Main extends CI_Controller
|
class Main extends CI_Controller
|
||||||
{
|
{
|
||||||
|
|
||||||
function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
$this->output->enable_profiler(false);
|
$this->output->enable_profiler(false);
|
||||||
$this->load->model('languages');
|
$this->load->model('languages');
|
||||||
$this->load->library('curl');
|
$this->load->library('curl');
|
||||||
|
|
||||||
if (config_item('require_auth'))
|
if (config_item('require_auth')) {
|
||||||
{
|
|
||||||
$this->load->library('auth_ldap');
|
$this->load->library('auth_ldap');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,18 +21,15 @@ class Main extends CI_Controller
|
|||||||
$this->recaptcha_privatekey = config_item('recaptcha_privatekey');
|
$this->recaptcha_privatekey = config_item('recaptcha_privatekey');
|
||||||
$this->use_recaptcha = false;
|
$this->use_recaptcha = false;
|
||||||
|
|
||||||
if ($this->recaptcha_publickey != '' && $this->recaptcha_privatekey != '')
|
if ($this->recaptcha_publickey != '' && $this->recaptcha_privatekey != '') {
|
||||||
{
|
|
||||||
$this->load->helper('recaptcha');
|
$this->load->helper('recaptcha');
|
||||||
$this->use_recaptcha = true;
|
$this->use_recaptcha = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$this->db->table_exists('sessions'))
|
if (!$this->db->table_exists('sessions')) {
|
||||||
{
|
|
||||||
$this->load->dbforge();
|
$this->load->dbforge();
|
||||||
|
|
||||||
if ($this->db->table_exists('ci_sessions'))
|
if ($this->db->table_exists('ci_sessions')) {
|
||||||
{
|
|
||||||
$this->dbforge->drop_table('ci_sessions');
|
$this->dbforge->drop_table('ci_sessions');
|
||||||
}
|
}
|
||||||
$fields = array(
|
$fields = array(
|
||||||
@ -81,7 +46,7 @@ class Main extends CI_Controller
|
|||||||
'timestamp' => array(
|
'timestamp' => array(
|
||||||
'type' => 'INT',
|
'type' => 'INT',
|
||||||
'constraint' => 10,
|
'constraint' => 10,
|
||||||
'unsigned' => TRUE,
|
'unsigned' => true,
|
||||||
'default' => 0,
|
'default' => 0,
|
||||||
),
|
),
|
||||||
'data' => array(
|
'data' => array(
|
||||||
@ -97,14 +62,13 @@ class Main extends CI_Controller
|
|||||||
// load this after db has been initialized
|
// load this after db has been initialized
|
||||||
$this->load->library('session');
|
$this->load->library('session');
|
||||||
|
|
||||||
if (!$this->db->table_exists('pastes'))
|
if (!$this->db->table_exists('pastes')) {
|
||||||
{
|
|
||||||
$this->load->dbforge();
|
$this->load->dbforge();
|
||||||
$fields = array(
|
$fields = array(
|
||||||
'id' => array(
|
'id' => array(
|
||||||
'type' => 'INT',
|
'type' => 'INT',
|
||||||
'constraint' => 10,
|
'constraint' => 10,
|
||||||
'auto_increment' => TRUE,
|
'auto_increment' => true,
|
||||||
),
|
),
|
||||||
'pid' => array(
|
'pid' => array(
|
||||||
'type' => 'VARCHAR',
|
'type' => 'VARCHAR',
|
||||||
@ -141,7 +105,7 @@ class Main extends CI_Controller
|
|||||||
'toexpire' => array(
|
'toexpire' => array(
|
||||||
'type' => 'TINYINT',
|
'type' => 'TINYINT',
|
||||||
'constraint' => 1,
|
'constraint' => 1,
|
||||||
'unsigned' => TRUE,
|
'unsigned' => true,
|
||||||
'default' => 0,
|
'default' => 0,
|
||||||
),
|
),
|
||||||
'snipurl' => array(
|
'snipurl' => array(
|
||||||
@ -156,7 +120,7 @@ class Main extends CI_Controller
|
|||||||
'ip_address' => array(
|
'ip_address' => array(
|
||||||
'type' => 'VARCHAR',
|
'type' => 'VARCHAR',
|
||||||
'constraint' => 45,
|
'constraint' => 45,
|
||||||
'null' => TRUE,
|
'null' => true,
|
||||||
),
|
),
|
||||||
'hits' => array(
|
'hits' => array(
|
||||||
'type' => 'INT',
|
'type' => 'INT',
|
||||||
@ -181,8 +145,7 @@ class Main extends CI_Controller
|
|||||||
$this->dbforge->create_table('pastes', true);
|
$this->dbforge->create_table('pastes', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$this->db->table_exists('blocked_ips'))
|
if (!$this->db->table_exists('blocked_ips')) {
|
||||||
{
|
|
||||||
$this->load->dbforge();
|
$this->load->dbforge();
|
||||||
$fields = array(
|
$fields = array(
|
||||||
'ip_address' => array(
|
'ip_address' => array(
|
||||||
@ -205,8 +168,7 @@ class Main extends CI_Controller
|
|||||||
$this->dbforge->create_table('blocked_ips', true);
|
$this->dbforge->create_table('blocked_ips', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$this->db->table_exists('trending'))
|
if (!$this->db->table_exists('trending')) {
|
||||||
{
|
|
||||||
$this->load->dbforge();
|
$this->load->dbforge();
|
||||||
$fields = array(
|
$fields = array(
|
||||||
'paste_id' => array(
|
'paste_id' => array(
|
||||||
@ -230,21 +192,19 @@ class Main extends CI_Controller
|
|||||||
$this->dbforge->create_table('trending', true);
|
$this->dbforge->create_table('trending', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$this->db->field_exists('ip_address', 'pastes'))
|
if (!$this->db->field_exists('ip_address', 'pastes')) {
|
||||||
{
|
|
||||||
$this->load->dbforge();
|
$this->load->dbforge();
|
||||||
$fields = array(
|
$fields = array(
|
||||||
'ip_address' => array(
|
'ip_address' => array(
|
||||||
'type' => 'VARCHAR',
|
'type' => 'VARCHAR',
|
||||||
'constraint' => 45,
|
'constraint' => 45,
|
||||||
'null' => TRUE,
|
'null' => true,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
$this->dbforge->add_column('pastes', $fields);
|
$this->dbforge->add_column('pastes', $fields);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$this->db->field_exists('hits', 'pastes'))
|
if (!$this->db->field_exists('hits', 'pastes')) {
|
||||||
{
|
|
||||||
$this->load->dbforge();
|
$this->load->dbforge();
|
||||||
$fields = array(
|
$fields = array(
|
||||||
'hits' => array(
|
'hits' => array(
|
||||||
@ -266,19 +226,15 @@ class Main extends CI_Controller
|
|||||||
//ipv6 migration
|
//ipv6 migration
|
||||||
$fields = $this->db->field_data('trending');
|
$fields = $this->db->field_data('trending');
|
||||||
|
|
||||||
if (stristr(config_item('db_driver') , 'sqlite') === false && $fields[1]->max_length < 45)
|
if (stristr(config_item('db_driver'), 'sqlite') === false && $fields[1]->max_length < 45) {
|
||||||
{
|
|
||||||
$db_prefix = config_item('db_prefix');
|
$db_prefix = config_item('db_prefix');
|
||||||
|
|
||||||
if ($this->db->dbdriver == "postgre")
|
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 . "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 . "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 . "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'");
|
$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 {
|
||||||
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 . "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 . "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 . "blocked_ips CHANGE COLUMN ip_address ip_address VARCHAR(45) NOT NULL DEFAULT '0'");
|
||||||
@ -288,22 +244,16 @@ class Main extends CI_Controller
|
|||||||
|
|
||||||
//expand title to 50
|
//expand title to 50
|
||||||
$fields = $this->db->field_data('pastes');
|
$fields = $this->db->field_data('pastes');
|
||||||
foreach ($fields as $field)
|
foreach ($fields as $field) {
|
||||||
{
|
|
||||||
|
|
||||||
if ($field->name == 'title')
|
if ($field->name == 'title') {
|
||||||
{
|
|
||||||
|
|
||||||
if (stristr(config_item('db_driver') , 'sqlite') === false && $field->max_length < 50)
|
if (stristr(config_item('db_driver'), 'sqlite') === false && $field->max_length < 50) {
|
||||||
{
|
|
||||||
$db_prefix = config_item('db_prefix');
|
$db_prefix = config_item('db_prefix');
|
||||||
|
|
||||||
if ($this->db->dbdriver == "postgre")
|
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");
|
$this->db->query("ALTER TABLE " . $db_prefix . "pastes ALTER COLUMN title TYPE VARCHAR(50), ALTER COLUMN title SET NOT NULL");
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->db->query("ALTER TABLE " . $db_prefix . "pastes CHANGE COLUMN title title VARCHAR(50) NOT NULL");
|
$this->db->query("ALTER TABLE " . $db_prefix . "pastes CHANGE COLUMN title title VARCHAR(50) NOT NULL");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -312,25 +262,18 @@ class Main extends CI_Controller
|
|||||||
|
|
||||||
//upgrade to CI 3.1.2
|
//upgrade to CI 3.1.2
|
||||||
$fields = $this->db->field_data('sessions');
|
$fields = $this->db->field_data('sessions');
|
||||||
foreach ($fields as $field)
|
foreach ($fields as $field) {
|
||||||
{
|
|
||||||
|
|
||||||
if ($field->name == 'id')
|
if ($field->name == 'id') {
|
||||||
{
|
|
||||||
|
|
||||||
if (stristr(config_item('db_driver') , 'sqlite') === false)
|
if (stristr(config_item('db_driver'), 'sqlite') === false) {
|
||||||
{
|
|
||||||
|
|
||||||
if ($field->max_length < 128)
|
if ($field->max_length < 128) {
|
||||||
{
|
|
||||||
$db_prefix = config_item('db_prefix');
|
$db_prefix = config_item('db_prefix');
|
||||||
|
|
||||||
if ($this->db->dbdriver == "postgre")
|
if ($this->db->dbdriver == "postgre") {
|
||||||
{
|
|
||||||
$this->db->query("ALTER TABLE " . $db_prefix . "sessions ALTER COLUMN id SET DATA TYPE varchar(128)");
|
$this->db->query("ALTER TABLE " . $db_prefix . "sessions ALTER COLUMN id SET DATA TYPE varchar(128)");
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->db->query("ALTER TABLE " . $db_prefix . "sessions CHANGE id id VARCHAR(128) NOT NULL");
|
$this->db->query("ALTER TABLE " . $db_prefix . "sessions CHANGE id id VARCHAR(128) NOT NULL");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -339,14 +282,13 @@ class Main extends CI_Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function _form_prep($lang = false, $title = '', $paste = '', $reply = false)
|
public function _form_prep($lang = false, $title = '', $paste = '', $reply = false)
|
||||||
{
|
{
|
||||||
$this->load->model('languages');
|
$this->load->model('languages');
|
||||||
$this->load->helper('form');
|
$this->load->helper('form');
|
||||||
$data['languages'] = $this->languages->get_languages();
|
$data['languages'] = $this->languages->get_languages();
|
||||||
|
|
||||||
if (config_item('js_editor') == 'codemirror')
|
if (config_item('js_editor') == 'codemirror') {
|
||||||
{
|
|
||||||
|
|
||||||
//codemirror languages
|
//codemirror languages
|
||||||
$this->load->config('codemirror_languages');
|
$this->load->config('codemirror_languages');
|
||||||
@ -355,19 +297,16 @@ class Main extends CI_Controller
|
|||||||
|
|
||||||
//codemirror modes
|
//codemirror modes
|
||||||
$cmm = array();
|
$cmm = array();
|
||||||
foreach ($codemirror_languages as $geshi_name => $l)
|
foreach ($codemirror_languages as $geshi_name => $l) {
|
||||||
{
|
|
||||||
|
|
||||||
if (gettype($l) == 'array')
|
if (gettype($l) == 'array') {
|
||||||
{
|
|
||||||
$cmm[$geshi_name] = $l['mode'];
|
$cmm[$geshi_name] = $l['mode'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$data['codemirror_modes'] = $cmm;
|
$data['codemirror_modes'] = $cmm;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config_item('js_editor') == 'ace')
|
if (config_item('js_editor') == 'ace') {
|
||||||
{
|
|
||||||
|
|
||||||
//ace languages
|
//ace languages
|
||||||
$this->load->config('ace_languages');
|
$this->load->config('ace_languages');
|
||||||
@ -376,8 +315,7 @@ class Main extends CI_Controller
|
|||||||
|
|
||||||
//ace modes
|
//ace modes
|
||||||
$acem = array();
|
$acem = array();
|
||||||
foreach ($ace_languages as $geshi_name => $l)
|
foreach ($ace_languages as $geshi_name => $l) {
|
||||||
{
|
|
||||||
$acem[$geshi_name] = $l;
|
$acem[$geshi_name] = $l;
|
||||||
}
|
}
|
||||||
$data['ace_modes'] = $acem;
|
$data['ace_modes'] = $acem;
|
||||||
@ -387,23 +325,19 @@ class Main extends CI_Controller
|
|||||||
$data['use_recaptcha'] = $this->use_recaptcha;
|
$data['use_recaptcha'] = $this->use_recaptcha;
|
||||||
$data['recaptcha_publickey'] = $this->recaptcha_publickey;
|
$data['recaptcha_publickey'] = $this->recaptcha_publickey;
|
||||||
|
|
||||||
if (!$this->input->post('submit'))
|
if (!$this->input->post('submit')) {
|
||||||
{
|
|
||||||
|
|
||||||
if (!$this->session->userdata('expire'))
|
if (!$this->session->userdata('expire')) {
|
||||||
{
|
|
||||||
$default_expiration = config_item('default_expiration');
|
$default_expiration = config_item('default_expiration');
|
||||||
$this->session->set_userdata('expire', $default_expiration);
|
$this->session->set_userdata('expire', $default_expiration);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$this->session->userdata('snipurl'))
|
if (!$this->session->userdata('snipurl')) {
|
||||||
{
|
|
||||||
$shorturl_selected = config_item('shorturl_selected');
|
$shorturl_selected = config_item('shorturl_selected');
|
||||||
$this->session->set_userdata('snipurl', $shorturl_selected);
|
$this->session->set_userdata('snipurl', $shorturl_selected);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->session->flashdata('settings_changed'))
|
if ($this->session->flashdata('settings_changed')) {
|
||||||
{
|
|
||||||
$data['status_message'] = 'Settings successfully changed';
|
$data['status_message'] = 'Settings successfully changed';
|
||||||
}
|
}
|
||||||
$data['name_set'] = $this->session->userdata('name');
|
$data['name_set'] = $this->session->userdata('name');
|
||||||
@ -414,14 +348,11 @@ class Main extends CI_Controller
|
|||||||
$data['title_set'] = $title;
|
$data['title_set'] = $title;
|
||||||
$data['reply'] = $reply;
|
$data['reply'] = $reply;
|
||||||
|
|
||||||
if (!$lang)
|
if (!$lang) {
|
||||||
{
|
|
||||||
$lang = config_item('default_language');
|
$lang = config_item('default_language');
|
||||||
}
|
}
|
||||||
$data['lang_set'] = $lang;
|
$data['lang_set'] = $lang;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$data['name_set'] = $this->input->post('name');
|
$data['name_set'] = $this->input->post('name');
|
||||||
$data['expire_set'] = $this->input->post('expire');
|
$data['expire_set'] = $this->input->post('expire');
|
||||||
$data['private_set'] = $this->input->post('private');
|
$data['private_set'] = $this->input->post('private');
|
||||||
@ -434,19 +365,16 @@ class Main extends CI_Controller
|
|||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
function index()
|
public function index()
|
||||||
{
|
{
|
||||||
$this->_valid_authentication();
|
$this->_valid_authentication();
|
||||||
$this->load->helper('json');
|
$this->load->helper('json');
|
||||||
|
|
||||||
if (!$this->input->post('submit'))
|
if (!$this->input->post('submit')) {
|
||||||
{
|
|
||||||
$data = $this->_form_prep();
|
$data = $this->_form_prep();
|
||||||
$this->content_expiration(config_item('content_expiration'));
|
$this->content_expiration(config_item('content_expiration'));
|
||||||
$this->load->view('home', $data);
|
$this->load->view('home', $data);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->load->model('pastes');
|
$this->load->model('pastes');
|
||||||
$this->load->library('form_validation');
|
$this->load->library('form_validation');
|
||||||
|
|
||||||
@ -489,26 +417,20 @@ class Main extends CI_Controller
|
|||||||
$this->form_validation->set_message('min_length', lang('empty'));
|
$this->form_validation->set_message('min_length', lang('empty'));
|
||||||
$this->form_validation->set_error_delimiters('<div class="message error"><div class="container">', '</div></div>');
|
$this->form_validation->set_error_delimiters('<div class="message error"><div class="container">', '</div></div>');
|
||||||
|
|
||||||
if ($this->form_validation->run() == FALSE)
|
if ($this->form_validation->run() == false) {
|
||||||
{
|
|
||||||
$data = $this->_form_prep();
|
$data = $this->_form_prep();
|
||||||
$this->load->view('home', $data);
|
$this->load->view('home', $data);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
|
|
||||||
if (config_item('private_only'))
|
if (config_item('private_only')) {
|
||||||
{
|
|
||||||
$_POST['private'] = 1;
|
$_POST['private'] = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config_item('disable_shorturl'))
|
if (config_item('disable_shorturl')) {
|
||||||
{
|
|
||||||
$_POST['snipurl'] = 0;
|
$_POST['snipurl'] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->input->post('reply') == false)
|
if ($this->input->post('reply') == false) {
|
||||||
{
|
|
||||||
$user_data = array(
|
$user_data = array(
|
||||||
'name' => $this->input->post('name'),
|
'name' => $this->input->post('name'),
|
||||||
'lang' => $this->input->post('lang'),
|
'lang' => $this->input->post('lang'),
|
||||||
@ -523,131 +445,110 @@ class Main extends CI_Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function post_encrypted()
|
public function post_encrypted()
|
||||||
{
|
{
|
||||||
$this->_valid_authentication();
|
$this->_valid_authentication();
|
||||||
|
|
||||||
if ($this->_valid_captcha($this->input->post('captcha')))
|
if ($this->_valid_captcha($this->input->post('captcha'))) {
|
||||||
{
|
|
||||||
$this->load->model('pastes');
|
$this->load->model('pastes');
|
||||||
$_POST['private'] = 1;
|
$_POST['private'] = 1;
|
||||||
$_POST['snipurl'] = 0;
|
$_POST['snipurl'] = 0;
|
||||||
$ret_url = $this->pastes->createPaste();
|
$ret_url = $this->pastes->createPaste();
|
||||||
echo $ret_url;
|
echo $ret_url;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
echo 'E_CAPTCHA';
|
echo 'E_CAPTCHA';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function raw()
|
public function raw()
|
||||||
{
|
{
|
||||||
$this->_valid_authentication();
|
$this->_valid_authentication();
|
||||||
$this->load->model('pastes');
|
$this->load->model('pastes');
|
||||||
$check = $this->pastes->checkPaste(3);
|
$check = $this->pastes->checkPaste(3);
|
||||||
|
|
||||||
if ($check)
|
if ($check) {
|
||||||
{
|
|
||||||
$data = $this->pastes->getPaste(3);
|
$data = $this->pastes->getPaste(3);
|
||||||
|
|
||||||
if (isset($_GET['preview']))
|
if (isset($_GET['preview'])) {
|
||||||
{
|
|
||||||
$this->load->helper('text');
|
$this->load->helper('text');
|
||||||
$data['raw'] = character_limiter($data['raw'], 500);
|
$data['raw'] = character_limiter($data['raw'], 500);
|
||||||
}
|
}
|
||||||
$this->content_expiration(config_item('content_expiration'));
|
$this->content_expiration(config_item('content_expiration'));
|
||||||
$this->load->view('view/raw', $data);
|
$this->load->view('view/raw', $data);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
show_404();
|
show_404();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function rss()
|
public function rss()
|
||||||
{
|
{
|
||||||
$this->_valid_authentication();
|
$this->_valid_authentication();
|
||||||
$this->load->model('pastes');
|
$this->load->model('pastes');
|
||||||
$check = $this->pastes->checkPaste(3);
|
$check = $this->pastes->checkPaste(3);
|
||||||
|
|
||||||
if ($check)
|
if ($check) {
|
||||||
{
|
|
||||||
$this->load->helper('text');
|
$this->load->helper('text');
|
||||||
$paste = $this->pastes->getPaste(3);
|
$paste = $this->pastes->getPaste(3);
|
||||||
$data = $this->pastes->getReplies(3);
|
$data = $this->pastes->getReplies(3);
|
||||||
$data['page_title'] = $paste['title'] . ' - ' . config_item('site_name');
|
$data['page_title'] = $paste['title'] . ' - ' . config_item('site_name');
|
||||||
$data['feed_url'] = site_url('view/rss/' . $this->uri->segment(3));
|
$data['feed_url'] = site_url('view/rss/' . $this->uri->segment(3));
|
||||||
$this->load->view('view/rss', $data);
|
$this->load->view('view/rss', $data);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
show_404();
|
show_404();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function embed()
|
public function embed()
|
||||||
{
|
{
|
||||||
$this->_valid_authentication();
|
$this->_valid_authentication();
|
||||||
$this->load->model('pastes');
|
$this->load->model('pastes');
|
||||||
$check = $this->pastes->checkPaste(3);
|
$check = $this->pastes->checkPaste(3);
|
||||||
|
|
||||||
if ($check)
|
if ($check) {
|
||||||
{
|
|
||||||
$data = $this->pastes->getPaste(3, true, $this->uri->segment(4) == 'diff');
|
$data = $this->pastes->getPaste(3, true, $this->uri->segment(4) == 'diff');
|
||||||
$this->content_expiration(config_item('content_expiration'));
|
$this->content_expiration(config_item('content_expiration'));
|
||||||
$this->load->view('view/embed', $data);
|
$this->load->view('view/embed', $data);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
show_404();
|
show_404();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function qr()
|
public function qr()
|
||||||
{
|
{
|
||||||
$this->load->model('pastes');
|
$this->load->model('pastes');
|
||||||
$check = $this->pastes->checkPaste(3);
|
$check = $this->pastes->checkPaste(3);
|
||||||
|
|
||||||
if ($check)
|
if ($check) {
|
||||||
{
|
|
||||||
$data = $this->pastes->getPaste(3);
|
$data = $this->pastes->getPaste(3);
|
||||||
$this->content_expiration('+1 year');
|
$this->content_expiration('+1 year');
|
||||||
$this->load->view('view/qr', $data);
|
$this->load->view('view/qr', $data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function download()
|
public function download()
|
||||||
{
|
{
|
||||||
$this->_valid_authentication();
|
$this->_valid_authentication();
|
||||||
$this->load->model('pastes');
|
$this->load->model('pastes');
|
||||||
$check = $this->pastes->checkPaste(3);
|
$check = $this->pastes->checkPaste(3);
|
||||||
|
|
||||||
if ($check)
|
if ($check) {
|
||||||
{
|
|
||||||
$data = $this->pastes->getPaste(3);
|
$data = $this->pastes->getPaste(3);
|
||||||
$this->load->view('view/download', $data);
|
$this->load->view('view/download', $data);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
show_404();
|
show_404();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function lists()
|
public function lists()
|
||||||
{
|
{
|
||||||
$this->_valid_authentication();
|
$this->_valid_authentication();
|
||||||
|
|
||||||
if (config_item('private_only'))
|
if (config_item('private_only')) {
|
||||||
{
|
|
||||||
show_404();
|
show_404();
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->load->model('pastes');
|
$this->load->model('pastes');
|
||||||
|
|
||||||
if ($this->uri->segment(2) == 'rss')
|
if ($this->uri->segment(2) == 'rss') {
|
||||||
{
|
|
||||||
$this->load->helper('text');
|
$this->load->helper('text');
|
||||||
$data = $this->pastes->getLists('lists/', 3);
|
$data = $this->pastes->getLists('lists/', 3);
|
||||||
$data['page_title'] = config_item('site_name');
|
$data['page_title'] = config_item('site_name');
|
||||||
@ -655,167 +556,138 @@ class Main extends CI_Controller
|
|||||||
$data['replies'] = $data['pastes'];
|
$data['replies'] = $data['pastes'];
|
||||||
unset($data['pastes']);
|
unset($data['pastes']);
|
||||||
$this->load->view('view/rss', $data);
|
$this->load->view('view/rss', $data);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$data = $this->pastes->getLists('lists/', 2);
|
$data = $this->pastes->getLists('lists/', 2);
|
||||||
$this->load->view('list', $data);
|
$this->load->view('list', $data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function trends()
|
public function trends()
|
||||||
{
|
{
|
||||||
$this->_valid_authentication();
|
$this->_valid_authentication();
|
||||||
|
|
||||||
if (config_item('private_only'))
|
if (config_item('private_only')) {
|
||||||
{
|
|
||||||
show_404();
|
show_404();
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->load->model('pastes');
|
$this->load->model('pastes');
|
||||||
$data = $this->pastes->getTrends();
|
$data = $this->pastes->getTrends();
|
||||||
$this->load->view('trends', $data);
|
$this->load->view('trends', $data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function view()
|
public function view()
|
||||||
{
|
{
|
||||||
$this->_valid_authentication();
|
$this->_valid_authentication();
|
||||||
$this->load->helper('json');
|
$this->load->helper('json');
|
||||||
$this->load->model('pastes');
|
$this->load->model('pastes');
|
||||||
$check = $this->pastes->checkPaste(2);
|
$check = $this->pastes->checkPaste(2);
|
||||||
|
|
||||||
if ($check)
|
if ($check) {
|
||||||
{
|
|
||||||
|
|
||||||
if ($this->session->userdata('view_raw'))
|
if ($this->session->userdata('view_raw')) {
|
||||||
{
|
|
||||||
redirect('view/raw/' . $this->uri->segment(2));
|
redirect('view/raw/' . $this->uri->segment(2));
|
||||||
}
|
}
|
||||||
$data = $this->pastes->getPaste(2, true, $this->uri->segment(3) == 'diff');
|
$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']);
|
$data['reply_form'] = $this->_form_prep($data['lang_code'], 'Re: ' . $data['title'], $data['raw'], $data['pid']);
|
||||||
|
|
||||||
if ($data['private'] == 1)
|
if ($data['private'] == 1) {
|
||||||
{
|
|
||||||
$data['reply_form']['use_recaptcha'] = $this->use_recaptcha;
|
$data['reply_form']['use_recaptcha'] = $this->use_recaptcha;
|
||||||
}
|
}
|
||||||
$this->content_expiration(config_item('content_expiration'));
|
$this->content_expiration(config_item('content_expiration'));
|
||||||
$this->load->view('view/view', $data);
|
$this->load->view('view/view', $data);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
show_404();
|
show_404();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function cron()
|
public function cron()
|
||||||
{
|
{
|
||||||
$this->load->model('pastes');
|
$this->load->model('pastes');
|
||||||
$key = $this->uri->segment(2);
|
$key = $this->uri->segment(2);
|
||||||
|
|
||||||
if ($key != config_item('cron_key'))
|
if ($key != config_item('cron_key')) {
|
||||||
{
|
|
||||||
show_404();
|
show_404();
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->pastes->cron();
|
$this->pastes->cron();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function about()
|
public function about()
|
||||||
{
|
{
|
||||||
$this->load->view('about');
|
$this->load->view('about');
|
||||||
}
|
}
|
||||||
|
|
||||||
function captcha()
|
public function captcha()
|
||||||
{
|
{
|
||||||
$this->load->helper('captcha');
|
$this->load->helper('captcha');
|
||||||
|
|
||||||
//get "word"
|
//get "word"
|
||||||
$pool = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ@';
|
$pool = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ@';
|
||||||
$str = '';
|
$str = '';
|
||||||
for ($i = 0;$i < 8;$i++)
|
for ($i = 0; $i < 8; $i++) {
|
||||||
{
|
|
||||||
$str .= substr($pool, mt_rand(0, strlen($pool) - 1), 1);
|
$str .= substr($pool, mt_rand(0, strlen($pool) - 1), 1);
|
||||||
}
|
}
|
||||||
$word = $str;
|
$word = $str;
|
||||||
|
|
||||||
//save
|
//save
|
||||||
$this->session->set_userdata(array(
|
$this->session->set_userdata(array(
|
||||||
'captcha' => $word
|
'captcha' => $word,
|
||||||
));
|
));
|
||||||
|
|
||||||
//view
|
//view
|
||||||
$this->load->view('view/captcha', array(
|
$this->load->view('view/captcha', array(
|
||||||
'word' => $word
|
'word' => $word,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
function _valid_lang($lang)
|
public function _valid_lang($lang)
|
||||||
{
|
{
|
||||||
$this->load->model('languages');
|
$this->load->model('languages');
|
||||||
$this->form_validation->set_message('_valid_lang', lang('valid_lang'));
|
$this->form_validation->set_message('_valid_lang', lang('valid_lang'));
|
||||||
return $this->languages->valid_language($lang);
|
return $this->languages->valid_language($lang);
|
||||||
}
|
}
|
||||||
|
|
||||||
function _valid_captcha($text)
|
public function _valid_captcha($text)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (config_item('enable_captcha') && $this->session->userdata('is_human') === null)
|
if (config_item('enable_captcha') && $this->session->userdata('is_human') === null) {
|
||||||
{
|
|
||||||
|
|
||||||
if (isset($this->form_validation))
|
if (isset($this->form_validation)) {
|
||||||
{
|
|
||||||
$this->form_validation->set_message('_valid_captcha', lang('captcha'));
|
$this->form_validation->set_message('_valid_captcha', lang('captcha'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->use_recaptcha)
|
if ($this->use_recaptcha) {
|
||||||
{
|
|
||||||
|
|
||||||
if ($this->_valid_recaptcha())
|
if ($this->_valid_recaptcha()) {
|
||||||
{
|
|
||||||
$this->session->set_userdata('is_human', true);
|
$this->session->set_userdata('is_human', true);
|
||||||
return true;
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
else
|
} else {
|
||||||
{
|
|
||||||
|
if (strtolower($text) == strtolower($this->session->userdata('captcha'))) {
|
||||||
|
$this->session->set_userdata('is_human', true);
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
} else {
|
||||||
{
|
|
||||||
|
|
||||||
if (strtolower($text) == strtolower($this->session->userdata('captcha')))
|
|
||||||
{
|
|
||||||
$this->session->set_userdata('is_human', true);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function _valid_recaptcha()
|
public function _valid_recaptcha()
|
||||||
{
|
{
|
||||||
|
|
||||||
if ($this->recaptcha_privatekey == null || $this->recaptcha_privatekey == '')
|
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>");
|
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'))
|
if ($this->input->post('g-recaptcha-response')) {
|
||||||
{
|
|
||||||
$pk = $this->recaptcha_privatekey;
|
$pk = $this->recaptcha_privatekey;
|
||||||
$ra = $_SERVER['REMOTE_ADDR'];
|
$ra = $_SERVER['REMOTE_ADDR'];
|
||||||
$rf = trim($this->input->post('g-recaptcha-response'));
|
$rf = trim($this->input->post('g-recaptcha-response'));
|
||||||
@ -824,39 +696,31 @@ class Main extends CI_Controller
|
|||||||
$status = json_decode($response, true);
|
$status = json_decode($response, true);
|
||||||
$recaptcha_response = new stdClass();
|
$recaptcha_response = new stdClass();
|
||||||
|
|
||||||
if ($status['success'])
|
if ($status['success']) {
|
||||||
{
|
|
||||||
$recaptcha_response->is_valid = true;
|
$recaptcha_response->is_valid = true;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$recaptcha_response->is_valid = false;
|
$recaptcha_response->is_valid = false;
|
||||||
}
|
}
|
||||||
return $recaptcha_response;
|
return $recaptcha_response;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function _valid_ip()
|
public function _valid_ip()
|
||||||
{
|
{
|
||||||
|
|
||||||
//get ip
|
//get ip
|
||||||
$ip_address = $this->input->ip_address();
|
$ip_address = $this->input->ip_address();
|
||||||
|
|
||||||
if (stristr($ip_address, ':'))
|
if (stristr($ip_address, ':')) {
|
||||||
{
|
|
||||||
return $this->_valid_ipv6($ip_address);
|
return $this->_valid_ipv6($ip_address);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
return $this->_valid_ipv4($ip_address);
|
return $this->_valid_ipv4($ip_address);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function _valid_ipv4($ip_address)
|
public function _valid_ipv4($ip_address)
|
||||||
{
|
{
|
||||||
|
|
||||||
//get ip range
|
//get ip range
|
||||||
@ -873,8 +737,7 @@ class Main extends CI_Controller
|
|||||||
|
|
||||||
//check
|
//check
|
||||||
|
|
||||||
if ($query->num_rows() > 0)
|
if ($query->num_rows() > 0) {
|
||||||
{
|
|
||||||
|
|
||||||
//update spamcount
|
//update spamcount
|
||||||
$blocked_ips = $query->result_array();
|
$blocked_ips = $query->result_array();
|
||||||
@ -886,14 +749,12 @@ class Main extends CI_Controller
|
|||||||
|
|
||||||
//return for the validation
|
//return for the validation
|
||||||
return false;
|
return false;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function _valid_ipv6($ip_address)
|
public function _valid_ipv6($ip_address)
|
||||||
{
|
{
|
||||||
|
|
||||||
//setup message
|
//setup message
|
||||||
@ -906,8 +767,7 @@ class Main extends CI_Controller
|
|||||||
|
|
||||||
//check
|
//check
|
||||||
|
|
||||||
if ($query->num_rows() > 0)
|
if ($query->num_rows() > 0) {
|
||||||
{
|
|
||||||
|
|
||||||
//update spamcount
|
//update spamcount
|
||||||
$blocked_ips = $query->result_array();
|
$blocked_ips = $query->result_array();
|
||||||
@ -919,14 +779,12 @@ class Main extends CI_Controller
|
|||||||
|
|
||||||
//return for the validation
|
//return for the validation
|
||||||
return false;
|
return false;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function _blockwords_check()
|
public function _blockwords_check()
|
||||||
{
|
{
|
||||||
|
|
||||||
//setup message
|
//setup message
|
||||||
@ -936,25 +794,22 @@ class Main extends CI_Controller
|
|||||||
$blocked_words = config_item('blocked_words');
|
$blocked_words = config_item('blocked_words');
|
||||||
$post = $this->input->post();
|
$post = $this->input->post();
|
||||||
|
|
||||||
if (!$blocked_words)
|
if (!$blocked_words) {
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//we have blocked words
|
//we have blocked words
|
||||||
foreach (explode(',', $blocked_words) as $word)
|
foreach (explode(',', $blocked_words) as $word) {
|
||||||
{
|
|
||||||
$word = trim($word);
|
$word = trim($word);
|
||||||
|
|
||||||
if (stristr($post['code'], $word) || stristr($post['title'], $word))
|
if (stristr($post['code'], $word) || stristr($post['title'], $word)) {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function _autofill_check()
|
public function _autofill_check()
|
||||||
{
|
{
|
||||||
|
|
||||||
//setup message
|
//setup message
|
||||||
@ -964,21 +819,19 @@ class Main extends CI_Controller
|
|||||||
return (!$this->input->post('email') && !$this->input->post('url'));
|
return (!$this->input->post('email') && !$this->input->post('url'));
|
||||||
}
|
}
|
||||||
|
|
||||||
function _valid_authentication()
|
public function _valid_authentication()
|
||||||
{
|
{
|
||||||
|
|
||||||
if (config_item('require_auth'))
|
if (config_item('require_auth')) {
|
||||||
{
|
|
||||||
|
|
||||||
if (!$this->auth_ldap->is_authenticated())
|
if (!$this->auth_ldap->is_authenticated()) {
|
||||||
{
|
|
||||||
$this->session->set_flashdata('tried_to', "/" . $this->uri->uri_string());
|
$this->session->set_flashdata('tried_to', "/" . $this->uri->uri_string());
|
||||||
redirect('/auth');
|
redirect('/auth');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_cm_js()
|
public function get_cm_js()
|
||||||
{
|
{
|
||||||
$lang = $this->uri->segment(3);
|
$lang = $this->uri->segment(3);
|
||||||
$this->load->config('codemirror_languages');
|
$this->load->config('codemirror_languages');
|
||||||
@ -987,46 +840,39 @@ class Main extends CI_Controller
|
|||||||
//file path
|
//file path
|
||||||
$file_path = 'themes/' . config_item('theme') . '/js/';
|
$file_path = 'themes/' . config_item('theme') . '/js/';
|
||||||
|
|
||||||
if (!file_exists($file_path))
|
if (!file_exists($file_path)) {
|
||||||
{
|
|
||||||
$file_path = 'themes/default/js/';
|
$file_path = 'themes/default/js/';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($cml[$lang]) && gettype($cml[$lang]) == 'array')
|
if (isset($cml[$lang]) && gettype($cml[$lang]) == 'array') {
|
||||||
{
|
|
||||||
header('Content-Type: application/x-javascript; charset=utf-8');
|
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));
|
header('Expires: ' . gmdate('D, d M Y H:i:s \G\M\T', time() + 60 * 60 * 24 * 30));
|
||||||
foreach ($cml[$lang]['js'] as $js)
|
foreach ($cml[$lang]['js'] as $js) {
|
||||||
{
|
|
||||||
echo file_get_contents($file_path . $js[0]);
|
echo file_get_contents($file_path . $js[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
function error_404()
|
public function error_404()
|
||||||
{
|
{
|
||||||
show_404();
|
show_404();
|
||||||
}
|
}
|
||||||
|
|
||||||
function robots_txt()
|
public function robots_txt()
|
||||||
{
|
{
|
||||||
|
|
||||||
if (config_item('disallow_search_engines'))
|
if (config_item('disallow_search_engines')) {
|
||||||
{
|
|
||||||
header('Content-Type: text/plain; charset=utf-8');
|
header('Content-Type: text/plain; charset=utf-8');
|
||||||
$this->load->view('robots_txt');
|
$this->load->view('robots_txt');
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
echo '';
|
echo '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function content_expiration($cache_time)
|
public function content_expiration($cache_time)
|
||||||
{
|
|
||||||
if(!$cache_time)
|
|
||||||
{
|
{
|
||||||
|
if (!$cache_time) {
|
||||||
$cache_time = '-1 week';
|
$cache_time = '-1 week';
|
||||||
}
|
}
|
||||||
$cache_expiration = strtotime($cache_time);
|
$cache_expiration = strtotime($cache_time);
|
||||||
|
@ -1,20 +1,11 @@
|
|||||||
<?php
|
<?php if (!defined('BASEPATH')) {
|
||||||
/**
|
exit('No direct script access allowed');
|
||||||
* Class and Function List:
|
}
|
||||||
* Function list:
|
|
||||||
* - __construct()
|
|
||||||
* - index()
|
|
||||||
* - spam_detail()
|
|
||||||
* - blacklist()
|
|
||||||
* - unblock_ip()
|
|
||||||
* Classes list:
|
|
||||||
* - Spamadmin extends CI_Controller
|
|
||||||
*/
|
|
||||||
|
|
||||||
class Spamadmin extends CI_Controller
|
class Spamadmin extends CI_Controller
|
||||||
{
|
{
|
||||||
|
|
||||||
function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
|
||||||
@ -31,32 +22,27 @@ class Spamadmin extends CI_Controller
|
|||||||
|
|
||||||
// If they're not set, set them to blank. The null coalesce operator would be handy here, but
|
// 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...
|
// that's PHP 7.0 and higher...
|
||||||
if (empty($_SERVER['PHP_AUTH_USER']))
|
if (empty($_SERVER['PHP_AUTH_USER'])) {
|
||||||
{
|
|
||||||
$_SERVER['PHP_AUTH_USER'] = "";
|
$_SERVER['PHP_AUTH_USER'] = "";
|
||||||
}
|
}
|
||||||
if (empty($_SERVER['PHP_AUTH_PW']))
|
if (empty($_SERVER['PHP_AUTH_PW'])) {
|
||||||
{
|
|
||||||
$_SERVER['PHP_AUTH_PW'] = "";
|
$_SERVER['PHP_AUTH_PW'] = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($user === '' || $pass === '' || $_SERVER['PHP_AUTH_USER'] !== $user || $_SERVER['PHP_AUTH_PW'] !== $pass)
|
if ($user === '' || $pass === '' || $_SERVER['PHP_AUTH_USER'] !== $user || $_SERVER['PHP_AUTH_PW'] !== $pass) {
|
||||||
{
|
|
||||||
header('WWW-Authenticate: Basic realm="Spamadmin"');
|
header('WWW-Authenticate: Basic realm="Spamadmin"');
|
||||||
header('HTTP/1.0 401 Unauthorized');
|
header('HTTP/1.0 401 Unauthorized');
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function index()
|
public function index()
|
||||||
{
|
{
|
||||||
$this->load->model('pastes');
|
$this->load->model('pastes');
|
||||||
$pastes_to_delete = $this->input->post('pastes_to_delete');
|
$pastes_to_delete = $this->input->post('pastes_to_delete');
|
||||||
|
|
||||||
if ($pastes_to_delete)
|
if ($pastes_to_delete) {
|
||||||
{
|
foreach (explode(' ', $pastes_to_delete) as $pid) {
|
||||||
foreach (explode(' ', $pastes_to_delete) as $pid)
|
|
||||||
{
|
|
||||||
$this->db->where('pid', $pid);
|
$this->db->where('pid', $pid);
|
||||||
$this->db->delete('pastes');
|
$this->db->delete('pastes');
|
||||||
}
|
}
|
||||||
@ -68,25 +54,22 @@ class Spamadmin extends CI_Controller
|
|||||||
$this->load->view('list_ips', $data);
|
$this->load->view('list_ips', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
function spam_detail()
|
public function spam_detail()
|
||||||
{
|
{
|
||||||
$this->load->model('pastes');
|
$this->load->model('pastes');
|
||||||
$ip_address = $this->uri->segment(2);
|
$ip_address = $this->uri->segment(2);
|
||||||
|
|
||||||
if ($this->input->post('confirm_remove') && $ip_address != '')
|
if ($this->input->post('confirm_remove') && $ip_address != '') {
|
||||||
{
|
|
||||||
$this->db->where('ip_address', $ip_address);
|
$this->db->where('ip_address', $ip_address);
|
||||||
$this->db->delete('pastes');
|
$this->db->delete('pastes');
|
||||||
$paste_count = $this->db->affected_rows();
|
$paste_count = $this->db->affected_rows();
|
||||||
|
|
||||||
if ($this->input->post('block_ip'))
|
if ($this->input->post('block_ip')) {
|
||||||
{
|
|
||||||
$query = $this->db->get_where('blocked_ips', array(
|
$query = $this->db->get_where('blocked_ips', array(
|
||||||
'ip_address' => $ip_address
|
'ip_address' => $ip_address,
|
||||||
));
|
));
|
||||||
|
|
||||||
if ($query->num_rows() == 0)
|
if ($query->num_rows() == 0) {
|
||||||
{
|
|
||||||
$this->db->insert('blocked_ips', array(
|
$this->db->insert('blocked_ips', array(
|
||||||
'ip_address' => $ip_address,
|
'ip_address' => $ip_address,
|
||||||
'blocked_at' => time(),
|
'blocked_at' => time(),
|
||||||
@ -101,13 +84,10 @@ class Spamadmin extends CI_Controller
|
|||||||
$data['ip_address'] = $ip_address;
|
$data['ip_address'] = $ip_address;
|
||||||
$ip = explode('.', $ip_address);
|
$ip = explode('.', $ip_address);
|
||||||
|
|
||||||
if (count($ip) > 1)
|
if (count($ip) > 1) {
|
||||||
{
|
|
||||||
$ip_firstpart = $ip[0] . '.' . $ip[1] . '.';
|
$ip_firstpart = $ip[0] . '.' . $ip[1] . '.';
|
||||||
$data['ip_range'] = $ip_firstpart . '*.*';
|
$data['ip_range'] = $ip_firstpart . '*.*';
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
|
|
||||||
// ipv6
|
// ipv6
|
||||||
$ip = explode(':', $ip_address);
|
$ip = explode(':', $ip_address);
|
||||||
@ -119,7 +99,7 @@ class Spamadmin extends CI_Controller
|
|||||||
$this->load->view('spam_detail', $data);
|
$this->load->view('spam_detail', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
function blacklist()
|
public function blacklist()
|
||||||
{
|
{
|
||||||
|
|
||||||
//pagination
|
//pagination
|
||||||
@ -149,7 +129,7 @@ class Spamadmin extends CI_Controller
|
|||||||
$this->load->view('list_blocked_ips', $data);
|
$this->load->view('list_blocked_ips', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
function unblock_ip()
|
public function unblock_ip()
|
||||||
{
|
{
|
||||||
$ip_address = $this->uri->segment(4);
|
$ip_address = $this->uri->segment(4);
|
||||||
$this->db->where('ip_address', $ip_address);
|
$this->db->where('ip_address', $ip_address);
|
||||||
|
@ -1,73 +1,54 @@
|
|||||||
<?php
|
<?php if (!defined('BASEPATH')) {
|
||||||
/**
|
exit('No direct script access allowed');
|
||||||
* Class and Function List:
|
}
|
||||||
* Function list:
|
|
||||||
* - __construct()
|
|
||||||
* - css()
|
|
||||||
* - fonts()
|
|
||||||
* - images()
|
|
||||||
* - js()
|
|
||||||
* - _expires_header()
|
|
||||||
* Classes list:
|
|
||||||
* - Theme_assets extends CI_Controller
|
|
||||||
*/
|
|
||||||
|
|
||||||
class Theme_assets extends CI_Controller
|
class Theme_assets extends CI_Controller
|
||||||
{
|
{
|
||||||
|
|
||||||
function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
$this->theme = config_item('theme');
|
$this->theme = config_item('theme');
|
||||||
}
|
}
|
||||||
|
|
||||||
function css()
|
public function css()
|
||||||
{
|
{
|
||||||
$css_file = $this->uri->segment(4);
|
$css_file = $this->uri->segment(4);
|
||||||
$css_file = basename($css_file); // Fix LFI Vulnerability
|
$css_file = basename($css_file); // Fix LFI Vulnerability
|
||||||
|
|
||||||
|
if ($css_file == 'fonts') {
|
||||||
if ($css_file == 'fonts')
|
|
||||||
{
|
|
||||||
$font_file = $this->uri->segment(5);
|
$font_file = $this->uri->segment(5);
|
||||||
$font_file = basename($font_file);
|
$font_file = basename($font_file);
|
||||||
|
|
||||||
//file path
|
//file path
|
||||||
$file_path = 'themes/' . $this->theme . '/css/fonts/' . $font_file;
|
$file_path = 'themes/' . $this->theme . '/css/fonts/' . $font_file;
|
||||||
|
|
||||||
if (!file_exists($file_path))
|
if (!file_exists($file_path)) {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$path_parts = pathinfo(dirname(dirname(dirname(__FILE__))) . '/' . $file_path);
|
$path_parts = pathinfo(dirname(dirname(dirname(__FILE__))) . '/' . $file_path);
|
||||||
|
|
||||||
if ($path_parts['extension'] == "woff")
|
if ($path_parts['extension'] == "woff") {
|
||||||
{
|
|
||||||
header('Content-type: application/font-woff');
|
header('Content-type: application/font-woff');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($path_parts['extension'] == "eot")
|
if ($path_parts['extension'] == "eot") {
|
||||||
{
|
|
||||||
header('Content-type: application/vnd.ms-fontobject');
|
header('Content-type: application/vnd.ms-fontobject');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($path_parts['extension'] == "ttf" || $path_parts['extension'] == "ttc")
|
if ($path_parts['extension'] == "ttf" || $path_parts['extension'] == "ttc") {
|
||||||
{
|
|
||||||
header('Content-type: application/x-font-ttf');
|
header('Content-type: application/x-font-ttf');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($path_parts['extension'] == "otf")
|
if ($path_parts['extension'] == "otf") {
|
||||||
{
|
|
||||||
header('Content-type: font/opentype');
|
header('Content-type: font/opentype');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($path_parts['extension'] == "svg")
|
if ($path_parts['extension'] == "svg") {
|
||||||
{
|
|
||||||
header('Content-type: image/svg+xml');
|
header('Content-type: image/svg+xml');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($path_parts['extension'] == "svgz")
|
if ($path_parts['extension'] == "svgz") {
|
||||||
{
|
|
||||||
header("Content-Encoding: gzip");
|
header("Content-Encoding: gzip");
|
||||||
header('Content-type: image/svg+xml');
|
header('Content-type: image/svg+xml');
|
||||||
}
|
}
|
||||||
@ -75,24 +56,20 @@ class Theme_assets extends CI_Controller
|
|||||||
//send
|
//send
|
||||||
$this->_expires_header(1);
|
$this->_expires_header(1);
|
||||||
readfile($file_path);
|
readfile($file_path);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
|
|
||||||
//file path
|
//file path
|
||||||
$file_path = 'themes/' . $this->theme . '/css/' . $css_file;
|
$file_path = 'themes/' . $this->theme . '/css/' . $css_file;
|
||||||
|
|
||||||
//fallback to default css if view in theme not found
|
//fallback to default css if view in theme not found
|
||||||
|
|
||||||
if (!file_exists($file_path))
|
if (!file_exists($file_path)) {
|
||||||
{
|
|
||||||
$file_path = 'themes/default/css/' . $css_file;
|
$file_path = 'themes/default/css/' . $css_file;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Double checking file
|
// Double checking file
|
||||||
|
|
||||||
if (!file_exists($file_path))
|
if (!file_exists($file_path)) {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,7 +80,7 @@ class Theme_assets extends CI_Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function fonts()
|
public function fonts()
|
||||||
{
|
{
|
||||||
$font_file = $this->uri->segment(4);
|
$font_file = $this->uri->segment(4);
|
||||||
|
|
||||||
@ -113,42 +90,34 @@ class Theme_assets extends CI_Controller
|
|||||||
//no fallback to default, since default has no such fonts
|
//no fallback to default, since default has no such fonts
|
||||||
//since no fallbcack, there is no doucle checking for file
|
//since no fallbcack, there is no doucle checking for file
|
||||||
|
|
||||||
|
if (!file_exists($file_path)) {
|
||||||
if (!file_exists($file_path))
|
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//send
|
//send
|
||||||
$path_parts = pathinfo(dirname(dirname(dirname(__FILE__))) . '/' . $file_path);
|
$path_parts = pathinfo(dirname(dirname(dirname(__FILE__))) . '/' . $file_path);
|
||||||
|
|
||||||
if ($path_parts['extension'] == "woff")
|
if ($path_parts['extension'] == "woff") {
|
||||||
{
|
|
||||||
header('Content-type: application/font-woff');
|
header('Content-type: application/font-woff');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($path_parts['extension'] == "eot")
|
if ($path_parts['extension'] == "eot") {
|
||||||
{
|
|
||||||
header('Content-type: application/vnd.ms-fontobject');
|
header('Content-type: application/vnd.ms-fontobject');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($path_parts['extension'] == "ttf" || $path_parts['extension'] == "ttc")
|
if ($path_parts['extension'] == "ttf" || $path_parts['extension'] == "ttc") {
|
||||||
{
|
|
||||||
header('Content-type: application/x-font-ttf');
|
header('Content-type: application/x-font-ttf');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($path_parts['extension'] == "otf")
|
if ($path_parts['extension'] == "otf") {
|
||||||
{
|
|
||||||
header('Content-type: font/opentype');
|
header('Content-type: font/opentype');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($path_parts['extension'] == "svg")
|
if ($path_parts['extension'] == "svg") {
|
||||||
{
|
|
||||||
header('Content-type: image/svg+xml');
|
header('Content-type: image/svg+xml');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($path_parts['extension'] == "svgz")
|
if ($path_parts['extension'] == "svgz") {
|
||||||
{
|
|
||||||
header("Content-Encoding: gzip");
|
header("Content-Encoding: gzip");
|
||||||
header('Content-type: image/svg+xml');
|
header('Content-type: image/svg+xml');
|
||||||
}
|
}
|
||||||
@ -156,7 +125,7 @@ class Theme_assets extends CI_Controller
|
|||||||
readfile($file_path);
|
readfile($file_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
function images()
|
public function images()
|
||||||
{
|
{
|
||||||
$image_file = $this->uri->segment(4);
|
$image_file = $this->uri->segment(4);
|
||||||
$image_file = basename($image_file);
|
$image_file = basename($image_file);
|
||||||
@ -166,15 +135,13 @@ class Theme_assets extends CI_Controller
|
|||||||
|
|
||||||
//fallback to default css if view in theme not found
|
//fallback to default css if view in theme not found
|
||||||
|
|
||||||
if (!file_exists($file_path))
|
if (!file_exists($file_path)) {
|
||||||
{
|
|
||||||
$file_path = 'themes/default/images/' . $image_file;
|
$file_path = 'themes/default/images/' . $image_file;
|
||||||
}
|
}
|
||||||
|
|
||||||
// double checking file
|
// double checking file
|
||||||
|
|
||||||
if (!file_exists($file_path))
|
if (!file_exists($file_path)) {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -185,7 +152,7 @@ class Theme_assets extends CI_Controller
|
|||||||
readfile($file_path);
|
readfile($file_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
function js()
|
public function js()
|
||||||
{
|
{
|
||||||
|
|
||||||
//get js
|
//get js
|
||||||
@ -201,15 +168,13 @@ class Theme_assets extends CI_Controller
|
|||||||
|
|
||||||
//fallback to default js if js in theme not found
|
//fallback to default js if js in theme not found
|
||||||
|
|
||||||
if (!file_exists($file_path))
|
if (!file_exists($file_path)) {
|
||||||
{
|
|
||||||
$file_path = 'themes/default/js/' . $js_file;
|
$file_path = 'themes/default/js/' . $js_file;
|
||||||
}
|
}
|
||||||
|
|
||||||
// return empty string if not found, to not mess up existing JS
|
// return empty string if not found, to not mess up existing JS
|
||||||
|
|
||||||
if (!file_exists($file_path))
|
if (!file_exists($file_path)) {
|
||||||
{
|
|
||||||
header('HTTP/1.1 404 Not Found');
|
header('HTTP/1.1 404 Not Found');
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
@ -219,8 +184,7 @@ class Theme_assets extends CI_Controller
|
|||||||
$this->_expires_header(30);
|
$this->_expires_header(30);
|
||||||
readfile($file_path);
|
readfile($file_path);
|
||||||
}
|
}
|
||||||
private
|
private function _expires_header($days)
|
||||||
function _expires_header($days)
|
|
||||||
{
|
{
|
||||||
header('Expires: ' . gmdate('D, d M Y H:i:s \G\M\T', time() + 60 * 60 * 24 * $days));
|
header('Expires: ' . gmdate('D, d M Y H:i:s \G\M\T', time() + 60 * 60 * 24 * $days));
|
||||||
}
|
}
|
||||||
|
@ -1,29 +1,22 @@
|
|||||||
<?php
|
<?php if (!defined('BASEPATH')) {
|
||||||
/**
|
exit('No direct script access allowed');
|
||||||
* Class and Function List:
|
}
|
||||||
* Function list:
|
|
||||||
* - __construct()
|
|
||||||
* - index()
|
|
||||||
* Classes list:
|
|
||||||
* - Unittest extends CI_Controller
|
|
||||||
*/
|
|
||||||
|
|
||||||
class Unittest extends CI_Controller
|
class Unittest extends CI_Controller
|
||||||
{
|
{
|
||||||
|
|
||||||
function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
|
||||||
//protection
|
//protection
|
||||||
|
|
||||||
if ($_SERVER['HTTP_HOST'] != 'stikked')
|
if ($_SERVER['HTTP_HOST'] != 'stikked') {
|
||||||
{
|
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function index()
|
public function index()
|
||||||
{
|
{
|
||||||
$this->load->library('unit_test');
|
$this->load->library('unit_test');
|
||||||
$this->load->model('pastes');
|
$this->load->model('pastes');
|
||||||
|
@ -1,26 +1,17 @@
|
|||||||
<?php
|
<?php if (!defined('BASEPATH')) {
|
||||||
/**
|
exit('No direct script access allowed');
|
||||||
* 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');
|
|
||||||
|
|
||||||
class MY_Loader extends CI_Loader
|
class MY_Loader extends CI_Loader
|
||||||
{
|
{
|
||||||
|
|
||||||
function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
log_message('debug', 'MY_Loader Class Initialized');
|
log_message('debug', 'MY_Loader Class Initialized');
|
||||||
}
|
}
|
||||||
|
|
||||||
function view($view, $vars = array() , $return = FALSE)
|
public function view($view, $vars = array(), $return = false)
|
||||||
{
|
{
|
||||||
|
|
||||||
//theme name
|
//theme name
|
||||||
@ -31,8 +22,7 @@ class MY_Loader extends CI_Loader
|
|||||||
|
|
||||||
//fallback to default view if view in theme not found
|
//fallback to default view if view in theme not found
|
||||||
|
|
||||||
if (!file_exists($view_path))
|
if (!file_exists($view_path)) {
|
||||||
{
|
|
||||||
$view_path = 'themes/default/views/' . $view . '.php';
|
$view_path = 'themes/default/views/' . $view . '.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -40,7 +30,7 @@ class MY_Loader extends CI_Loader
|
|||||||
return $this->_ci_load(array(
|
return $this->_ci_load(array(
|
||||||
'_ci_view' => $view_path,
|
'_ci_view' => $view_path,
|
||||||
'_ci_vars' => $this->_ci_prepare_view_vars($vars),
|
'_ci_vars' => $this->_ci_prepare_view_vars($vars),
|
||||||
'_ci_return' => $return
|
'_ci_return' => $return,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,8 +49,7 @@ class MY_Loader extends CI_Loader
|
|||||||
* @param array $_ci_data Data to load
|
* @param array $_ci_data Data to load
|
||||||
* @return object
|
* @return object
|
||||||
*/
|
*/
|
||||||
protected
|
protected function _ci_load($_ci_data)
|
||||||
function _ci_load($_ci_data)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
// Set the default data variables
|
// Set the default data variables
|
||||||
@ -68,26 +57,21 @@ class MY_Loader extends CI_Loader
|
|||||||
'_ci_view',
|
'_ci_view',
|
||||||
'_ci_vars',
|
'_ci_vars',
|
||||||
'_ci_path',
|
'_ci_path',
|
||||||
'_ci_return'
|
'_ci_return',
|
||||||
) as $_ci_val)
|
) as $_ci_val) {
|
||||||
{
|
$$_ci_val = isset($_ci_data[$_ci_val]) ? $_ci_data[$_ci_val] : false;
|
||||||
$$_ci_val = isset($_ci_data[$_ci_val]) ? $_ci_data[$_ci_val] : FALSE;
|
|
||||||
}
|
}
|
||||||
$file_exists = FALSE;
|
$file_exists = false;
|
||||||
|
|
||||||
// Set the path to the requested file
|
// Set the path to the requested file
|
||||||
|
|
||||||
if (is_string($_ci_path) && $_ci_path !== '')
|
if (is_string($_ci_path) && $_ci_path !== '') {
|
||||||
{
|
|
||||||
$_ci_x = explode('/', $_ci_path);
|
$_ci_x = explode('/', $_ci_path);
|
||||||
$_ci_file = end($_ci_x);
|
$_ci_file = end($_ci_x);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$_ci_ext = pathinfo($_ci_view, PATHINFO_EXTENSION);
|
$_ci_ext = pathinfo($_ci_view, PATHINFO_EXTENSION);
|
||||||
$_ci_file = ($_ci_ext === '') ? $_ci_view . '.php' : $_ci_view;
|
$_ci_file = ($_ci_ext === '') ? $_ci_view . '.php' : $_ci_view;
|
||||||
foreach ($this->_ci_view_paths as $_ci_view_file => $cascade)
|
foreach ($this->_ci_view_paths as $_ci_view_file => $cascade) {
|
||||||
{
|
|
||||||
|
|
||||||
/* *** modification for stikked themes ***
|
/* *** modification for stikked themes ***
|
||||||
*
|
*
|
||||||
@ -98,22 +82,19 @@ class MY_Loader extends CI_Loader
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (file_exists(FCPATH . $_ci_file))
|
if (file_exists(FCPATH . $_ci_file)) {
|
||||||
{
|
|
||||||
$_ci_path = FCPATH . $_ci_file;
|
$_ci_path = FCPATH . $_ci_file;
|
||||||
$file_exists = TRUE;
|
$file_exists = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$cascade)
|
if (!$cascade) {
|
||||||
{
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$file_exists && !file_exists($_ci_path))
|
if (!$file_exists && !file_exists($_ci_path)) {
|
||||||
{
|
|
||||||
show_error('Unable to load the requested file: ' . $_ci_file);
|
show_error('Unable to load the requested file: ' . $_ci_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -121,11 +102,9 @@ class MY_Loader extends CI_Loader
|
|||||||
// to become accessible from within the Controller and Model functions.
|
// to become accessible from within the Controller and Model functions.
|
||||||
|
|
||||||
$_ci_CI = &get_instance();
|
$_ci_CI = &get_instance();
|
||||||
foreach (get_object_vars($_ci_CI) as $_ci_key => $_ci_var)
|
foreach (get_object_vars($_ci_CI) as $_ci_key => $_ci_var) {
|
||||||
{
|
|
||||||
|
|
||||||
if (!isset($this->$_ci_key))
|
if (!isset($this->$_ci_key)) {
|
||||||
{
|
|
||||||
$this->$_ci_key = &$_ci_CI->$_ci_key;
|
$this->$_ci_key = &$_ci_CI->$_ci_key;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -139,8 +118,7 @@ class MY_Loader extends CI_Loader
|
|||||||
* other views can have access to these variables.
|
* other views can have access to these variables.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (is_array($_ci_vars))
|
if (is_array($_ci_vars)) {
|
||||||
{
|
|
||||||
$this->_ci_cached_vars = array_merge($this->_ci_cached_vars, $_ci_vars);
|
$this->_ci_cached_vars = array_merge($this->_ci_cached_vars, $_ci_vars);
|
||||||
}
|
}
|
||||||
extract($this->_ci_cached_vars);
|
extract($this->_ci_cached_vars);
|
||||||
@ -163,23 +141,17 @@ class MY_Loader extends CI_Loader
|
|||||||
|
|
||||||
// to standard PHP echo statements.
|
// to standard PHP echo statements.
|
||||||
|
|
||||||
|
if (!is_php('5.4') && !ini_get('short_open_tag') && config_item('rewrite_short_tags') === true) {
|
||||||
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))));
|
echo eval('?>' . preg_replace('/;*\s*\?>/', '; ?>', str_replace('<?=', '<?php echo ', file_get_contents($_ci_path))));
|
||||||
}
|
} else {
|
||||||
else
|
include $_ci_path; // include() vs include_once() allows for multiple views with the same name
|
||||||
{
|
|
||||||
include ($_ci_path); // include() vs include_once() allows for multiple views with the same name
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
log_message('info', 'File loaded: ' . $_ci_path);
|
log_message('info', 'File loaded: ' . $_ci_path);
|
||||||
|
|
||||||
// Return the file data if requested
|
// Return the file data if requested
|
||||||
|
|
||||||
if ($_ci_return === TRUE)
|
if ($_ci_return === true) {
|
||||||
{
|
|
||||||
$buffer = ob_get_contents();
|
$buffer = ob_get_contents();
|
||||||
@ob_end_clean();
|
@ob_end_clean();
|
||||||
return $buffer;
|
return $buffer;
|
||||||
@ -195,12 +167,9 @@ class MY_Loader extends CI_Loader
|
|||||||
* template and any subsequent ones. Oy!
|
* template and any subsequent ones. Oy!
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (ob_get_level() > $this->_ci_ob_level + 1)
|
if (ob_get_level() > $this->_ci_ob_level + 1) {
|
||||||
{
|
|
||||||
ob_end_flush();
|
ob_end_flush();
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$_ci_CI->output->append_output(ob_get_contents());
|
$_ci_CI->output->append_output(ob_get_contents());
|
||||||
@ob_end_clean();
|
@ob_end_clean();
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,7 @@
|
|||||||
<?php
|
<?php if (!defined('BASEPATH')) {
|
||||||
/**
|
exit('No direct script access allowed');
|
||||||
* Class and Function List:
|
}
|
||||||
* Function list:
|
|
||||||
* - create_captcha()
|
|
||||||
* - display_captcha()
|
|
||||||
* - b()
|
|
||||||
* Classes list:
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (!defined('BASEPATH')) exit('No direct script access allowed');
|
|
||||||
/**
|
/**
|
||||||
* CodeIgniter
|
* CodeIgniter
|
||||||
*
|
*
|
||||||
@ -48,8 +41,7 @@ if (!defined('BASEPATH')) exit('No direct script access allowed');
|
|||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!function_exists('create_captcha'))
|
if (!function_exists('create_captcha')) {
|
||||||
{
|
|
||||||
|
|
||||||
function create_captcha($data = '', $img_path = '', $img_url = '', $font_path = '')
|
function create_captcha($data = '', $img_path = '', $img_url = '', $font_path = '')
|
||||||
{
|
{
|
||||||
@ -60,43 +52,34 @@ if (!function_exists('create_captcha'))
|
|||||||
'img_width' => '150',
|
'img_width' => '150',
|
||||||
'img_height' => '30',
|
'img_height' => '30',
|
||||||
'font_path' => '',
|
'font_path' => '',
|
||||||
'expiration' => 7200
|
'expiration' => 7200,
|
||||||
);
|
);
|
||||||
foreach ($defaults as $key => $val)
|
foreach ($defaults as $key => $val) {
|
||||||
{
|
|
||||||
|
|
||||||
if (!is_array($data))
|
if (!is_array($data)) {
|
||||||
{
|
|
||||||
|
|
||||||
if (!isset($$key) OR $$key == '')
|
if (!isset($$key) or $$key == '') {
|
||||||
{
|
|
||||||
$$key = $val;
|
$$key = $val;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$$key = (!isset($data[$key])) ? $val : $data[$key];
|
$$key = (!isset($data[$key])) ? $val : $data[$key];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($img_path == '' OR $img_url == '')
|
if ($img_path == '' or $img_url == '') {
|
||||||
{
|
return false;
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!@is_dir($img_path))
|
if (!@is_dir($img_path)) {
|
||||||
{
|
return false;
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_writable($img_path))
|
if (!is_writable($img_path)) {
|
||||||
{
|
return false;
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!extension_loaded('gd'))
|
if (!extension_loaded('gd')) {
|
||||||
{
|
return false;
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// -----------------------------------
|
// -----------------------------------
|
||||||
@ -107,15 +90,12 @@ if (!function_exists('create_captcha'))
|
|||||||
list($usec, $sec) = explode(" ", microtime());
|
list($usec, $sec) = explode(" ", microtime());
|
||||||
$now = ((float) $usec + (float) $sec);
|
$now = ((float) $usec + (float) $sec);
|
||||||
$current_dir = @opendir($img_path);
|
$current_dir = @opendir($img_path);
|
||||||
while ($filename = @readdir($current_dir))
|
while ($filename = @readdir($current_dir)) {
|
||||||
{
|
|
||||||
|
|
||||||
if ($filename != "." and $filename != ".." and $filename != "index.html")
|
if ($filename != "." and $filename != ".." and $filename != "index.html") {
|
||||||
{
|
|
||||||
$name = str_replace(".jpg", "", $filename);
|
$name = str_replace(".jpg", "", $filename);
|
||||||
|
|
||||||
if (($name + $expiration) < $now)
|
if (($name + $expiration) < $now) {
|
||||||
{
|
|
||||||
@unlink($img_path . $filename);
|
@unlink($img_path . $filename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -127,13 +107,10 @@ if (!function_exists('create_captcha'))
|
|||||||
|
|
||||||
// -----------------------------------
|
// -----------------------------------
|
||||||
|
|
||||||
|
if ($word == '') {
|
||||||
if ($word == '')
|
|
||||||
{
|
|
||||||
$pool = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
$pool = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||||
$str = '';
|
$str = '';
|
||||||
for ($i = 0;$i < 8;$i++)
|
for ($i = 0; $i < 8; $i++) {
|
||||||
{
|
|
||||||
$str .= substr($pool, mt_rand(0, strlen($pool) - 1), 1);
|
$str .= substr($pool, mt_rand(0, strlen($pool) - 1), 1);
|
||||||
}
|
}
|
||||||
$word = $str;
|
$word = $str;
|
||||||
@ -156,13 +133,9 @@ if (!function_exists('create_captcha'))
|
|||||||
|
|
||||||
// PHP.net recommends imagecreatetruecolor(), but it isn't always available
|
// PHP.net recommends imagecreatetruecolor(), but it isn't always available
|
||||||
|
|
||||||
|
if (function_exists('imagecreatetruecolor')) {
|
||||||
if (function_exists('imagecreatetruecolor'))
|
|
||||||
{
|
|
||||||
$im = imagecreatetruecolor($img_width, $img_height);
|
$im = imagecreatetruecolor($img_width, $img_height);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$im = imagecreate($img_width, $img_height);
|
$im = imagecreate($img_width, $img_height);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -194,8 +167,7 @@ if (!function_exists('create_captcha'))
|
|||||||
$radius = 16;
|
$radius = 16;
|
||||||
$circles = 20;
|
$circles = 20;
|
||||||
$points = 32;
|
$points = 32;
|
||||||
for ($i = 0;$i < ($circles * $points) - 1;$i++)
|
for ($i = 0; $i < ($circles * $points) - 1; $i++) {
|
||||||
{
|
|
||||||
$theta = $theta + $thetac;
|
$theta = $theta + $thetac;
|
||||||
$rad = $radius * ($i / $points);
|
$rad = $radius * ($i / $points);
|
||||||
$x = ($rad * cos($theta)) + $x_axis;
|
$x = ($rad * cos($theta)) + $x_axis;
|
||||||
@ -213,31 +185,24 @@ if (!function_exists('create_captcha'))
|
|||||||
|
|
||||||
// -----------------------------------
|
// -----------------------------------
|
||||||
|
|
||||||
$use_font = ($font_path != '' AND file_exists($font_path) AND function_exists('imagettftext')) ? TRUE : FALSE;
|
$use_font = ($font_path != '' and file_exists($font_path) and function_exists('imagettftext')) ? true : false;
|
||||||
|
|
||||||
if ($use_font == FALSE)
|
if ($use_font == false) {
|
||||||
{
|
|
||||||
$font_size = 5;
|
$font_size = 5;
|
||||||
$x = rand(0, $img_width / ($length / 3));
|
$x = rand(0, $img_width / ($length / 3));
|
||||||
$y = 0;
|
$y = 0;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$font_size = 16;
|
$font_size = 16;
|
||||||
$x = rand(0, $img_width / ($length / 1.5));
|
$x = rand(0, $img_width / ($length / 1.5));
|
||||||
$y = $font_size + 2;
|
$y = $font_size + 2;
|
||||||
}
|
}
|
||||||
for ($i = 0;$i < strlen($word);$i++)
|
for ($i = 0; $i < strlen($word); $i++) {
|
||||||
{
|
|
||||||
|
|
||||||
if ($use_font == FALSE)
|
if ($use_font == false) {
|
||||||
{
|
|
||||||
$y = rand(0, $img_height / 2);
|
$y = rand(0, $img_height / 2);
|
||||||
imagestring($im, $font_size, $x, $y, substr($word, $i, 1), $text_color);
|
imagestring($im, $font_size, $x, $y, substr($word, $i, 1), $text_color);
|
||||||
$x += ($font_size * 2);
|
$x += ($font_size * 2);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$y = rand($img_height / 2, $img_height - 3);
|
$y = rand($img_height / 2, $img_height - 3);
|
||||||
imagettftext($im, $font_size, $angle, $x, $y, $text_color, $font_path, substr($word, $i, 1));
|
imagettftext($im, $font_size, $angle, $x, $y, $text_color, $font_path, substr($word, $i, 1));
|
||||||
$x += $font_size;
|
$x += $font_size;
|
||||||
@ -263,7 +228,7 @@ if (!function_exists('create_captcha'))
|
|||||||
return array(
|
return array(
|
||||||
'word' => $word,
|
'word' => $word,
|
||||||
'time' => $now,
|
'time' => $now,
|
||||||
'image' => $img
|
'image' => $img,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -274,8 +239,7 @@ if (!function_exists('create_captcha'))
|
|||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!function_exists('display_captcha'))
|
if (!function_exists('display_captcha')) {
|
||||||
{
|
|
||||||
|
|
||||||
function display_captcha($word = '')
|
function display_captcha($word = '')
|
||||||
{
|
{
|
||||||
@ -289,28 +253,22 @@ if (!function_exists('display_captcha'))
|
|||||||
'img_width' => '180',
|
'img_width' => '180',
|
||||||
'img_height' => '40',
|
'img_height' => '40',
|
||||||
'font_path' => '',
|
'font_path' => '',
|
||||||
'expiration' => 7200
|
'expiration' => 7200,
|
||||||
);
|
);
|
||||||
foreach ($defaults as $key => $val)
|
foreach ($defaults as $key => $val) {
|
||||||
{
|
|
||||||
|
|
||||||
if (!is_array($data))
|
if (!is_array($data)) {
|
||||||
{
|
|
||||||
|
|
||||||
if (!isset($$key) OR $$key == '')
|
if (!isset($$key) or $$key == '') {
|
||||||
{
|
|
||||||
$$key = $val;
|
$$key = $val;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$$key = (!isset($data[$key])) ? $val : $data[$key];
|
$$key = (!isset($data[$key])) ? $val : $data[$key];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!extension_loaded('gd'))
|
if (!extension_loaded('gd')) {
|
||||||
{
|
return false;
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// -----------------------------------
|
// -----------------------------------
|
||||||
@ -318,13 +276,10 @@ if (!function_exists('display_captcha'))
|
|||||||
|
|
||||||
// -----------------------------------
|
// -----------------------------------
|
||||||
|
|
||||||
|
if ($word == '') {
|
||||||
if ($word == '')
|
|
||||||
{
|
|
||||||
$pool = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
$pool = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||||
$str = '';
|
$str = '';
|
||||||
for ($i = 0;$i < 4;$i++)
|
for ($i = 0; $i < 4; $i++) {
|
||||||
{
|
|
||||||
$str .= substr($pool, mt_rand(0, strlen($pool) - 1), 1);
|
$str .= substr($pool, mt_rand(0, strlen($pool) - 1), 1);
|
||||||
}
|
}
|
||||||
$word = $str;
|
$word = $str;
|
||||||
@ -348,13 +303,9 @@ if (!function_exists('display_captcha'))
|
|||||||
|
|
||||||
// PHP.net recommends imagecreatetruecolor(), but it isn't always available
|
// PHP.net recommends imagecreatetruecolor(), but it isn't always available
|
||||||
|
|
||||||
|
if (function_exists('imagecreatetruecolor')) {
|
||||||
if (function_exists('imagecreatetruecolor'))
|
|
||||||
{
|
|
||||||
$im = imagecreatetruecolor($img_width, $img_height);
|
$im = imagecreatetruecolor($img_width, $img_height);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$im = imagecreate($img_width, $img_height);
|
$im = imagecreate($img_width, $img_height);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -363,7 +314,6 @@ if (!function_exists('display_captcha'))
|
|||||||
|
|
||||||
// -----------------------------------
|
// -----------------------------------
|
||||||
|
|
||||||
|
|
||||||
function b()
|
function b()
|
||||||
{
|
{
|
||||||
return mt_rand(240, 255);
|
return mt_rand(240, 255);
|
||||||
@ -391,8 +341,7 @@ if (!function_exists('display_captcha'))
|
|||||||
$radius = 16;
|
$radius = 16;
|
||||||
$circles = 20;
|
$circles = 20;
|
||||||
$points = 32;
|
$points = 32;
|
||||||
for ($i = 0;$i < ($circles * $points) - 1;$i++)
|
for ($i = 0; $i < ($circles * $points) - 1; $i++) {
|
||||||
{
|
|
||||||
$theta = $theta + $thetac;
|
$theta = $theta + $thetac;
|
||||||
$rad = $radius * ($i / $points);
|
$rad = $radius * ($i / $points);
|
||||||
$x = ($rad * cos($theta)) + $x_axis;
|
$x = ($rad * cos($theta)) + $x_axis;
|
||||||
@ -415,31 +364,24 @@ if (!function_exists('display_captcha'))
|
|||||||
$fn = explode(',', '4,5,6,8,16,17,19,24,26');
|
$fn = explode(',', '4,5,6,8,16,17,19,24,26');
|
||||||
$f = mt_rand(0, count($fn) - 1);
|
$f = mt_rand(0, count($fn) - 1);
|
||||||
$font_path = './static/fonts/font' . $fn[$f] . '.ttf';
|
$font_path = './static/fonts/font' . $fn[$f] . '.ttf';
|
||||||
$use_font = ($font_path != '' AND file_exists($font_path) AND function_exists('imagettftext')) ? TRUE : FALSE;
|
$use_font = ($font_path != '' and file_exists($font_path) and function_exists('imagettftext')) ? true : false;
|
||||||
|
|
||||||
if ($use_font == FALSE)
|
if ($use_font == false) {
|
||||||
{
|
|
||||||
$font_size = 5;
|
$font_size = 5;
|
||||||
$x = mt_rand(0, $img_width / ($length / 3));
|
$x = mt_rand(0, $img_width / ($length / 3));
|
||||||
$y = 0;
|
$y = 0;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$font_size = 16;
|
$font_size = 16;
|
||||||
$x = mt_rand(0, $img_width / ($length / 1.5));
|
$x = mt_rand(0, $img_width / ($length / 1.5));
|
||||||
$y = $font_size + 2;
|
$y = $font_size + 2;
|
||||||
}
|
}
|
||||||
for ($i = 0;$i < strlen($word);$i++)
|
for ($i = 0; $i < strlen($word); $i++) {
|
||||||
{
|
|
||||||
|
|
||||||
if ($use_font == FALSE)
|
if ($use_font == false) {
|
||||||
{
|
|
||||||
$y = mt_rand(0, $img_height / 2);
|
$y = mt_rand(0, $img_height / 2);
|
||||||
imagestring($im, $font_size, $x, $y, substr($word, $i, 1), $text_color);
|
imagestring($im, $font_size, $x, $y, substr($word, $i, 1), $text_color);
|
||||||
$x += ($font_size * 2);
|
$x += ($font_size * 2);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$y = mt_rand($img_height / 2, $img_height - 3);
|
$y = mt_rand($img_height / 2, $img_height - 3);
|
||||||
imagettftext($im, $font_size, $angle, $x, $y, $text_color, $font_path, substr($word, $i, 1));
|
imagettftext($im, $font_size, $angle, $x, $y, $text_color, $font_path, substr($word, $i, 1));
|
||||||
$x += $font_size;
|
$x += $font_size;
|
||||||
@ -467,5 +409,4 @@ if (!function_exists('display_captcha'))
|
|||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
/* End of file captcha_helper.php */
|
/* End of file captcha_helper.php */
|
||||||
|
|
||||||
|
|
||||||
/* Location: ./system/heleprs/captcha_helper.php */
|
/* Location: ./system/heleprs/captcha_helper.php */
|
||||||
|
@ -1,19 +1,13 @@
|
|||||||
<?php
|
<?php if (!defined('BASEPATH')) {
|
||||||
/**
|
exit('No direct script access allowed');
|
||||||
* Class and Function List:
|
}
|
||||||
* Function list:
|
|
||||||
* - json_encode()
|
|
||||||
* Classes list:
|
|
||||||
*/
|
|
||||||
//If you are on a version of PHP before 5.2, this might help:
|
|
||||||
|
|
||||||
if (!function_exists('json_encode'))
|
//If you are on a version of PHP before 5.2, this might help:
|
||||||
{
|
if (!function_exists('json_encode')) {
|
||||||
|
|
||||||
function json_encode($data)
|
function json_encode($data)
|
||||||
{
|
{
|
||||||
switch ($type = gettype($data))
|
switch ($type = gettype($data)) {
|
||||||
{
|
|
||||||
case 'NULL':
|
case 'NULL':
|
||||||
return 'null';
|
return 'null';
|
||||||
case 'boolean':
|
case 'boolean':
|
||||||
@ -30,29 +24,23 @@ if (!function_exists('json_encode'))
|
|||||||
$output_index_count = 0;
|
$output_index_count = 0;
|
||||||
$output_indexed = array();
|
$output_indexed = array();
|
||||||
$output_associative = array();
|
$output_associative = array();
|
||||||
foreach ($data as $key => $value)
|
foreach ($data as $key => $value) {
|
||||||
{
|
|
||||||
$output_indexed[] = json_encode($value);
|
$output_indexed[] = json_encode($value);
|
||||||
$output_associative[] = json_encode($key) . ':' . json_encode($value);
|
$output_associative[] = json_encode($key) . ':' . json_encode($value);
|
||||||
|
|
||||||
if ($output_index_count !== NULL && $output_index_count++ !== $key)
|
if ($output_index_count !== null && $output_index_count++ !== $key) {
|
||||||
{
|
$output_index_count = null;
|
||||||
$output_index_count = NULL;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($output_index_count !== NULL)
|
if ($output_index_count !== null) {
|
||||||
{
|
|
||||||
return '[' . implode(',', $output_indexed) . ']';
|
return '[' . implode(',', $output_indexed) . ']';
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
return '{' . implode(',', $output_associative) . '}';
|
return '{' . implode(',', $output_associative) . '}';
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
return ''; // Not supported
|
return ''; // Not supported
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,7 @@
|
|||||||
<?php
|
<?php if (!defined('BASEPATH')) {
|
||||||
/**
|
exit('No direct script access allowed');
|
||||||
* Class and Function List:
|
}
|
||||||
* Function list:
|
|
||||||
* - lang()
|
|
||||||
* - random_expire_msg()
|
|
||||||
* Classes list:
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (!defined('BASEPATH')) exit('No direct script access allowed');
|
|
||||||
/**
|
/**
|
||||||
* CodeIgniter
|
* CodeIgniter
|
||||||
*
|
*
|
||||||
@ -47,16 +41,14 @@ if (!defined('BASEPATH')) exit('No direct script access allowed');
|
|||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!function_exists('lang'))
|
if (!function_exists('lang')) {
|
||||||
{
|
|
||||||
|
|
||||||
function lang($index, $id = '')
|
function lang($index, $id = '')
|
||||||
{
|
{
|
||||||
$CI = &get_instance();
|
$CI = &get_instance();
|
||||||
$line = $CI->lang->line($index);
|
$line = $CI->lang->line($index);
|
||||||
|
|
||||||
if ($id != '')
|
if ($id != '') {
|
||||||
{
|
|
||||||
$line = '<label for="' . $id . '">' . $line . "</label>";
|
$line = '<label for="' . $id . '">' . $line . "</label>";
|
||||||
}
|
}
|
||||||
return ($line != '' ? $line : '[' . $index . ']');
|
return ($line != '' ? $line : '[' . $index . ']');
|
||||||
@ -71,8 +63,7 @@ if (!function_exists('lang'))
|
|||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!function_exists('random_expire_msg'))
|
if (!function_exists('random_expire_msg')) {
|
||||||
{
|
|
||||||
|
|
||||||
function random_expire_msg()
|
function random_expire_msg()
|
||||||
{
|
{
|
||||||
@ -85,5 +76,4 @@ if (!function_exists('random_expire_msg'))
|
|||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
/* End of file language_helper.php */
|
/* End of file language_helper.php */
|
||||||
|
|
||||||
|
|
||||||
/* Location: ./system/helpers/language_helper.php */
|
/* Location: ./system/helpers/language_helper.php */
|
||||||
|
@ -44,18 +44,18 @@ define("RECAPTCHA_VERIFY_SERVER", "www.google.com");
|
|||||||
* @param $data - array of string elements to be encoded
|
* @param $data - array of string elements to be encoded
|
||||||
* @return string - encoded request
|
* @return string - encoded request
|
||||||
*/
|
*/
|
||||||
function _recaptcha_qsencode ($data) {
|
function _recaptcha_qsencode($data)
|
||||||
|
{
|
||||||
$req = "";
|
$req = "";
|
||||||
foreach ( $data as $key => $value )
|
foreach ($data as $key => $value) {
|
||||||
$req .= $key . '=' . urlencode(stripslashes($value)) . '&';
|
$req .= $key . '=' . urlencode(stripslashes($value)) . '&';
|
||||||
|
}
|
||||||
|
|
||||||
// Cut the last '&'
|
// Cut the last '&'
|
||||||
$req = substr($req, 0, strlen($req) - 1);
|
$req = substr($req, 0, strlen($req) - 1);
|
||||||
return $req;
|
return $req;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Submits an HTTP POST to a reCAPTCHA server
|
* Submits an HTTP POST to a reCAPTCHA server
|
||||||
* @param string $host
|
* @param string $host
|
||||||
@ -64,7 +64,8 @@ function _recaptcha_qsencode ($data) {
|
|||||||
* @param int port
|
* @param int port
|
||||||
* @return array response
|
* @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);
|
||||||
|
|
||||||
@ -83,16 +84,16 @@ function _recaptcha_http_post($host, $path, $data, $port = 80) {
|
|||||||
|
|
||||||
fwrite($fs, $http_request);
|
fwrite($fs, $http_request);
|
||||||
|
|
||||||
while ( !feof($fs) )
|
while (!feof($fs)) {
|
||||||
$response .= fgets($fs, 1160); // One TCP-IP packet
|
$response .= fgets($fs, 1160);
|
||||||
|
}
|
||||||
|
// One TCP-IP packet
|
||||||
fclose($fs);
|
fclose($fs);
|
||||||
$response = explode("\r\n\r\n", $response, 2);
|
$response = explode("\r\n\r\n", $response, 2);
|
||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the challenge HTML (javascript and non-javascript version).
|
* Gets the challenge HTML (javascript and non-javascript version).
|
||||||
* This is called from the browser, and the resulting reCAPTCHA HTML widget
|
* This is called from the browser, and the resulting reCAPTCHA HTML widget
|
||||||
@ -122,7 +123,6 @@ function recaptcha_get_html ($pubkey, $error = null, $use_ssl = false)
|
|||||||
return '<script src=\'https://www.google.com/recaptcha/api.js\'></script>
|
return '<script src=\'https://www.google.com/recaptcha/api.js\'></script>
|
||||||
<div class="g-recaptcha" data-sitekey="' . $pubkey . '"></div>';
|
<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>
|
<noscript>
|
||||||
@ -132,18 +132,15 @@ function recaptcha_get_html ($pubkey, $error = null, $use_ssl = false)
|
|||||||
</noscript>';*/
|
</noscript>';*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A ReCaptchaResponse is returned from recaptcha_check_answer()
|
* A ReCaptchaResponse is returned from recaptcha_check_answer()
|
||||||
*/
|
*/
|
||||||
class ReCaptchaResponse {
|
class ReCaptchaResponse
|
||||||
var $is_valid;
|
{
|
||||||
var $error;
|
public $is_valid;
|
||||||
|
public $error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calls an HTTP POST function to verify if the user's guess was correct
|
* Calls an HTTP POST function to verify if the user's guess was correct
|
||||||
* @param string $privkey
|
* @param string $privkey
|
||||||
@ -163,8 +160,6 @@ function recaptcha_check_answer ($privkey, $remoteip, $challenge, $response, $ex
|
|||||||
die("For security reasons, you must pass the remote ip to reCAPTCHA");
|
die("For security reasons, you must pass the remote ip to reCAPTCHA");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//discard spam submissions
|
//discard spam submissions
|
||||||
if ($challenge == null || strlen($challenge) == 0 || $response == null || strlen($response) == 0) {
|
if ($challenge == null || strlen($challenge) == 0 || $response == null || strlen($response) == 0) {
|
||||||
$recaptcha_response = new ReCaptchaResponse();
|
$recaptcha_response = new ReCaptchaResponse();
|
||||||
@ -178,7 +173,7 @@ function recaptcha_check_answer ($privkey, $remoteip, $challenge, $response, $ex
|
|||||||
'privatekey' => $privkey,
|
'privatekey' => $privkey,
|
||||||
'remoteip' => $remoteip,
|
'remoteip' => $remoteip,
|
||||||
'challenge' => $challenge,
|
'challenge' => $challenge,
|
||||||
'response' => $response
|
'response' => $response,
|
||||||
) + $extra_params
|
) + $extra_params
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -187,8 +182,7 @@ function recaptcha_check_answer ($privkey, $remoteip, $challenge, $response, $ex
|
|||||||
|
|
||||||
if (trim($answers[0]) == 'true') {
|
if (trim($answers[0]) == 'true') {
|
||||||
$recaptcha_response->is_valid = true;
|
$recaptcha_response->is_valid = true;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$recaptcha_response->is_valid = false;
|
$recaptcha_response->is_valid = false;
|
||||||
$recaptcha_response->error = $answers[1];
|
$recaptcha_response->error = $answers[1];
|
||||||
}
|
}
|
||||||
@ -203,11 +197,13 @@ function recaptcha_check_answer ($privkey, $remoteip, $challenge, $response, $ex
|
|||||||
* @param string $domain The domain where the page is hosted
|
* @param string $domain The domain where the page is hosted
|
||||||
* @param string $appname The name of your application
|
* @param string $appname The name of your application
|
||||||
*/
|
*/
|
||||||
function recaptcha_get_signup_url ($domain = null, $appname = null) {
|
function recaptcha_get_signup_url($domain = null, $appname = null)
|
||||||
|
{
|
||||||
return "https://www.google.com/recaptcha/admin/create?" . _recaptcha_qsencode(array('domains' => $domain, 'app' => $appname));
|
return "https://www.google.com/recaptcha/admin/create?" . _recaptcha_qsencode(array('domains' => $domain, 'app' => $appname));
|
||||||
}
|
}
|
||||||
|
|
||||||
function _recaptcha_aes_pad($val) {
|
function _recaptcha_aes_pad($val)
|
||||||
|
{
|
||||||
$block_size = 16;
|
$block_size = 16;
|
||||||
$numpad = $block_size - (strlen($val) % $block_size);
|
$numpad = $block_size - (strlen($val) % $block_size);
|
||||||
return str_pad($val, strlen($val) + $numpad, chr($numpad));
|
return str_pad($val, strlen($val) + $numpad, chr($numpad));
|
||||||
@ -215,7 +211,8 @@ function _recaptcha_aes_pad($val) {
|
|||||||
|
|
||||||
/* Mailhide related code */
|
/* Mailhide related code */
|
||||||
|
|
||||||
function _recaptcha_aes_encrypt($val,$ky) {
|
function _recaptcha_aes_encrypt($val, $ky)
|
||||||
|
{
|
||||||
if (!function_exists("mcrypt_encrypt")) {
|
if (!function_exists("mcrypt_encrypt")) {
|
||||||
die("To use reCAPTCHA Mailhide, you need to have the mcrypt php module installed.");
|
die("To use reCAPTCHA Mailhide, you need to have the mcrypt php module installed.");
|
||||||
}
|
}
|
||||||
@ -225,19 +222,19 @@ function _recaptcha_aes_encrypt($val,$ky) {
|
|||||||
return mcrypt_encrypt($enc, $ky, $val, $mode, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0");
|
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)
|
||||||
function _recaptcha_mailhide_urlbase64 ($x) {
|
{
|
||||||
return strtr(base64_encode($x), '+/', '-_');
|
return strtr(base64_encode($x), '+/', '-_');
|
||||||
}
|
}
|
||||||
|
|
||||||
/* gets the reCAPTCHA Mailhide url for a given email, public key and private key */
|
/* gets the reCAPTCHA Mailhide url for a given email, public key and private key */
|
||||||
function recaptcha_mailhide_url($pubkey, $privkey, $email) {
|
function recaptcha_mailhide_url($pubkey, $privkey, $email)
|
||||||
|
{
|
||||||
if ($pubkey == '' || $pubkey == null || $privkey == "" || $privkey == null) {
|
if ($pubkey == '' || $pubkey == null || $privkey == "" || $privkey == null) {
|
||||||
die("To use reCAPTCHA Mailhide, you have to sign up for a public and private key, " .
|
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>");
|
"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);
|
$ky = pack('H*', $privkey);
|
||||||
$cryptmail = _recaptcha_aes_encrypt($email, $ky);
|
$cryptmail = _recaptcha_aes_encrypt($email, $ky);
|
||||||
|
|
||||||
@ -249,7 +246,8 @@ function recaptcha_mailhide_url($pubkey, $privkey, $email) {
|
|||||||
* eg, given johndoe@example,com return ["john", "example.com"].
|
* eg, given johndoe@example,com return ["john", "example.com"].
|
||||||
* the email is then displayed as john...@example.com
|
* the email is then displayed as john...@example.com
|
||||||
*/
|
*/
|
||||||
function _recaptcha_mailhide_email_parts ($email) {
|
function _recaptcha_mailhide_email_parts($email)
|
||||||
|
{
|
||||||
$arr = preg_split("/@/", $email);
|
$arr = preg_split("/@/", $email);
|
||||||
|
|
||||||
if (strlen($arr[0]) <= 4) {
|
if (strlen($arr[0]) <= 4) {
|
||||||
@ -268,7 +266,8 @@ function _recaptcha_mailhide_email_parts ($email) {
|
|||||||
*
|
*
|
||||||
* http://www.google.com/recaptcha/mailhide/apikey
|
* http://www.google.com/recaptcha/mailhide/apikey
|
||||||
*/
|
*/
|
||||||
function recaptcha_mailhide_html($pubkey, $privkey, $email) {
|
function recaptcha_mailhide_html($pubkey, $privkey, $email)
|
||||||
|
{
|
||||||
$emailparts = _recaptcha_mailhide_email_parts($email);
|
$emailparts = _recaptcha_mailhide_email_parts($email);
|
||||||
$url = recaptcha_mailhide_url($pubkey, $privkey, $email);
|
$url = recaptcha_mailhide_url($pubkey, $privkey, $email);
|
||||||
|
|
||||||
@ -276,6 +275,3 @@ function recaptcha_mailhide_html($pubkey, $privkey, $email) {
|
|||||||
"' 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]);
|
"' 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]);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
@ -1,61 +1,48 @@
|
|||||||
<?php
|
<?php if (!defined('BASEPATH')) {
|
||||||
/**
|
exit('No direct script access allowed');
|
||||||
* Class and Function List:
|
}
|
||||||
* Function list:
|
|
||||||
* - __construct()
|
|
||||||
* - valid_language()
|
|
||||||
* - get_languages()
|
|
||||||
* - code_to_description()
|
|
||||||
* Classes list:
|
|
||||||
* - Languages extends CI_Model
|
|
||||||
*/
|
|
||||||
|
|
||||||
class Languages extends CI_Model
|
class Languages extends CI_Model
|
||||||
{
|
{
|
||||||
|
|
||||||
function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
$this->load->config('geshi_languages');
|
$this->load->config('geshi_languages');
|
||||||
$this->geshi_languages = $this->config->item('geshi_languages');
|
$this->geshi_languages = $this->config->item('geshi_languages');
|
||||||
$this->favorite_languages = $this->config->item('favorite_languages');
|
$this->favorite_languages = $this->config->item('favorite_languages');
|
||||||
|
|
||||||
if ($this->favorite_languages === NULL)
|
if ($this->favorite_languages === null) {
|
||||||
{
|
|
||||||
$this->load->config('config');
|
$this->load->config('config');
|
||||||
$this->favorite_languages = $this->config->item('favorite_languages');
|
$this->favorite_languages = $this->config->item('favorite_languages');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function valid_language($lang)
|
public function valid_language($lang)
|
||||||
{
|
{
|
||||||
return array_key_exists($lang, $this->geshi_languages);
|
return array_key_exists($lang, $this->geshi_languages);
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_languages()
|
public function get_languages()
|
||||||
{
|
{
|
||||||
$data = array();
|
$data = array();
|
||||||
|
|
||||||
if (is_array($this->favorite_languages))
|
if (is_array($this->favorite_languages)) {
|
||||||
{
|
foreach ($this->favorite_languages as $key) {
|
||||||
foreach ($this->favorite_languages as $key)
|
|
||||||
{
|
|
||||||
$data[$key] = $this->geshi_languages[$key];
|
$data[$key] = $this->geshi_languages[$key];
|
||||||
}
|
}
|
||||||
$data["0"] = "-----------------";
|
$data["0"] = "-----------------";
|
||||||
}
|
}
|
||||||
foreach ($this->geshi_languages as $key => $value)
|
foreach ($this->geshi_languages as $key => $value) {
|
||||||
{
|
|
||||||
|
|
||||||
if (!in_array($key, $data))
|
if (!in_array($key, $data)) {
|
||||||
{
|
|
||||||
$data[$key] = $value;
|
$data[$key] = $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
function code_to_description($code)
|
public function code_to_description($code)
|
||||||
{
|
{
|
||||||
return $this->geshi_languages[$code];
|
return $this->geshi_languages[$code];
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -63,8 +63,7 @@
|
|||||||
* Different environments will require different levels of error reporting.
|
* Different environments will require different levels of error reporting.
|
||||||
* By default development will show errors but testing and live will hide them.
|
* By default development will show errors but testing and live will hide them.
|
||||||
*/
|
*/
|
||||||
switch (ENVIRONMENT)
|
switch (ENVIRONMENT) {
|
||||||
{
|
|
||||||
case 'development':
|
case 'development':
|
||||||
error_reporting(-1);
|
error_reporting(-1);
|
||||||
ini_set('display_errors', 1);
|
ini_set('display_errors', 1);
|
||||||
@ -73,18 +72,15 @@ switch (ENVIRONMENT)
|
|||||||
case 'testing':
|
case 'testing':
|
||||||
case 'production':
|
case 'production':
|
||||||
ini_set('display_errors', 0);
|
ini_set('display_errors', 0);
|
||||||
if (version_compare(PHP_VERSION, '5.3', '>='))
|
if (version_compare(PHP_VERSION, '5.3', '>=')) {
|
||||||
{
|
|
||||||
error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED);
|
error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_USER_NOTICE);
|
error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_USER_NOTICE);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
header('HTTP/1.1 503 Service Unavailable.', TRUE, 503);
|
header('HTTP/1.1 503 Service Unavailable.', true, 503);
|
||||||
echo 'The application environment is not set correctly.';
|
echo 'The application environment is not set correctly.';
|
||||||
exit(1); // EXIT_ERROR
|
exit(1); // EXIT_ERROR
|
||||||
}
|
}
|
||||||
@ -131,7 +127,6 @@ switch (ENVIRONMENT)
|
|||||||
*/
|
*/
|
||||||
$view_folder = 'themes/default/views';
|
$view_folder = 'themes/default/views';
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* --------------------------------------------------------------------
|
* --------------------------------------------------------------------
|
||||||
* DEFAULT CONTROLLER
|
* DEFAULT CONTROLLER
|
||||||
@ -161,7 +156,6 @@ switch (ENVIRONMENT)
|
|||||||
// The controller function you wish to be called.
|
// The controller function you wish to be called.
|
||||||
// $routing['function'] = '';
|
// $routing['function'] = '';
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* -------------------------------------------------------------------
|
* -------------------------------------------------------------------
|
||||||
* CUSTOM CONFIG VALUES
|
* CUSTOM CONFIG VALUES
|
||||||
@ -178,8 +172,6 @@ switch (ENVIRONMENT)
|
|||||||
*/
|
*/
|
||||||
// $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
|
// END OF USER CONFIGURABLE SETTINGS. DO NOT EDIT BELOW THIS LINE
|
||||||
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
||||||
@ -191,17 +183,13 @@ switch (ENVIRONMENT)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// Set the current directory correctly for CLI requests
|
// Set the current directory correctly for CLI requests
|
||||||
if (defined('STDIN'))
|
if (defined('STDIN')) {
|
||||||
{
|
|
||||||
chdir(dirname(__FILE__));
|
chdir(dirname(__FILE__));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($_temp = realpath($system_path)) !== FALSE)
|
if (($_temp = realpath($system_path)) !== false) {
|
||||||
{
|
|
||||||
$system_path = $_temp . DIRECTORY_SEPARATOR;
|
$system_path = $_temp . DIRECTORY_SEPARATOR;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
// Ensure there's a trailing slash
|
// Ensure there's a trailing slash
|
||||||
$system_path = strtr(
|
$system_path = strtr(
|
||||||
rtrim($system_path, '/\\'),
|
rtrim($system_path, '/\\'),
|
||||||
@ -211,9 +199,8 @@ switch (ENVIRONMENT)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Is the system path correct?
|
// Is the system path correct?
|
||||||
if ( ! is_dir($system_path))
|
if (!is_dir($system_path)) {
|
||||||
{
|
header('HTTP/1.1 503 Service Unavailable.', true, 503);
|
||||||
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);
|
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
|
exit(3); // EXIT_CONFIG
|
||||||
}
|
}
|
||||||
@ -236,32 +223,24 @@ switch (ENVIRONMENT)
|
|||||||
define('SYSDIR', basename(BASEPATH));
|
define('SYSDIR', basename(BASEPATH));
|
||||||
|
|
||||||
// The path to the "application" directory
|
// The path to the "application" directory
|
||||||
if (is_dir($application_folder))
|
if (is_dir($application_folder)) {
|
||||||
{
|
if (($_temp = realpath($application_folder)) !== false) {
|
||||||
if (($_temp = realpath($application_folder)) !== FALSE)
|
|
||||||
{
|
|
||||||
$application_folder = $_temp;
|
$application_folder = $_temp;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$application_folder = strtr(
|
$application_folder = strtr(
|
||||||
rtrim($application_folder, '/\\'),
|
rtrim($application_folder, '/\\'),
|
||||||
'/\\',
|
'/\\',
|
||||||
DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR
|
DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
} elseif (is_dir(BASEPATH . $application_folder . DIRECTORY_SEPARATOR)) {
|
||||||
elseif (is_dir(BASEPATH.$application_folder.DIRECTORY_SEPARATOR))
|
|
||||||
{
|
|
||||||
$application_folder = BASEPATH . strtr(
|
$application_folder = BASEPATH . strtr(
|
||||||
trim($application_folder, '/\\'),
|
trim($application_folder, '/\\'),
|
||||||
'/\\',
|
'/\\',
|
||||||
DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR
|
DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR
|
||||||
);
|
);
|
||||||
}
|
} else {
|
||||||
else
|
header('HTTP/1.1 503 Service Unavailable.', true, 503);
|
||||||
{
|
|
||||||
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;
|
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
|
exit(3); // EXIT_CONFIG
|
||||||
}
|
}
|
||||||
@ -269,36 +248,26 @@ switch (ENVIRONMENT)
|
|||||||
define('APPPATH', $application_folder . DIRECTORY_SEPARATOR);
|
define('APPPATH', $application_folder . DIRECTORY_SEPARATOR);
|
||||||
|
|
||||||
// The path to the "views" directory
|
// The path to the "views" directory
|
||||||
if ( ! isset($view_folder[0]) && is_dir(APPPATH.'views'.DIRECTORY_SEPARATOR))
|
if (!isset($view_folder[0]) && is_dir(APPPATH . 'views' . DIRECTORY_SEPARATOR)) {
|
||||||
{
|
|
||||||
$view_folder = APPPATH . 'views';
|
$view_folder = APPPATH . 'views';
|
||||||
}
|
} elseif (is_dir($view_folder)) {
|
||||||
elseif (is_dir($view_folder))
|
if (($_temp = realpath($view_folder)) !== false) {
|
||||||
{
|
|
||||||
if (($_temp = realpath($view_folder)) !== FALSE)
|
|
||||||
{
|
|
||||||
$view_folder = $_temp;
|
$view_folder = $_temp;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$view_folder = strtr(
|
$view_folder = strtr(
|
||||||
rtrim($view_folder, '/\\'),
|
rtrim($view_folder, '/\\'),
|
||||||
'/\\',
|
'/\\',
|
||||||
DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR
|
DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
} elseif (is_dir(APPPATH . $view_folder . DIRECTORY_SEPARATOR)) {
|
||||||
elseif (is_dir(APPPATH.$view_folder.DIRECTORY_SEPARATOR))
|
|
||||||
{
|
|
||||||
$view_folder = APPPATH . strtr(
|
$view_folder = APPPATH . strtr(
|
||||||
trim($view_folder, '/\\'),
|
trim($view_folder, '/\\'),
|
||||||
'/\\',
|
'/\\',
|
||||||
DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR
|
DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR
|
||||||
);
|
);
|
||||||
}
|
} else {
|
||||||
else
|
header('HTTP/1.1 503 Service Unavailable.', true, 503);
|
||||||
{
|
|
||||||
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;
|
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
|
exit(3); // EXIT_CONFIG
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user