Compare commits

..

No commits in common. "master" and "0.13.0" have entirely different histories.

51 changed files with 5837 additions and 5592 deletions

1
.dockerignore Normal file
View File

@ -0,0 +1 @@
.git*

23
Dockerfile Normal file
View File

@ -0,0 +1,23 @@
FROM php:7.1-apache
EXPOSE 80
# Note that 'vim' and 'mysql-client' are changed to an echo,
# as they're only useful when debugging, and leaving them in
# the standard container only increases its size.
RUN apt-get -y update && \
apt-get -y install libpng-dev zlib1g-dev cron && \
echo apt-get -y install vim mysql-client && \
a2enmod rewrite && \
docker-php-ext-install mysqli gd && \
rm -rf /var/lib/apt/lists/*
COPY htdocs /var/www/html
COPY htdocs/application/config/stikked.php.dist /var/www/html/application/config/stikked.php
# This overwrites the entrypoint from the php container with ours, which updates the
# stikked config file based on environment variables
COPY docker/docker-php-entrypoint /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-php-entrypoint

View File

@ -41,7 +41,7 @@ Prerequisites
Installation Installation
------------ ------------
1. Download Stikked from https://github.com/claudehohl/Stikked/releases 1. Download stikked from https://github.com/claudehohl/Stikked/tags
2. Create a user and database for Stikked 2. Create a user and database for Stikked
3. Copy application/config/stikked.php.dist to application/config/stikked.php 3. Copy application/config/stikked.php.dist to application/config/stikked.php
4. Edit configuration settings in application/config/stikked.php - everything is described there 4. Edit configuration settings in application/config/stikked.php - everything is described there
@ -58,11 +58,12 @@ Installation
How to run it in Docker How to run it in Docker
----------------------- -----------------------
docker-compose up sudo docker build -t stikked .
sudo docker-compose up -d
This automatically builds the docker-image and fires up nginx, php and mariadb. Access your Stikked instance at http://localhost/. This automatically creates a database with passwords that are configurable in the docker-compose.yml file.
All files are served directly; the Stikked-configuration for Docker resides in docker/stikked.php NOTE: This sets the captcha to false and requires port 80 to be accessible on the host machine. Also, a host entry of 127.0.0.1 stikked.local will fix the base_url issues.
Documentation Documentation
@ -80,21 +81,6 @@ In the folder doc/, you will find:
Changelog Changelog
--------- ---------
### Version 0.14.0:
* Rewritten the Docker setup to be simple and clean:
* switch to nginx-alpine, php-fpm-alpine and mariadb
* docker-compose: autobuild php-image for stikked
* serve all files directly (htdocs is mounted instead of copied)
* stikked-configuration for docker resides in docker/stikked.php
* force private-flag when a previously encrypted paste gets pasted public
* Fixed a critical bug that allowed pasting despite captcha
* Various bugfixes and improvements
#### Upgrade instructions
Copy your htdocs/application/stikked.php config file away. Upload the new version. Copy it back.
### Version 0.13.0: ### Version 0.13.0:
* Updated CodeIgniter to 3.1.9 * Updated CodeIgniter to 3.1.9

View File

@ -8,8 +8,6 @@ How to create your own theme
For example: If you've only modified the main.css, create a folder named "css" in your theme folder, and put your main.css in there. For example: If you've only modified the main.css, create a folder named "css" in your theme folder, and put your main.css in there.
The theme engine will load your css, and falls back to files in the default theme that aren't in your theme folder. The theme engine will load your css, and falls back to files in the default theme that aren't in your theme folder.
Note: Image files need to reside in the /images folder and it can't contain sub-directories.
Examples: Examples:
* gabdark - a theme with only a modified main.css * gabdark - a theme with only a modified main.css

View File

@ -2,5 +2,9 @@ You want to improve Stikked? Always welcome! Send us your pull request and you w
Some guidelines: Some guidelines:
* Coding style: PSR-2. For PHP files (not views/themes), please run phpfmt (https://marketplace.visualstudio.com/items?itemName=kokororin.vscode-phpfmt). * For PHP only files (not views/themes), please run the PHP Beautifier (http://pear.php.net/package/PHP_Beautifier) with the following parameters:
```
php_beautifier --indent_tabs -l "IndentStyles(style=bsd) ArrayNested() NewLines(before=function:T_CLASS:if,after=T_COMMENT) ListClassFunction()"
```
* Optionally, use https://phpbeautifier.com/ with "Allman style" formatting for smaller segments of PHP-only code
* 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!

View File

@ -1,31 +1,29 @@
version: "3.7" version: "3.2"
services: services:
nginx: db:
image: nginx:1.17-alpine image: mysql:latest
volumes: volumes:
- ./docker/nginx.conf:/etc/nginx/conf.d/default.conf:ro - db_data:/var/lib/mysql
- ./htdocs:/htdocs:ro env_file: docker/stikked-envvars.txt
stikked:
depends_on:
- db
image: stikked
env_file: docker/stikked-envvars.txt
ports: ports:
- 127.0.0.1:80:80/tcp - 80:80
php: # You should use persistant storage for this,
image: stikked-php:1 # as if the volume is deleted, everything is gone!
volumes: volumes:
- ./docker/php.ini:/usr/local/etc/php/php.ini:ro db_data:
- ./docker/php-fpm.conf:/usr/local/etc/php-fpm.d/www.conf:ro
- ./htdocs:/htdocs # Example of NFS backed persistant storage:
- ./docker/stikked.php:/htdocs/application/config/stikked.php:ro # db_data:
build: # driver_opts:
context: ./docker/php # type: "nfs"
# o: "addr=192.168.1.254,nolock,soft,rw"
# device: ":/nfs/export/pbdatabase"
mysql:
image: mariadb:10.4
command: mysqld --innodb-buffer-pool-size=4000000000
volumes:
- ./mysql-datadir_customize-in-docker-compose.yml:/var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: stikked
MYSQL_USER: stikked
MYSQL_PASSWORD: stikked

View File

@ -0,0 +1,70 @@
#!/bin/bash
# This is copied from the original docker-php-entrypoint and was updated
# by the Stikked container
set -e
# Check to see where Stikked might be - If you added Stikked to this
# container with something like:
# ADD https://github.com/claudehohl/Stikked/archive/0.12.0.tar.gz /usr/local
# then it will be in /usr/local/stikked/Stikked-0.12.0/htdocs/application/config/stikked.php.dist
# If you're using the standard Dockerfile from Stikked, it will be in
# /var/www/html/htdocs/applcation/config/stikked.php.dist
if [ -e /var/www/html/application/config/stikked.php.dist ]; then
CFG=/var/www/html/application/config/stikked.php
cp /var/www/html/application/config/stikked.php.dist $CFG
elif [ -e /usr/local/stikked/Stikked-*/htdocs/application/config/stikked.php.dist ]; then
CFG=$(echo /usr/local/stikked/Stikked-*/htdocs/application/config/stikked.php.dist | sed 's/\.dist//')
cp /usr/local/stikked/Stikked-*/htdocs/application/config/stikked.php.dist $CFG
else
echo I can not find the stikked.php.dist file, which means docker-php-entrypoint
echo needs to be updated. Sorry. I can not continue. Exiting.
exit -1
fi
# Set some default variables
STIKKED_SITE_NAME="${STIKKED_SITE_NAME:-Dockerised Stikked Container}"
STIKKED_BASE_URL="${STIKKED_BASE_URL:-https://bogus.example.com/}"
STIKKED_DB_HOSTNAME="${STIKKED_DB_HOSTNAME:-db}"
# If these aren't set, use MYSQL_ values. If they're not set, then
# just guess.
STIKKED_DB_DATABASE="${STIKKED_DB_DATABASE:-${MYSQL_DATABASE:-stikked}}"
STIKKED_DB_USERNAME="${STIKKED_DB_USERNAME:-${MYSQL_USER:-stikked}}"
STIKKED_DB_PASSWORD="${STIKKED_DB_PASSWORD:-${MYSQL_PASSWORD:-stikked}}"
# If there's not a cron key, set a random one.
if [ ! "$STIKKED_CRON_KEY" ]; then
# Note - this is not very random. But it'll do in a pinch.
STIKKED_CRON_KEY=$RANDOM.$RANDOM.$RANDOM.$RANDOM
fi
# Put the cron file in place
echo "*/5 * * * * root curl --silent http://localhost/cron/$STIKKED_CRON_KEY" > /etc/cron.d/stikked
# This gets all environment variables that start with STIKKED_
svars=$(set | grep \^STIKKED_ | cut -d= -f1)
for svar in $svars; do
# Remove STIKKED_ from the front, and convert it to lower
# case (STIKKED_CRON_KEY is now cron_key)
val=$(echo $svar | sed 's/STIKKED_\(.*\)/\L\1/')
# if it has a /, escape it - for example, in a path or URL.
FIXED=$(echo ${!svar} | sed 's_/_\\/_g')
# Tell the user what's going on
echo Setting $val to be $FIXED
# And actually update the file
sed -i "s/\['$val'\].*/['$val'] = '$FIXED';/" $CFG
done
# Start Cron, if it exists
[ -e /usr/sbin/cron ] && /usr/sbin/cron
# first arg is `-f` or `--some-option`
if [ "${1#-}" != "$1" ]; then
set -- apache2-foreground "$@"
fi
exec "$@"

View File

@ -1,69 +0,0 @@
upstream php {
#server unix:/var/run/php5-fpm.sock;
server php:9000;
}
server {
listen 80 backlog=1024;
server_name localhost;
server_tokens off;
root /htdocs;
index index.php;
client_body_buffer_size 8M;
client_max_body_size 8M;
gzip on;
gzip_types text/plain text/css application/javascript;
# Only requests to our Host are allowed
if ($host !~ ^localhost$ ) {
return 444;
}
# Only allow these request methods
if ($request_method !~ ^(GET|HEAD|POST)$ ) {
return 444;
}
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
# Deny all attempts to access hidden files such as .htaccess, .htpasswd, .DS_Store (Mac).
location ~ /\. {
deny all;
}
# Deny access to any files with a .php extension in the static directory
location ~* /(?:static)/.*\.php$ {
deny all;
}
location / {
# This is cool because no php is touched for static content.
# include the "?$args" part so non-default permalinks doesn't break when using query string
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
#NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
include fastcgi.conf;
fastcgi_intercept_errors on;
fastcgi_pass php;
}
location ~* \.(js|css|png|ico)$ {
expires max;
log_not_found off;
}
}

View File

@ -1,12 +0,0 @@
[www]
user = www-data
group = www-data
listen = /run/php/php7.0-fpm.sock
listen.owner = www-data
listen.group = www-data
pm = dynamic
pm.max_children = 20
pm.start_servers = 4
pm.min_spare_servers = 4
pm.max_spare_servers = 8
pm.max_requests = 10000

View File

@ -1,65 +0,0 @@
[PHP]
short_open_tag = Off
precision = 14
output_buffering = 4096
zlib.output_compression = Off
implicit_flush = Off
serialize_precision = 17
disable_functions = pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
zend.enable_gc = On
expose_php = Off
max_execution_time = 30
max_input_time = 60
memory_limit = 128M
error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT
display_errors = Off
display_startup_errors = Off
log_errors = On
log_errors_max_len = 1024
ignore_repeated_errors = Off
ignore_repeated_source = Off
report_memleaks = On
track_errors = Off
html_errors = On
variables_order = "GPCS"
request_order = "GP"
register_argc_argv = Off
auto_globals_jit = On
post_max_size = 10M
default_mimetype = "text/html"
default_charset = "UTF-8"
enable_dl = Off
file_uploads = On
upload_max_filesize = 8M
max_file_uploads = 20
allow_url_fopen = On
allow_url_include = Off
default_socket_timeout = 60
[MySQLi]
mysqli.max_persistent = -1
mysqli.allow_persistent = On
mysqli.max_links = -1
mysqli.cache_size = 2000
mysqli.default_port = 3306
mysqli.reconnect = Off
[Session]
session.save_handler = files
session.use_strict_mode = 0
session.use_cookies = 1
session.use_only_cookies = 1
session.name = PHPSESSID
session.auto_start = 0
session.cookie_lifetime = 0
session.cookie_path = /
session.serialize_handler = php
session.gc_probability = 0
session.gc_divisor = 1000
session.gc_maxlifetime = 1440
session.cache_limiter = nocache
session.cache_expire = 180
session.use_trans_sid = 0
session.hash_function = 0
session.hash_bits_per_character = 5
url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=fakeentry"

View File

@ -1,9 +0,0 @@
FROM php:7.1-fpm-alpine3.9
RUN apk add -U libjpeg-turbo-dev libpng-dev freetype-dev
RUN docker-php-ext-configure gd \
--enable-gd-native-ttf \
--with-freetype-dir=/usr/include/freetype2 \
--with-png-dir=/usr/include \
--with-jpeg-dir=/usr/include
RUN docker-php-ext-install gd mysqli

View File

@ -0,0 +1,27 @@
MYSQL_ROOT_PASSWORD=thisREALLYshouldBEchanged
MYSQL_DATABASE=stikked
MYSQL_USER=stikked
MYSQL_PASSWORD=stikked
STIKKED_SITE_NAME=Stikked
# Note that there is no need to escape the URL
STIKKED_BASE_URL=http://stikked.local/
# This should match the database container name
STIKKED_DB_HOSTNAME=db
# These do NOT need to be set, as they will be inherited from
# the MYSQL_DATABASE settings above. However, you can set them
# if you are using a seperately managed database.
#STIKKED_DB_DATABASE=stikked
#STIKKED_DB_USERNAME=stikked
#STIKKED_DB_PASSWORD=stikked
# Other random examples
STIKKED_DISALLOW_SEARCH_ENGINES="true"
STIKKED_JS_EDITOR="codemirror"
# Example of enabling CAPTCHA
#STIKKED_ENABLE_CAPTCHA="true"
#STIKKED_RECAPTCHA_PUBLICKEY="_replace_this_with_your_public_key_"
#STIKKED_RECAPTCHA_PRIVATEKEY="_replace_this_with_your_private_key_"

View File

@ -1,358 +0,0 @@
<?php if (!defined('BASEPATH')) {
exit('No direct script access allowed');
}
/**
* Site Name
*
* The name of your site
*
*/
$config['site_name'] = 'Stikked';
/**
* Base URL
*
* Set the base URL of Stikked. WITH trailing slash!
*
*/
$config['base_url'] = 'http://localhost/';
/**
* Database connection
*
* Credentials for your database
* The database structure will be created automatically
*
*/
$config['db_hostname'] = 'mysql';
$config['db_database'] = 'stikked';
$config['db_username'] = 'stikked';
$config['db_password'] = 'stikked';
// If you are using sqlite:
// uncomment the configuration lines below.
//$config['db_database'] = 'db/stikked'; // you need to create a directory "db" and give the webserver write access. sqlite needs a writable folder to work properly!
//$config['db_driver'] = 'sqlite';
/**
* Table prefix
* Generate table prefix for stikked db, commonly used if the webhoster only has one db.
* Use underscore as suffix to easily see the tables.
* example: $config['db_prefix'] = 'stikked_';
* use $config['db_prefix'] = ''; if you don't want to use table prefix.
*/
$config['db_prefix'] = '';
/**
* Theme
*
* Which theme to use
* Folder name in htdocs/themes/
* Currently: default, bootstrap, gabdark, gabdark3, geocities, snowkat, stikkedizr, cleanwhite, i386
*
*/
$config['theme'] = 'default';
/**
* Display QR code
*
* Whether or not to display the QR code
*
*/
$config['qr_enabled'] = true;
/**
* JavaScript-Editor
*
* Which editor to use
* CodeMirror, ACE or none
*
* none: ~130kb JS
* CodeMirror: ~300kb JS
* ACE: >800kb JS
*
*/
$config['js_editor'] = ''; // codemirror, ace, ''
/**
* Language
*
* Which language to use
* Translate Stikked to your own language, see htdocs/application/language files
* Currently: english, german, swissgerman, spanish, norwegian, danish, portuguese, turkish, french, japanese, polish, russian, chinese-simplified, chinese-traditional, indonesia
*
*/
$config['language'] = 'english';
/**
* Combine JS & CSS files (recommended)
*
* htdocs/static/asset/ folder must be writeable
*
*/
$config['combine_assets'] = false; # chown 82 htdocs/static/asset/ for Docker
/**
* Content expiration
*
* Sets the "Expires:"-header to make use of browser-caching
* Format: http://php.net/manual/en/function.strtotime.php
* Examples: '+10 seconds', '+1 year', '-1 week'
*
*/
$config['content_expiration'] = '-1 week';
/**
* Key for Cron
*
* The password required to run the cron job */
// Example cron: */5 * * * * curl --silent http://yoursite.com/cron/[key]
//
//
$config['cron_key'] = '';
/**
* url shortener config
*
* url_shortening_use:
* - Enables specific url shortening engine or disables them all
* - Valid values:
* @string yourls
* @string gwgd
* @string googl
* @string bitly
* @string polr
* @string random - Randomly chose any of upper API-s !WARNING! May be slow! For maximum performanse, it's recommended to either set all API keys or use random_url_engines to list working engines.
* @string none - same as off
*
* random_url_engines:
* - This variable sets list of APIs to be considered for usage if url_shortening_use is set to 'random'
* To consider all API-s, either leave it empty (as empty array or string) or type all apis available (yourls,gwgd,googl,bitly)
* be aware that considering all the APIs is not recommended because program will test them all, and that affects speed.
* This will greatly improve performance of 'random' mode if listed are only valid, filled APIs.
* Accepted inputs:
* @array array('use this', 'and this', 'and this of course')
* @string 'use this,and this,and this of course'
* - If input is @string it must be comma delimited, otherwise will be ignored.
* - Script will accept minimum of 2 APIs, ignored otherwise
* - Only alphanumeric characters and "." are allowed. Everything else is filtered out.
*
* -------------------------------------------------------------------------------------------------------------
* yourls_url: Your own instance of yourls URL-shortener (Download: http://yourls.org/)
* Example: http://example.com/yourls/
*
* yourls_signature: Your signature, used to authenticate API requests.
* You can find your signature under http://your-yourls-installation.com/admin/tools.php
*
* gwgd_url: Your own instance of the gw.gd URL-shortener (Download: https://github.com/neofutur/gwgd)
* Default: http://gw.gd/
*
* googl_url_api: URL shortening service provided by Google Inc. (API: http://code.google.com/apis/console/)
* Usage: Your API key
*
* bitly_url_api: Famous URL shortening service (API: http://dev.bitly.com/get_started.html)
* Usage: Your API key
*
* polr_url: Your own instance of polr URL-shortener (Download: https://github.com/cydrobolt/polr)
* polr_api: Your polr api key
*
**/
$config['url_shortening_use'] = 'off';
$config['random_url_engines'] = 'googl,bitly'; // Used only in random mode, read comment above for more info
// Yourls
$config['yourls_url'] = '';
$config['yourls_signature'] = '';
// gwgd_url
$config['gwgd_url'] = '';
$config['shorturl_selected'] = false;
// goo.gl API key
$config['googl_url_api'] = '';
// Bit.ly API key
$config['bitly_url_api'] = '';
// polr
$config['polr_url'] = '';
$config['polr_api'] = '';
/**
* Credentials for the backup URL
*
* Basic auth user & pass for the backup URL, accessible via http://yoursite.com/backup
*
**/
$config['backup_user'] = '';
$config['backup_pass'] = '';
/**
* Pastes Per Page
*
* Number of pastes per page, on the recent pastes listings.
*
**/
$config['per_page'] = 15;
/**
* API key
*
* Require a key to interact with the API.
* Append to all API requests: ?apikey=[yourkey]
*
**/
$config['apikey'] = '';
/**
* Soft API
*
* When set to true, allow interaction:
* without apikey: badword-check applies
* with apikey: badwords are ignored
*
* This is useful to maintain a restrictive blocklist
* for spammers and bypass it using the apikey.
*
**/
$config['soft_api'] = false;
/**
* Anti spam
*
* private_only: No recent pastes will be displayed.
* enable_captcha: Users must enter a captcha to post.
* recaptcha_publickey & recaptcha_privatekey: If filled, reCaptcha will be used (get a key from https://www.google.com/recaptcha/admin/create)
* disable_api: Don't allow pasting via API (because we can't use a captcha there...)
* disable_keep_forever: Don't allow pasting without expiration
* blocked_words: Comma separated list, e.g. '.es.tl, mycraft.com, yourbadword'
* disable_shorturl: "Create Shorturl" option will be disabled
* disallow_search_engines: displays a robots.txt that forbids indexing
*
**/
$config['private_only'] = false;
$config['enable_captcha'] = true;
$config['recaptcha_publickey'] = '';
$config['recaptcha_privatekey'] = '';
$config['disable_api'] = false;
$config['disable_keep_forever'] = false;
$config['blocked_words'] = '';
$config['disable_shorturl'] = false;
$config['disallow_search_engines'] = false;
//spamadmin: accessible via /spamadmin (only active when user + pass is set)
$config['spamadmin_user'] = '';
$config['spamadmin_pass'] = '';
/**
* Default paste expiration time (minutes)
*
* Possible values:
* burn (burn on reading)
* 5 (5 minutes)
* 60 (1 hour)
* 1440 (1 day)
* 10080 (1 week)
* 40320 (1 month)
* 483840 (1 year)
* 0 (keep forever)
**/
$config['default_expiration'] = 0;
/**
* Default language
*
* Preselected language. See application/config/geshi_languages.php for valid values (array keys)
*
**/
$config['default_language'] = 'text';
/**
* Name for anonymous poster
*
* What name is to be set for anonymous posters
* DO NOT SET BLANK
* Set to random for a random paste to be generated
* NOTE: if changed only pastes from then on will be updated.
*
**/
$config['unknown_poster'] = 'random';
/**
* Name for untitled pastes
*
* What name is to be set for untitled pastes.
* DO NOT SET BLANK
* NOTE: if changed only pastes from then on will be updated.
**/
$config['unknown_title'] = 'Untitled';
/**
* To require LDAP authentication or not.
*
* Weather to require LDAP authenticaiton or not.
* Set to either 'true' to require authentication or 'false' not to.
* NOTE: if changed, set LDAP settings in auth_ldap.php
**/
$config['require_auth'] = false;
/**
* Override the displayed URL
*
* Display this URL in a paste's detail view instead of the main URL - e.g. if you use mod_rewrite
* Variable $id: the paste_id
* Example: 'http://example.com/$id'
*
**/
$config['displayurl_override'] = '';
/**
*
*
* Words used for when unknown_poster is set to random
*
*
**/
$config['nouns'] = array('Hornbill', 'Elephant', 'Bison', 'Lion', 'Camel', 'Sheep',
'Monkey', 'Prairie Dog', 'Plover', 'Tapir', 'Capybara', 'Cheetah', 'Flamingo', 'Peccary', 'Eider', 'Porcupine', 'Pelican', 'Dove', 'Crane', 'Tortoise', 'Agouti',
'Tamarin', 'Pheasant', 'Owl', 'Gibbon', 'Goose', 'Baboon', 'Hamerkop', 'Zebra',
'Macaw', 'Gibbon', 'Madrill', 'Wolf', 'Stork', 'Armadillo', 'Ostrich', 'Marmoset',
'Lizard', 'Panda', 'Giraffe', 'Cassowary', 'Kangaroo', 'Gorilla', 'Pheasant',
'Finch', 'Duck', 'Matamata', 'Teal', 'Macaque', 'Goat', 'Lechwe', 'Ibis', 'Parrot',
'Parakeet', 'Bongo', 'Pudu', 'Echidna', 'Lemur', 'Bat', 'Curlew', 'Terrapin',
'Peafowl', 'Duck', 'Owl', 'Parakeet', 'Meerkat', 'Tern', 'Wigeon', 'Pintail',
'Meerkat', 'Motmot', 'Motmot', 'Shama', 'Dormouse', 'Horse', 'Rhinoceros', 'Sloth',
'Mousedeer', 'Treeshrew', 'Bushbaby', 'Guinea Pig', 'Agouti', 'Water Vole', 'Hog',
'Pig', 'Anoa', 'Octupus', 'Butterfly', 'Cat', 'Kitten', 'Coyote', 'Crocodile',
'Cockroach', 'Crow', 'Bird', 'Dolphin', 'Earthworm', 'Frog', 'Hamster', 'Hedgehog',
'Hog', 'Human', 'Hummingbird', 'Iguana', 'Leech', 'Leopard', ' Marten',
'Mockingbird', 'Mockingjay', 'Mosquito', 'Moth', 'Partdridge', 'Bee', 'Penguin');
$config['adjectives'] = array('Ample', 'Mature', 'Bulky', 'Burly', 'Capacious',
'Colossal', 'Commodious', 'Thundering', 'Mammoth', 'Mungo', 'Voluminous',
'Walloping', 'Tiny', 'Baby', 'Bitty', 'Diminutive', 'Little', 'Paltry', 'Scanty',
'Trivial', 'Scribby', 'Blush', 'Tinct', 'Colorant', 'Aqua', 'Beige', 'Bistre',
'Buff', 'Bistre', 'Chartreuse', 'Chocolate', 'Cobalt', 'Coral', 'Cream', 'Crimson',
'Denim', 'Emerald', 'Gray', 'Gamboge', 'Ivory', 'Mustard', 'Silly', 'Perl',
'Whipped', 'Violet', 'Harmless', 'Gentle', 'Innocent', 'Reliable', 'Unreliable',
'Soft', 'Toxic', 'Anorexic', 'Beefy', 'Sexy', 'Morose', 'Rude', 'Ungracious',
'Abrupt', 'Gracious', 'Queen', 'Cute', 'Edgy', 'Insensitive', 'Round', 'Sharp',
'Gruff', 'Subtle', 'Crippled', 'Eratic', 'Social', 'Jittery', 'Sole', 'Unique',
'Botched', 'Tacky', 'Sludgy', 'Stained', 'Wet', 'Soiled', 'Big', 'Small', 'Sloppy',
'Smelly', 'Funky', 'Putrid', 'Melodic', 'Corrupt', 'Lousy', 'Fiery', 'Red',
'Sweet', 'Hot', 'Scorching', 'Sweltering', 'Torrid', 'Obese', 'Speedy', 'Flying',
'Idiotic', 'Chunky', 'Forensic');
/**
*
*
* Words used for expiring pastes
*
*
**/
$config['expires'] = array('expire', 'perish', 'go to its last resting place',
'go to meet its maker', 'cross the great divide', 'slip away', 'give up the ghost',
'kick the bucket', 'croak', 'bite the big one', 'check out', 'buy the farm',
'join the choir invisible', 'shuffle off the mortal coil', 'hop the perch',
'run down the curtain', 'die', 'self destruct', 'explode');

View File

@ -9,11 +9,11 @@ RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
SetOutputFilter DEFLATE SetOutputFilter DEFLATE
FileETag MTime Size FileETag MTime Size
<IfModule !mod_rewrite.c> <IfModule !mod_rewrite>
ErrorDocument 404 /index.php ErrorDocument 404 /index.php
</IfModule> </IfModule>
<IfModule mod_expires.c> <IfModule mod_expires>
ExpiresActive On ExpiresActive On
ExpiresByType text/javascript "access plus 1 year" ExpiresByType text/javascript "access plus 1 year"
ExpiresByType application/x-javascript "access plus 1 year" ExpiresByType application/x-javascript "access plus 1 year"
@ -35,3 +35,5 @@ FileETag MTime Size
#AuthName "Backend" #AuthName "Backend"
#AuthUserFile /path/to/.htpasswd #create one with htpasswd -c .htpasswd username #AuthUserFile /path/to/.htpasswd #create one with htpasswd -c .htpasswd username
#Require user username #Require user username
AddHandler php5-fastcgi .php .php5

View File

@ -1,6 +1,11 @@
<?php if (!defined('BASEPATH')) { <?php
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(

View File

@ -1,22 +1,19 @@
<?php if (!defined('BASEPATH')) { <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
exit('No direct script access allowed');
}
/* /*
* This file is part of Auth_Ldap. * This file is part of Auth_Ldap.
Auth_Ldap is free software: you can redistribute it and/or modify Auth_Ldap is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
Auth_Ldap is distributed in the hope that it will be useful, Auth_Ldap is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with Auth_Ldap. If not, see <http://www.gnu.org/licenses/>. along with Auth_Ldap. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
@ -59,3 +56,4 @@ $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)
?>

View File

@ -1,7 +1,4 @@
<?php if (!defined('BASEPATH')) { <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
exit('No direct script access allowed');
}
/* /*
| ------------------------------------------------------------------- | -------------------------------------------------------------------
| AUTO-LOADER | AUTO-LOADER
@ -28,7 +25,7 @@
| 5. Language files | 5. Language files
| 6. Models | 6. Models
| |
*/ */
/* /*
| ------------------------------------------------------------------- | -------------------------------------------------------------------
@ -38,10 +35,11 @@
| |
| $autoload['packages'] = array(APPPATH.'third_party', '/usr/local/shared'); | $autoload['packages'] = array(APPPATH.'third_party', '/usr/local/shared');
| |
*/ */
$autoload['packages'] = array(); $autoload['packages'] = array();
/* /*
| ------------------------------------------------------------------- | -------------------------------------------------------------------
| Auto-load Libraries | Auto-load Libraries
@ -52,10 +50,11 @@ $autoload['packages'] = array();
| Prototype: | Prototype:
| |
| $autoload['libraries'] = array('database', 'session', 'xmlrpc'); | $autoload['libraries'] = array('database', 'session', 'xmlrpc');
*/ */
$autoload['libraries'] = array('database', 'carabiner'); $autoload['libraries'] = array('database', 'carabiner');
/* /*
| ------------------------------------------------------------------- | -------------------------------------------------------------------
| Auto-load Helper Files | Auto-load Helper Files
@ -63,10 +62,11 @@ $autoload['libraries'] = array('database', 'carabiner');
| Prototype: | Prototype:
| |
| $autoload['helper'] = array('url', 'file'); | $autoload['helper'] = array('url', 'file');
*/ */
$autoload['helper'] = array('url', 'date', 'language'); $autoload['helper'] = array('url', 'date', 'language');
/* /*
| ------------------------------------------------------------------- | -------------------------------------------------------------------
| Auto-load Config files | Auto-load Config files
@ -78,10 +78,11 @@ $autoload['helper'] = array('url', 'date', 'language');
| NOTE: This item is intended for use ONLY if you have created custom | NOTE: This item is intended for use ONLY if you have created custom
| config files. Otherwise, leave it blank. | config files. Otherwise, leave it blank.
| |
*/ */
$autoload['config'] = array('stikked'); $autoload['config'] = array('stikked');
/* /*
| ------------------------------------------------------------------- | -------------------------------------------------------------------
| Auto-load Language files | Auto-load Language files
@ -93,10 +94,11 @@ $autoload['config'] = array('stikked');
| NOTE: Do not include the "_lang" part of your file. For example | NOTE: Do not include the "_lang" part of your file. For example
| "codeigniter_lang.php" would be referenced as array('codeigniter'); | "codeigniter_lang.php" would be referenced as array('codeigniter');
| |
*/ */
$autoload['language'] = array('stikked'); $autoload['language'] = array('stikked');
/* /*
| ------------------------------------------------------------------- | -------------------------------------------------------------------
| Auto-load Models | Auto-load Models
@ -105,9 +107,10 @@ $autoload['language'] = array('stikked');
| |
| $autoload['model'] = array('model1', 'model2'); | $autoload['model'] = array('model1', 'model2');
| |
*/ */
$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 */

View File

@ -1,6 +1,11 @@
<?php if (!defined('BASEPATH')) { <?php
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(
@ -8,143 +13,143 @@ $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'
), ) ,
), ) ,
), ) ,
'css' => array( 'css' => array(
'mode' => 'css', 'mode' => 'css',
'js' => array( 'js' => array(
array( array(
'codemirror/mode/css/css.js', 'codemirror/mode/css/css.js'
), ) ,
), ) ,
), ) ,
'javascript' => array( 'javascript' => array(
'mode' => 'javascript', 'mode' => 'javascript',
'js' => array( 'js' => array(
array( array(
'codemirror/mode/javascript/javascript.js', 'codemirror/mode/javascript/javascript.js'
), ) ,
), ) ,
), ) ,
'php' => array( 'php' => 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'
), ) ,
), ) ,
), ) ,
'python' => array( 'python' => array(
'mode' => 'python', 'mode' => 'python',
'js' => array( 'js' => array(
array( array(
'codemirror/mode/python/python.js', 'codemirror/mode/python/python.js'
), ) ,
), ) ,
), ) ,
'ruby' => array( 'ruby' => array(
'mode' => 'ruby', 'mode' => 'ruby',
'js' => array( 'js' => array(
array( array(
'codemirror/mode/ruby/ruby.js', 'codemirror/mode/ruby/ruby.js'
), ) ,
), ) ,
), ) ,
'lua' => array( 'lua' => 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'
), ) ,
), ) ,
), ) ,
'bash' => array( 'bash' => 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'
), ) ,
), ) ,
), ) ,
'go' => array( 'go' => 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'
), ) ,
), ) ,
), ) ,
'c' => array( 'c' => 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'
), ) ,
), ) ,
), ) ,
'cpp' => array( 'cpp' => 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'
), ) ,
), ) ,
), ) ,
'diff' => array( 'diff' => array(
'mode' => 'diff', 'mode' => 'diff',
'js' => array( 'js' => array(
array( array(
'codemirror/mode/diff/diff.js', 'codemirror/mode/diff/diff.js'
), ) ,
), ) ,
), ) ,
'latex' => array( 'latex' => array(
'mode' => 'stex', 'mode' => 'stex',
'js' => array( 'js' => array(
array( array(
'codemirror/mode/stex/stex.js', 'codemirror/mode/stex/stex.js'
), ) ,
), ) ,
), ) ,
'sql' => array( 'sql' => array(
'mode' => 'sql', 'mode' => 'sql',
'js' => array( 'js' => array(
array( array(
'codemirror/mode/sql/sql.js', 'codemirror/mode/sql/sql.js'
), ) ,
), ) ,
), ) ,
'xml' => array( 'xml' => array(
'mode' => 'xml', 'mode' => 'xml',
'js' => array( 'js' => array(
array( array(
'codemirror/mode/xml/xml.js', 'codemirror/mode/xml/xml.js'
), ) ,
), ) ,
), ) ,
'text' => 'Plain Text', 'text' => 'Plain Text',
'4cs' => '4CS', '4cs' => '4CS',
'6502acme' => 'MOS 6502', '6502acme' => 'MOS 6502',
@ -156,18 +161,18 @@ $config['codemirror_languages'] = array(
'mode' => 'apl', 'mode' => 'apl',
'js' => array( 'js' => array(
array( array(
'codemirror/mode/apl/apl.js', 'codemirror/mode/apl/apl.js'
), ) ,
), ) ,
), ) ,
'asterisk' => array( 'asterisk' => array(
'mode' => 'asterisk', 'mode' => 'asterisk',
'js' => array( 'js' => array(
array( array(
'codemirror/mode/asterisk/asterisk.js', 'codemirror/mode/asterisk/asterisk.js'
), ) ,
), ) ,
), ) ,
'actionscript' => 'Actionscript', 'actionscript' => 'Actionscript',
'actionscript3' => 'ActionScript3', 'actionscript3' => 'ActionScript3',
'ada' => 'Ada', 'ada' => 'Ada',
@ -193,18 +198,18 @@ $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'
), ) ,
), ) ,
), ) ,
'c_mac' => array( 'c_mac' => 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'
), ) ,
), ) ,
), ) ,
'caddcl' => 'CAD DCL (Dialog Control Language)', 'caddcl' => 'CAD DCL (Dialog Control Language)',
'cadlisp' => 'AutoCAD/IntelliCAD Lisp', 'cadlisp' => 'AutoCAD/IntelliCAD Lisp',
'cfdg' => 'CFDG', 'cfdg' => 'CFDG',
@ -219,27 +224,27 @@ $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'
), ) ,
), ) ,
), ) ,
'csharp' => array( 'csharp' => 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'
), ) ,
), ) ,
), ) ,
'cuesheet' => 'Cuesheet', 'cuesheet' => 'Cuesheet',
'd' => array( 'd' => array(
'mode' => 'd', 'mode' => 'd',
'js' => array( 'js' => array(
array( array(
'codemirror/mode/d/d.js', 'codemirror/mode/d/d.js'
), ) ,
), ) ,
), ) ,
'dcs' => 'DCS', 'dcs' => 'DCS',
'delphi' => 'Delphi (Object Pascal)', 'delphi' => 'Delphi (Object Pascal)',
'div' => 'DIV', 'div' => 'DIV',
@ -250,10 +255,10 @@ $config['codemirror_languages'] = array(
'mode' => 'javascript', 'mode' => 'javascript',
'js' => array( 'js' => array(
array( array(
'codemirror/mode/javascript/javascript.js', 'codemirror/mode/javascript/javascript.js'
), ) ,
), ) ,
), ) ,
'eiffel' => 'Eiffel', 'eiffel' => 'Eiffel',
'email' => 'Email (mbox/eml/RFC format)', 'email' => 'Email (mbox/eml/RFC format)',
'epc' => 'Enerscript', 'epc' => 'Enerscript',
@ -261,10 +266,10 @@ $config['codemirror_languages'] = array(
'mode' => 'erlang', 'mode' => 'erlang',
'js' => array( 'js' => array(
array( array(
'codemirror/mode/erlang/erlang.js', 'codemirror/mode/erlang/erlang.js'
), ) ,
), ) ,
), ) ,
'euphoria' => 'Euphoria', 'euphoria' => 'Euphoria',
'f1' => 'Formula One', 'f1' => 'Formula One',
'falcon' => 'Falcon', 'falcon' => 'Falcon',
@ -284,54 +289,54 @@ $config['codemirror_languages'] = array(
'mode' => 'go', 'mode' => 'go',
'js' => array( 'js' => array(
array( array(
'codemirror/mode/go/go.js', 'codemirror/mode/go/go.js'
), ) ,
), ) ,
), ) ,
'groovy' => array( 'groovy' => 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'
), ) ,
), ) ,
), ) ,
'gwbasic' => 'GwBasic', 'gwbasic' => 'GwBasic',
'haskell' => array( 'haskell' => 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'
), ) ,
), ) ,
), ) ,
'haxe' => array( 'haxe' => 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'
), ) ,
), ) ,
), ) ,
'hicest' => 'HicEst', 'hicest' => 'HicEst',
'hq9plus' => 'HQ9+', 'hq9plus' => 'HQ9+',
'html4strict' => array( 'html4strict' => 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'
), ) ,
), ) ,
), ) ,
'icon' => 'Icon', 'icon' => 'Icon',
'idl' => 'Unoidl', 'idl' => 'Unoidl',
'ini' => 'INI', 'ini' => 'INI',
@ -343,26 +348,26 @@ $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'
), ) ,
), ) ,
), ) ,
'java5' => array( 'java5' => 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'
), ) ,
), ) ,
), ) ,
'jquery' => array( 'jquery' => array(
'mode' => 'javascript', 'mode' => 'javascript',
'js' => array( 'js' => array(
array( array(
'codemirror/mode/javascript/javascript.js', 'codemirror/mode/javascript/javascript.js'
), ) ,
), ) ,
), ) ,
//'kixtart' => 'PHP', //'kixtart' => 'PHP',
'klonec' => 'KLone with C', 'klonec' => 'KLone with C',
@ -386,10 +391,10 @@ $config['codemirror_languages'] = array(
'mode' => 'mirc', 'mode' => 'mirc',
'js' => array( 'js' => array(
array( array(
'codemirror/mode/mirc/mirc.js', 'codemirror/mode/mirc/mirc.js'
), ) ,
), ) ,
), ) ,
'mmix' => 'MMIX Assembler', 'mmix' => 'MMIX Assembler',
'modula2' => 'Modula-2', 'modula2' => 'Modula-2',
'modula3' => 'Modula-3', 'modula3' => 'Modula-3',
@ -399,10 +404,10 @@ $config['codemirror_languages'] = array(
'mode' => 'sql', 'mode' => 'sql',
'js' => array( 'js' => array(
array( array(
'codemirror/mode/sql/sql.js', 'codemirror/mode/sql/sql.js'
), ) ,
), ) ,
), ) ,
'newlisp' => 'newLISP', 'newlisp' => 'newLISP',
'nsis' => 'Nullsoft Scriptable Install System', 'nsis' => 'Nullsoft Scriptable Install System',
'oberon2' => 'Oberon-2', 'oberon2' => 'Oberon-2',
@ -413,10 +418,10 @@ $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'
), ) ,
), ) ,
), ) ,
'oobas' => 'OpenOffice.org Basic', 'oobas' => 'OpenOffice.org Basic',
'oracle11' => 'Oracle 11i', 'oracle11' => 'Oracle 11i',
'oracle8' => 'Oracle 8', 'oracle8' => 'Oracle 8',
@ -426,28 +431,28 @@ $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'
), ) ,
), ) ,
), ) ,
'pcre' => 'PCRE', 'pcre' => 'PCRE',
'per' => 'Per (forms)', 'per' => 'Per (forms)',
'perl' => array( 'perl' => array(
'mode' => 'perl', 'mode' => 'perl',
'js' => array( 'js' => array(
array( array(
'codemirror/mode/perl/perl.js', 'codemirror/mode/perl/perl.js'
), ) ,
), ) ,
), ) ,
'perl6' => array( 'perl6' => array(
'mode' => 'perl', 'mode' => 'perl',
'js' => array( 'js' => array(
array( array(
'codemirror/mode/perl/perl.js', 'codemirror/mode/perl/perl.js'
), ) ,
), ) ,
), ) ,
'pf' => 'OpenBSD packet filter', 'pf' => 'OpenBSD packet filter',
'pic16' => 'PIC16 Assembler', 'pic16' => 'PIC16 Assembler',
'pike' => 'Pike', 'pike' => 'Pike',
@ -457,10 +462,10 @@ $config['codemirror_languages'] = array(
'mode' => 'sql', 'mode' => 'sql',
'js' => array( 'js' => array(
array( array(
'codemirror/mode/sql/sql.js', 'codemirror/mode/sql/sql.js'
), ) ,
), ) ,
), ) ,
'postgresql' => 'PostgreSQL', 'postgresql' => 'PostgreSQL',
'povray' => 'Povray', 'povray' => 'Povray',
'powerbuilder' => 'PowerBuilder (PowerScript)', 'powerbuilder' => 'PowerBuilder (PowerScript)',
@ -472,20 +477,20 @@ $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'
), ) ,
), ) ,
), ) ,
'providex' => 'ProvideX', 'providex' => 'ProvideX',
'purebasic' => 'PureBasic', 'purebasic' => 'PureBasic',
'q' => array( 'q' => 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'
), ) ,
), ) ,
), ) ,
'qbasic' => 'QBasic/QuickBASIC', 'qbasic' => 'QBasic/QuickBASIC',
'rails' => 'Ruby (with Ruby on Rails Framework)', 'rails' => 'Ruby (with Ruby on Rails Framework)',
'rebol' => 'Rebol', 'rebol' => 'Rebol',
@ -498,18 +503,18 @@ $config['codemirror_languages'] = array(
'mode' => 'scala', 'mode' => 'scala',
'js' => array( 'js' => array(
array( array(
'codemirror/mode/clike/clike.js', 'codemirror/mode/clike/clike.js'
), ) ,
), ) ,
), ) ,
'scheme' => array( 'scheme' => 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'
), ) ,
), ) ,
), ) ,
'scilab' => 'SciLab', 'scilab' => 'SciLab',
'sdlbasic' => 'sdlBasic', 'sdlbasic' => 'sdlBasic',
'smalltalk' => 'Smalltalk', 'smalltalk' => 'Smalltalk',
@ -519,10 +524,10 @@ $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'
), ) ,
), ) ,
), ) ,
'teraterm' => 'Tera Term Macro', 'teraterm' => 'Tera Term Macro',
'thinbasic' => 'thinBasic', 'thinbasic' => 'thinBasic',
'tsql' => 'T-SQL', 'tsql' => 'T-SQL',
@ -534,18 +539,18 @@ $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'
), ) ,
), ) ,
), ) ,
'verilog' => array( 'verilog' => 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'
), ) ,
), ) ,
), ) ,
'vhdl' => 'VHDL', 'vhdl' => 'VHDL',
'vim' => 'Vim scripting', 'vim' => 'Vim scripting',
'visualfoxpro' => 'Visual FoxPro', 'visualfoxpro' => 'Visual FoxPro',
@ -560,17 +565,17 @@ $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'
), ) ,
), ) ,
), ) ,
'z80' => array( 'z80' => 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'
), ) ,
), ) ,
), ) ,
'zxbasic' => 'ZXBasic', 'zxbasic' => 'ZXBasic',
); );

View File

@ -1,6 +1,4 @@
<?php if (!defined('BASEPATH')) { <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
exit('No direct script access allowed');
}
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@ -15,7 +13,7 @@
| If this is not set then CodeIgniter will guess the protocol, domain and | If this is not set then CodeIgniter will guess the protocol, domain and
| path to your installation. | path to your installation.
| |
*/ */
$config['base_url'] = ''; $config['base_url'] = '';
/* /*
@ -25,7 +23,7 @@ $config['base_url'] = '';
| |
| So that we can track your version. | So that we can track your version.
| |
*/ */
$config['stikked_version'] = '0.13.0'; $config['stikked_version'] = '0.13.0';
/* /*
@ -37,7 +35,7 @@ $config['stikked_version'] = '0.13.0';
| something else. If you are using mod_rewrite to remove the page set this | something else. If you are using mod_rewrite to remove the page set this
| variable so that it is blank. | variable so that it is blank.
| |
*/ */
$config['index_page'] = ''; $config['index_page'] = '';
/* /*
@ -55,7 +53,7 @@ $config['index_page'] = '';
| 'REQUEST_URI' Uses the REQUEST_URI | 'REQUEST_URI' Uses the REQUEST_URI
| 'ORIG_PATH_INFO' Uses the ORIG_PATH_INFO | 'ORIG_PATH_INFO' Uses the ORIG_PATH_INFO
| |
*/ */
$config['uri_protocol'] = 'AUTO'; $config['uri_protocol'] = 'AUTO';
/* /*
@ -67,7 +65,7 @@ $config['uri_protocol'] = 'AUTO';
| For more information please see the user guide: | For more information please see the user guide:
| |
| http://codeigniter.com/user_guide/general/urls.html | http://codeigniter.com/user_guide/general/urls.html
*/ */
$config['url_suffix'] = ''; $config['url_suffix'] = '';
@ -80,7 +78,7 @@ $config['url_suffix'] = '';
| there is an available translation if you intend to use something other | there is an available translation if you intend to use something other
| than english. | than english.
| |
*/ */
#$config['language'] = 'english'; #this is configured in config/stikked.php #$config['language'] = 'english'; #this is configured in config/stikked.php
/* /*
@ -91,7 +89,7 @@ $config['url_suffix'] = '';
| This determines which character set is used by default in various methods | This determines which character set is used by default in various methods
| that require a character set to be provided. | that require a character set to be provided.
| |
*/ */
$config['charset'] = 'UTF-8'; $config['charset'] = 'UTF-8';
/* /*
@ -102,8 +100,9 @@ $config['charset'] = 'UTF-8';
| If you would like to use the 'hooks' feature you must enable it by | If you would like to use the 'hooks' feature you must enable it by
| setting this variable to TRUE (boolean). See the user guide for details. | setting this variable to TRUE (boolean). See the user guide for details.
| |
*/ */
$config['enable_hooks'] = false; $config['enable_hooks'] = TRUE;
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@ -116,9 +115,10 @@ $config['enable_hooks'] = false;
| http://codeigniter.com/user_guide/general/core_classes.html | http://codeigniter.com/user_guide/general/core_classes.html
| http://codeigniter.com/user_guide/general/creating_libraries.html | http://codeigniter.com/user_guide/general/creating_libraries.html
| |
*/ */
$config['subclass_prefix'] = 'MY_'; $config['subclass_prefix'] = 'MY_';
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Allowed URL Characters | Allowed URL Characters
@ -135,9 +135,10 @@ $config['subclass_prefix'] = 'MY_';
| |
| DO NOT CHANGE THIS UNLESS YOU FULLY UNDERSTAND THE REPERCUSSIONS!! | DO NOT CHANGE THIS UNLESS YOU FULLY UNDERSTAND THE REPERCUSSIONS!!
| |
*/ */
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-'; $config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-';
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Enable Query Strings | Enable Query Strings
@ -162,9 +163,9 @@ $config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-';
| this feature is enabled, since CodeIgniter is designed primarily to | this feature is enabled, since CodeIgniter is designed primarily to
| 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
@ -188,7 +189,7 @@ $config['directory_trigger'] = 'd'; // experimental not currently in use
| For a live site you'll usually only enable Errors (1) to be logged otherwise | For a live site you'll usually only enable Errors (1) to be logged otherwise
| your log files will fill up very fast. | your log files will fill up very fast.
| |
*/ */
$config['log_threshold'] = 4; $config['log_threshold'] = 4;
/* /*
@ -199,7 +200,7 @@ $config['log_threshold'] = 4;
| Leave this BLANK unless you would like to set something other than the default | Leave this BLANK unless you would like to set something other than the default
| application/logs/ folder. Use a full server path with trailing slash. | application/logs/ folder. Use a full server path with trailing slash.
| |
*/ */
$config['log_path'] = ''; $config['log_path'] = '';
/* /*
@ -210,7 +211,7 @@ $config['log_path'] = '';
| Each item that is logged has an associated date. You can use PHP date | Each item that is logged has an associated date. You can use PHP date
| codes to set your own date formatting | codes to set your own date formatting
| |
*/ */
$config['log_date_format'] = 'Y-m-d H:i:s'; $config['log_date_format'] = 'Y-m-d H:i:s';
/* /*
@ -221,7 +222,7 @@ $config['log_date_format'] = 'Y-m-d H:i:s';
| Leave this BLANK unless you would like to set something other than the default | Leave this BLANK unless you would like to set something other than the default
| system/cache/ folder. Use a full server path with trailing slash. | system/cache/ folder. Use a full server path with trailing slash.
| |
*/ */
$config['cache_path'] = ''; $config['cache_path'] = '';
/* /*
@ -232,7 +233,7 @@ $config['cache_path'] = '';
| If you use the Encryption class or the Session class you | If you use the Encryption class or the Session class you
| MUST set an encryption key. See the user guide for info. | MUST set an encryption key. See the user guide for info.
| |
*/ */
$config['encryption_key'] = ''; $config['encryption_key'] = '';
/* /*
@ -282,14 +283,14 @@ $config['encryption_key'] = '';
| Other session cookie settings are shared with the rest of the application, | Other session cookie settings are shared with the rest of the application,
| except for 'cookie_prefix' and 'cookie_httponly', which are ignored here. | except for 'cookie_prefix' and 'cookie_httponly', which are ignored here.
| |
*/ */
$config['sess_driver'] = 'database'; $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;
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@ -305,12 +306,12 @@ $config['sess_regenerate_destroy'] = false;
| Note: These settings (with the exception of 'cookie_prefix' and | Note: These settings (with the exception of 'cookie_prefix' and
| 'cookie_httponly') will also affect sessions. | 'cookie_httponly') will also affect sessions.
| |
*/ */
$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;
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@ -320,8 +321,8 @@ $config['cookie_httponly'] = false;
| Determines whether the XSS filter is always active when GET, POST or | Determines whether the XSS filter is always active when GET, POST or
| COOKIE data is encountered | COOKIE data is encountered
| |
*/ */
$config['global_xss_filtering'] = false; $config['global_xss_filtering'] = FALSE;
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@ -334,8 +335,8 @@ $config['global_xss_filtering'] = false;
| 'csrf_token_name' = The token name | 'csrf_token_name' = The token name
| '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;
@ -356,8 +357,8 @@ $config['csrf_expire'] = 7200;
| compression to work, nothing can be sent before the output buffer is called | compression to work, nothing can be sent before the output buffer is called
| by the output class. Do not 'echo' any values with compression enabled. | by the output class. Do not 'echo' any values with compression enabled.
| |
*/ */
$config['compress_output'] = false; $config['compress_output'] = FALSE;
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@ -369,9 +370,10 @@ $config['compress_output'] = false;
| GMT. See the 'date helper' page of the user guide for information | GMT. See the 'date helper' page of the user guide for information
| regarding date handling. | regarding date handling.
| |
*/ */
$config['time_reference'] = 'local'; $config['time_reference'] = 'local';
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Rewrite PHP Short Tags | Rewrite PHP Short Tags
@ -381,8 +383,9 @@ $config['time_reference'] = 'local';
| can rewrite the tags on-the-fly, enabling you to utilize that syntax | can rewrite the tags on-the-fly, enabling you to utilize that syntax
| 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;
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@ -394,7 +397,7 @@ $config['rewrite_short_tags'] = false;
| header in order to properly identify the visitor's IP address. | header in order to properly identify the visitor's IP address.
| Comma-delimited, e.g. '10.0.1.200,10.0.1.201' | Comma-delimited, e.g. '10.0.1.200,10.0.1.201'
| |
*/ */
$config['proxy_ips'] = ''; $config['proxy_ips'] = '';
/* /*
@ -404,7 +407,7 @@ $config['proxy_ips'] = '';
| |
| The favorite languages, that's at the beginning of the list. | The favorite languages, that's at the beginning of the list.
| |
*/ */
$config['favorite_languages'] = array('text', 'html5', 'css', 'javascript', 'php', 'python', 'ruby', $config['favorite_languages'] = array('text', 'html5', 'css', 'javascript', 'php', 'python', 'ruby',
'lua', 'bash', 'erlang', 'go', 'c', 'cpp', 'diff', 'latex', 'sql', 'xml'); 'lua', 'bash', 'erlang', 'go', 'c', 'cpp', 'diff', 'latex', 'sql', 'xml');

View File

@ -1,4 +1,5 @@
<?php defined('BASEPATH') or exit('No direct script access allowed'); <?php
defined('BASEPATH') OR exit('No direct script access allowed');
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@ -9,8 +10,8 @@
| error_reporting is disabled, the backtrace will not display, regardless | error_reporting is disabled, the backtrace will not display, regardless
| 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);
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@ -24,11 +25,11 @@ defined('SHOW_DEBUG_BACKTRACE') or define('SHOW_DEBUG_BACKTRACE', true);
| user, PHP under CGI with Apache suEXEC, etc.). Octal values should | user, PHP under CGI with Apache suEXEC, etc.). Octal values should
| 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);
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@ -37,15 +38,15 @@ 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');
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@ -71,14 +72,14 @@ defined('FOPEN_READ_WRITE_CREATE_STRICT') or define('FOPEN_READ_WRITE_CREATE_STR
| Bash scripting: | Bash scripting:
| 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

View File

@ -1,7 +1,5 @@
<?php if (!defined('BASEPATH')) { <?php
exit('No direct script access allowed'); if (!defined('BASEPATH')) exit('No direct script access allowed');
}
/* /*
| ------------------------------------------------------------------- | -------------------------------------------------------------------
| DATABASE CONNECTIVITY SETTINGS | DATABASE CONNECTIVITY SETTINGS
@ -70,36 +68,42 @@
| |
| The $query_builder variables lets you determine whether or not to load | The $query_builder variables lets you determine whether or not to load
| the query builder class. | the query builder class.
*/ */
$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 */

View File

@ -1,6 +1,4 @@
<?php if (!defined('BASEPATH')) { <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
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">',
@ -10,8 +8,8 @@ $_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 */
/* Location: ./application/config/doctypes.php */ /* Location: ./application/config/doctypes.php */

View File

@ -1,7 +1,4 @@
<?php if (!defined('BASEPATH')) { <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
exit('No direct script access allowed');
}
/* /*
| ------------------------------------------------------------------- | -------------------------------------------------------------------
| Foreign Characters | Foreign Characters
@ -9,7 +6,7 @@
| This file contains an array of foreign characters for transliteration | This file contains an array of foreign characters for transliteration
| conversion used by the Text helper | conversion used by the Text helper
| |
*/ */
$foreign_characters = array( $foreign_characters = array(
'/ä|æ|ǽ/' => 'ae', '/ä|æ|ǽ/' => 'ae',
'/ö|œ/' => 'oe', '/ö|œ/' => 'oe',
@ -56,11 +53,11 @@ $foreign_characters = array(
'/Ź|Ż|Ž/' => 'Z', '/Ź|Ż|Ž/' => 'Z',
'/ź|ż|ž/' => 'z', '/ź|ż|ž/' => 'z',
'/Æ|Ǽ/' => 'AE', '/Æ|Ǽ/' => 'AE',
'/ß/' => 'ss', '/ß/'=> 'ss',
'/IJ/' => 'IJ', '/IJ/' => 'IJ',
'/ij/' => 'ij', '/ij/' => 'ij',
'/Œ/' => 'OE', '/Œ/' => 'OE',
'/ƒ/' => 'f', '/ƒ/' => 'f'
); );
/* End of file foreign_chars.php */ /* End of file foreign_chars.php */

View File

@ -1,6 +1,11 @@
<?php if (!defined('BASEPATH')) { <?php
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(
@ -13,7 +18,7 @@ $config['geshi_languages'] = array(
'actionscript' => 'Actionscript', 'actionscript' => 'Actionscript',
'actionscript3' => 'ActionScript3', 'actionscript3' => 'ActionScript3',
'ada' => 'Ada', 'ada' => 'Ada',
'aimms' => 'AIMMS', 'aimms' =>'AIMMS',
'algol68' => 'ALGOL 68', 'algol68' => 'ALGOL 68',
'apache' => 'Apache', 'apache' => 'Apache',
'applescript' => 'AppleScript', 'applescript' => 'AppleScript',

View File

@ -1,7 +1,4 @@
<?php if (!defined('BASEPATH')) { <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
exit('No direct script access allowed');
}
/* /*
| ------------------------------------------------------------------------- | -------------------------------------------------------------------------
| Hooks | Hooks
@ -11,7 +8,13 @@
| |
| http://codeigniter.com/user_guide/general/hooks.html | http://codeigniter.com/user_guide/general/hooks.html
| |
*/ */
$hook['pre_controller'][] = array(
'function' => 'pick_language',
'filename' => 'pick_language.php',
'filepath' => 'hooks'
);
/* End of file hooks.php */ /* End of file hooks.php */
/* Location: ./application/config/hooks.php */ /* Location: ./application/config/hooks.php */

View File

@ -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
@ -7,8 +7,9 @@
| Migrations are disabled by default but should be enabled | Migrations are disabled by default but should be enabled
| whenever you intend to do a schema migration. | whenever you intend to do a schema migration.
| |
*/ */
$config['migration_enabled'] = false; $config['migration_enabled'] = FALSE;
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@ -19,9 +20,10 @@ $config['migration_enabled'] = false;
| If you run $this->migration->latest() this is the version that schema will | If you run $this->migration->latest() this is the version that schema will
| be upgraded / downgraded to. | be upgraded / downgraded to.
| |
*/ */
$config['migration_version'] = 0; $config['migration_version'] = 0;
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Migrations Path | Migrations Path
@ -31,8 +33,9 @@ $config['migration_version'] = 0;
| Typically, it will be within your application path. | Typically, it will be within your application path.
| Also, writing permission is required within the migrations path. | Also, writing permission is required within the migrations path.
| |
*/ */
$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 */

View File

@ -1,4 +1,5 @@
<?php defined('BASEPATH') or exit('No direct script access allowed'); <?php
defined('BASEPATH') OR exit('No direct script access allowed');
/* /*
| ------------------------------------------------------------------- | -------------------------------------------------------------------
@ -7,7 +8,7 @@
| This file contains an array of mime types. It is used by the | This file contains an array of mime types. It is used by the
| Upload class to help identify allowed file types. | Upload class to help identify allowed file types.
| |
*/ */
return array( return array(
'hqx' => array('application/mac-binhex40', 'application/mac-binhex', 'application/x-binhex40', 'application/x-mac-binhex40'), 'hqx' => array('application/mac-binhex40', 'application/mac-binhex', 'application/x-binhex40', 'application/x-mac-binhex40'),
'cpt' => 'application/mac-compactpro', 'cpt' => 'application/mac-compactpro',
@ -179,5 +180,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'
); );

View File

@ -1,7 +1,4 @@
<?php if (!defined('BASEPATH')) { <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
exit('No direct script access allowed');
}
/* /*
| ------------------------------------------------------------------------- | -------------------------------------------------------------------------
| Profiler Sections | Profiler Sections
@ -12,7 +9,9 @@
| |
| http://codeigniter.com/user_guide/general/profiling.html | http://codeigniter.com/user_guide/general/profiling.html
| |
*/ */
/* End of file profiler.php */ /* End of file profiler.php */
/* Location: ./application/config/profiler.php */ /* Location: ./application/config/profiler.php */

View File

@ -1,7 +1,4 @@
<?php if (!defined('BASEPATH')) { <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
exit('No direct script access allowed');
}
/* /*
| ------------------------------------------------------------------------- | -------------------------------------------------------------------------
| URI ROUTING | URI ROUTING
@ -39,7 +36,7 @@
| This route will tell the Router what URI segments to use if those provided | This route will tell the Router what URI segments to use if those provided
| in the URL cannot be matched to a valid route. | in the URL cannot be matched to a valid route.
| |
*/ */
$route['default_controller'] = "main"; $route['default_controller'] = "main";
$route['scaffolding_trigger'] = ""; $route['scaffolding_trigger'] = "";

View File

@ -1,7 +1,4 @@
<?php if (!defined('BASEPATH')) { <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
exit('No direct script access allowed');
}
/* /*
| ------------------------------------------------------------------- | -------------------------------------------------------------------
| SMILEYS | SMILEYS
@ -13,7 +10,7 @@
| Please see user guide for more info: | Please see user guide for more info:
| http://codeigniter.com/user_guide/helpers/smiley_helper.html | http://codeigniter.com/user_guide/helpers/smiley_helper.html
| |
*/ */
$smileys = array( $smileys = array(
@ -61,9 +58,9 @@ $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
); );
/* End of file smileys.php */ /* End of file smileys.php */
/* Location: ./application/config/smileys.php */ /* Location: ./application/config/smileys.php */

View File

@ -1,13 +1,11 @@
<?php if (!defined('BASEPATH')) { <?php if (!defined('BASEPATH')) exit('No direct script access allowed');
exit('No direct script access allowed');
}
/** /**
* Site Name * Site Name
* *
* The name of your site * The name of your site
* *
*/ */
$config['site_name'] = 'Stikked'; $config['site_name'] = 'Stikked';
/** /**
@ -15,7 +13,7 @@ $config['site_name'] = 'Stikked';
* *
* Set the base URL of Stikked. WITH trailing slash! * Set the base URL of Stikked. WITH trailing slash!
* *
*/ */
$config['base_url'] = 'https://yourpastebin.com/'; $config['base_url'] = 'https://yourpastebin.com/';
/** /**
@ -24,7 +22,7 @@ $config['base_url'] = 'https://yourpastebin.com/';
* Credentials for your database * Credentials for your database
* The database structure will be created automatically * The database structure will be created automatically
* *
*/ */
$config['db_hostname'] = '127.0.0.1'; $config['db_hostname'] = '127.0.0.1';
$config['db_database'] = 'stikked'; $config['db_database'] = 'stikked';
$config['db_username'] = 'stikked'; $config['db_username'] = 'stikked';
@ -41,7 +39,7 @@ $config['db_password'] = 'stikked';
* Use underscore as suffix to easily see the tables. * Use underscore as suffix to easily see the tables.
* example: $config['db_prefix'] = 'stikked_'; * example: $config['db_prefix'] = 'stikked_';
* use $config['db_prefix'] = ''; if you don't want to use table prefix. * use $config['db_prefix'] = ''; if you don't want to use table prefix.
*/ */
$config['db_prefix'] = ''; $config['db_prefix'] = '';
/** /**
@ -51,7 +49,7 @@ $config['db_prefix'] = '';
* Folder name in htdocs/themes/ * Folder name in htdocs/themes/
* Currently: default, bootstrap, gabdark, gabdark3, geocities, snowkat, stikkedizr, cleanwhite, i386 * Currently: default, bootstrap, gabdark, gabdark3, geocities, snowkat, stikkedizr, cleanwhite, i386
* *
*/ */
$config['theme'] = 'default'; $config['theme'] = 'default';
/** /**
@ -59,7 +57,7 @@ $config['theme'] = 'default';
* *
* Whether or not to display the QR code * Whether or not to display the QR code
* *
*/ */
$config['qr_enabled'] = true; $config['qr_enabled'] = true;
/** /**
@ -72,7 +70,7 @@ $config['qr_enabled'] = true;
* CodeMirror: ~300kb JS * CodeMirror: ~300kb JS
* ACE: >800kb JS * ACE: >800kb JS
* *
*/ */
$config['js_editor'] = ''; // codemirror, ace, '' $config['js_editor'] = ''; // codemirror, ace, ''
/** /**
@ -82,7 +80,7 @@ $config['js_editor'] = ''; // codemirror, ace, ''
* Translate Stikked to your own language, see htdocs/application/language files * Translate Stikked to your own language, see htdocs/application/language files
* Currently: english, german, swissgerman, spanish, norwegian, danish, portuguese, turkish, french, japanese, polish, russian, chinese-simplified, chinese-traditional, indonesia * Currently: english, german, swissgerman, spanish, norwegian, danish, portuguese, turkish, french, japanese, polish, russian, chinese-simplified, chinese-traditional, indonesia
* *
*/ */
$config['language'] = 'english'; $config['language'] = 'english';
/** /**
@ -90,7 +88,7 @@ $config['language'] = 'english';
* *
* htdocs/static/asset/ folder must be writeable * htdocs/static/asset/ folder must be writeable
* *
*/ */
$config['combine_assets'] = false; $config['combine_assets'] = false;
/** /**
@ -100,7 +98,7 @@ $config['combine_assets'] = false;
* Format: http://php.net/manual/en/function.strtotime.php * Format: http://php.net/manual/en/function.strtotime.php
* Examples: '+10 seconds', '+1 year', '-1 week' * Examples: '+10 seconds', '+1 year', '-1 week'
* *
*/ */
$config['content_expiration'] = '-1 week'; $config['content_expiration'] = '-1 week';
/** /**
@ -157,10 +155,11 @@ $config['cron_key'] = '';
* polr_url: Your own instance of polr URL-shortener (Download: https://github.com/cydrobolt/polr) * polr_url: Your own instance of polr URL-shortener (Download: https://github.com/cydrobolt/polr)
* polr_api: Your polr api key * polr_api: Your polr api 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'] = '';
@ -179,12 +178,13 @@ $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
* *
* Basic auth user & pass for the backup URL, accessible via http://yoursite.com/backup * Basic auth user & pass for the backup URL, accessible via http://yoursite.com/backup
* *
**/ **/
$config['backup_user'] = ''; $config['backup_user'] = '';
$config['backup_pass'] = ''; $config['backup_pass'] = '';
@ -193,7 +193,7 @@ $config['backup_pass'] = '';
* *
* Number of pastes per page, on the recent pastes listings. * Number of pastes per page, on the recent pastes listings.
* *
**/ **/
$config['per_page'] = 15; $config['per_page'] = 15;
/** /**
@ -202,7 +202,7 @@ $config['per_page'] = 15;
* Require a key to interact with the API. * Require a key to interact with the API.
* Append to all API requests: ?apikey=[yourkey] * Append to all API requests: ?apikey=[yourkey]
* *
**/ **/
$config['apikey'] = ''; $config['apikey'] = '';
/** /**
@ -215,7 +215,7 @@ $config['apikey'] = '';
* This is useful to maintain a restrictive blocklist * This is useful to maintain a restrictive blocklist
* for spammers and bypass it using the apikey. * for spammers and bypass it using the apikey.
* *
**/ **/
$config['soft_api'] = false; $config['soft_api'] = false;
/** /**
@ -230,7 +230,7 @@ $config['soft_api'] = false;
* disable_shorturl: "Create Shorturl" option will be disabled * disable_shorturl: "Create Shorturl" option will be disabled
* disallow_search_engines: displays a robots.txt that forbids indexing * disallow_search_engines: displays a robots.txt that forbids indexing
* *
**/ **/
$config['private_only'] = false; $config['private_only'] = false;
$config['enable_captcha'] = true; $config['enable_captcha'] = true;
$config['recaptcha_publickey'] = ''; $config['recaptcha_publickey'] = '';
@ -257,7 +257,7 @@ $config['spamadmin_pass'] = '';
* 40320 (1 month) * 40320 (1 month)
* 483840 (1 year) * 483840 (1 year)
* 0 (keep forever) * 0 (keep forever)
**/ **/
$config['default_expiration'] = 0; $config['default_expiration'] = 0;
/** /**
@ -265,7 +265,7 @@ $config['default_expiration'] = 0;
* *
* Preselected language. See application/config/geshi_languages.php for valid values (array keys) * Preselected language. See application/config/geshi_languages.php for valid values (array keys)
* *
**/ **/
$config['default_language'] = 'text'; $config['default_language'] = 'text';
/** /**
@ -276,7 +276,7 @@ $config['default_language'] = 'text';
* Set to random for a random paste to be generated * Set to random for a random paste to be generated
* NOTE: if changed only pastes from then on will be updated. * NOTE: if changed only pastes from then on will be updated.
* *
**/ **/
$config['unknown_poster'] = 'random'; $config['unknown_poster'] = 'random';
/** /**
@ -285,7 +285,7 @@ $config['unknown_poster'] = 'random';
* What name is to be set for untitled pastes. * What name is to be set for untitled pastes.
* DO NOT SET BLANK * DO NOT SET BLANK
* NOTE: if changed only pastes from then on will be updated. * NOTE: if changed only pastes from then on will be updated.
**/ **/
$config['unknown_title'] = 'Untitled'; $config['unknown_title'] = 'Untitled';
/** /**
@ -294,7 +294,7 @@ $config['unknown_title'] = 'Untitled';
* Weather to require LDAP authenticaiton or not. * Weather to require LDAP authenticaiton or not.
* Set to either 'true' to require authentication or 'false' not to. * Set to either 'true' to require authentication or 'false' not to.
* NOTE: if changed, set LDAP settings in auth_ldap.php * NOTE: if changed, set LDAP settings in auth_ldap.php
**/ **/
$config['require_auth'] = false; $config['require_auth'] = false;
/** /**
@ -304,7 +304,7 @@ $config['require_auth'] = false;
* Variable $id: the paste_id * Variable $id: the paste_id
* Example: 'http://example.com/$id' * Example: 'http://example.com/$id'
* *
**/ **/
$config['displayurl_override'] = ''; $config['displayurl_override'] = '';
/** /**
@ -313,36 +313,36 @@ $config['displayurl_override'] = '';
* Words used for when unknown_poster is set to random * Words used for when unknown_poster is set to random
* *
* *
**/ **/
$config['nouns'] = array('Hornbill', 'Elephant', 'Bison', 'Lion', 'Camel', 'Sheep', $config['nouns'] = array('Hornbill', 'Elephant', 'Bison', 'Lion', 'Camel', 'Sheep',
'Monkey', 'Prairie Dog', 'Plover', 'Tapir', 'Capybara', 'Cheetah', 'Flamingo', 'Peccary', 'Eider', 'Porcupine', 'Pelican', 'Dove', 'Crane', 'Tortoise', 'Agouti', 'Monkey', 'Prairie Dog', 'Plover', 'Tapir', 'Capybara', 'Cheetah', 'Flamingo', 'Peccary', 'Eider', 'Porcupine', 'Pelican', 'Dove', 'Crane', 'Tortoise', 'Agouti',
'Tamarin', 'Pheasant', 'Owl', 'Gibbon', 'Goose', 'Baboon', 'Hamerkop', 'Zebra', 'Tamarin', 'Pheasant', 'Owl', 'Gibbon', 'Goose', 'Baboon', 'Hamerkop', 'Zebra',
'Macaw', 'Gibbon', 'Madrill', 'Wolf', 'Stork', 'Armadillo', 'Ostrich', 'Marmoset', 'Macaw', 'Gibbon', 'Madrill', 'Wolf', 'Stork', 'Armadillo', 'Ostrich', 'Marmoset',
'Lizard', 'Panda', 'Giraffe', 'Cassowary', 'Kangaroo', 'Gorilla', 'Pheasant', 'Lizard', 'Panda', 'Giraffe', 'Cassowary', 'Kangaroo', 'Gorilla', 'Pheasant',
'Finch', 'Duck', 'Matamata', 'Teal', 'Macaque', 'Goat', 'Lechwe', 'Ibis', 'Parrot', 'Finch', 'Duck', 'Matamata', 'Teal', 'Macaque', 'Goat', 'Lechwe', 'Ibis', 'Parrot',
'Parakeet', 'Bongo', 'Pudu', 'Echidna', 'Lemur', 'Bat', 'Curlew', 'Terrapin', 'Parakeet', 'Bongo', 'Pudu', 'Echidna', 'Lemur', 'Bat', 'Curlew', 'Terrapin',
'Peafowl', 'Duck', 'Owl', 'Parakeet', 'Meerkat', 'Tern', 'Wigeon', 'Pintail', 'Peafowl', 'Duck', 'Owl', 'Parakeet', 'Meerkat', 'Tern', 'Wigeon', 'Pintail',
'Meerkat', 'Motmot', 'Motmot', 'Shama', 'Dormouse', 'Horse', 'Rhinoceros', 'Sloth', 'Meerkat', 'Motmot', 'Motmot', 'Shama', 'Dormouse', 'Horse', 'Rhinoceros', 'Sloth',
'Mousedeer', 'Treeshrew', 'Bushbaby', 'Guinea Pig', 'Agouti', 'Water Vole', 'Hog', 'Mousedeer', 'Treeshrew', 'Bushbaby', 'Guinea Pig', 'Agouti', 'Water Vole', 'Hog',
'Pig', 'Anoa', 'Octupus', 'Butterfly', 'Cat', 'Kitten', 'Coyote', 'Crocodile', 'Pig', 'Anoa', 'Octupus', 'Butterfly', 'Cat', 'Kitten', 'Coyote', 'Crocodile',
'Cockroach', 'Crow', 'Bird', 'Dolphin', 'Earthworm', 'Frog', 'Hamster', 'Hedgehog', 'Cockroach', 'Crow', 'Bird', 'Dolphin', 'Earthworm', 'Frog', 'Hamster', 'Hedgehog',
'Hog', 'Human', 'Hummingbird', 'Iguana', 'Leech', 'Leopard', ' Marten', 'Hog', 'Human', 'Hummingbird', 'Iguana', 'Leech', 'Leopard', ' Marten',
'Mockingbird', 'Mockingjay', 'Mosquito', 'Moth', 'Partdridge', 'Bee', 'Penguin'); 'Mockingbird', 'Mockingjay', 'Mosquito', 'Moth', 'Partdridge', 'Bee', 'Penguin');
$config['adjectives'] = array('Ample', 'Mature', 'Bulky', 'Burly', 'Capacious', $config['adjectives'] = array('Ample', 'Mature', 'Bulky', 'Burly', 'Capacious',
'Colossal', 'Commodious', 'Thundering', 'Mammoth', 'Mungo', 'Voluminous', 'Colossal', 'Commodious', 'Thundering', 'Mammoth', 'Mungo', 'Voluminous',
'Walloping', 'Tiny', 'Baby', 'Bitty', 'Diminutive', 'Little', 'Paltry', 'Scanty', 'Walloping', 'Tiny', 'Baby', 'Bitty', 'Diminutive', 'Little', 'Paltry', 'Scanty',
'Trivial', 'Scribby', 'Blush', 'Tinct', 'Colorant', 'Aqua', 'Beige', 'Bistre', 'Trivial', 'Scribby', 'Blush', 'Tinct', 'Colorant', 'Aqua', 'Beige', 'Bistre',
'Buff', 'Bistre', 'Chartreuse', 'Chocolate', 'Cobalt', 'Coral', 'Cream', 'Crimson', 'Buff', 'Bistre', 'Chartreuse', 'Chocolate', 'Cobalt', 'Coral', 'Cream', 'Crimson',
'Denim', 'Emerald', 'Gray', 'Gamboge', 'Ivory', 'Mustard', 'Silly', 'Perl', 'Denim', 'Emerald', 'Gray', 'Gamboge', 'Ivory', 'Mustard', 'Silly', 'Perl',
'Whipped', 'Violet', 'Harmless', 'Gentle', 'Innocent', 'Reliable', 'Unreliable', 'Whipped', 'Violet', 'Harmless', 'Gentle', 'Innocent', 'Reliable', 'Unreliable',
'Soft', 'Toxic', 'Anorexic', 'Beefy', 'Sexy', 'Morose', 'Rude', 'Ungracious', 'Soft', 'Toxic', 'Anorexic', 'Beefy', 'Sexy', 'Morose', 'Rude', 'Ungracious',
'Abrupt', 'Gracious', 'Queen', 'Cute', 'Edgy', 'Insensitive', 'Round', 'Sharp', 'Abrupt', 'Gracious', 'Queen', 'Cute', 'Edgy', 'Insensitive', 'Round', 'Sharp',
'Gruff', 'Subtle', 'Crippled', 'Eratic', 'Social', 'Jittery', 'Sole', 'Unique', 'Gruff', 'Subtle', 'Crippled', 'Eratic', 'Social', 'Jittery', 'Sole', 'Unique',
'Botched', 'Tacky', 'Sludgy', 'Stained', 'Wet', 'Soiled', 'Big', 'Small', 'Sloppy', 'Botched', 'Tacky', 'Sludgy', 'Stained', 'Wet', 'Soiled', 'Big', 'Small', 'Sloppy',
'Smelly', 'Funky', 'Putrid', 'Melodic', 'Corrupt', 'Lousy', 'Fiery', 'Red', 'Smelly', 'Funky', 'Putrid', 'Melodic', 'Corrupt', 'Lousy', 'Fiery', 'Red',
'Sweet', 'Hot', 'Scorching', 'Sweltering', 'Torrid', 'Obese', 'Speedy', 'Flying', 'Sweet', 'Hot', 'Scorching', 'Sweltering', 'Torrid', 'Obese', 'Speedy', 'Flying',
'Idiotic', 'Chunky', 'Forensic'); 'Idiotic', 'Chunky', 'Forensic');
/** /**
* *
@ -350,9 +350,9 @@ $config['adjectives'] = array('Ample', 'Mature', 'Bulky', 'Burly', 'Capacious',
* Words used for expiring pastes * Words used for expiring pastes
* *
* *
**/ **/
$config['expires'] = array('expire', 'perish', 'go to its last resting place', $config['expires'] = array('expire', 'perish', 'go to its last resting place',
'go to meet its maker', 'cross the great divide', 'slip away', 'give up the ghost', 'go to meet its maker', 'cross the great divide', 'slip away', 'give up the ghost',
'kick the bucket', 'croak', 'bite the big one', 'check out', 'buy the farm', 'kick the bucket', 'croak', 'bite the big one', 'check out', 'buy the farm',
'join the choir invisible', 'shuffle off the mortal coil', 'hop the perch', 'join the choir invisible', 'shuffle off the mortal coil', 'hop the perch',
'run down the curtain', 'die', 'self destruct', 'explode'); 'run down the curtain', 'die', 'self destruct', 'explode');

View File

@ -1,7 +1,4 @@
<?php if (!defined('BASEPATH')) { <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
exit('No direct script access allowed');
}
/* /*
| ------------------------------------------------------------------- | -------------------------------------------------------------------
| USER AGENT TYPES | USER AGENT TYPES
@ -11,9 +8,9 @@
| mobile device data. The array keys are used to identify the device | mobile device data. The array keys are used to identify the device
| and the array values are used to set the actual name of the item. | and the array values are used to set the actual name of the item.
| |
*/ */
$platforms = array( $platforms = array (
'windows nt 6.0' => 'Windows Longhorn', 'windows nt 6.0' => 'Windows Longhorn',
'windows nt 5.2' => 'Windows 2003', 'windows nt 5.2' => 'Windows 2003',
'windows nt 5.0' => 'Windows 2000', 'windows nt 5.0' => 'Windows 2000',
@ -44,8 +41,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.
@ -71,25 +69,25 @@ $browsers = array(
'Links' => 'Links', 'Links' => 'Links',
'hotjava' => 'HotJava', 'hotjava' => 'HotJava',
'amaya' => 'Amaya', 'amaya' => 'Amaya',
'IBrowse' => 'IBrowse', 'IBrowse' => 'IBrowse'
); );
$mobiles = array( $mobiles = array(
// legacy array, old values commented out // legacy array, old values commented out
'mobileexplorer' => 'Mobile Explorer', 'mobileexplorer' => 'Mobile Explorer',
// 'openwave' => 'Open Wave', // 'openwave' => 'Open Wave',
// 'opera mini' => 'Opera Mini', // 'opera mini' => 'Opera Mini',
// 'operamini' => 'Opera Mini', // 'operamini' => 'Opera Mini',
// 'elaine' => 'Palm', // 'elaine' => 'Palm',
'palmsource' => 'Palm', 'palmsource' => 'Palm',
// 'digital paths' => 'Palm', // 'digital paths' => 'Palm',
// 'avantgo' => 'Avantgo', // 'avantgo' => 'Avantgo',
// 'xiino' => 'Xiino', // 'xiino' => 'Xiino',
'palmscape' => 'Palmscape', 'palmscape' => 'Palmscape',
// 'nokia' => 'Nokia', // 'nokia' => 'Nokia',
// 'ericsson' => 'Ericsson', // 'ericsson' => 'Ericsson',
// 'blackberry' => 'BlackBerry', // 'blackberry' => 'BlackBerry',
// 'motorola' => 'Motorola' // 'motorola' => 'Motorola'
// Phones and Manufacturers // Phones and Manufacturers
'motorola' => "Motorola", 'motorola' => "Motorola",
@ -161,8 +159,8 @@ $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.
$robots = array( $robots = array(
@ -173,8 +171,8 @@ $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 */
/* Location: ./application/config/user_agents.php */ /* Location: ./application/config/user_agents.php */

View File

@ -1,28 +1,41 @@
<?php if (!defined('BASEPATH')) { <?php
exit('No direct script access allowed'); /**
} * Class and Function List:
* Function list:
include_once 'application/controllers/Main.php'; * - __construct()
* - 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
{ {
public function __construct() 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");
} }
} }
public function index() function index()
{ {
$languages = $this->languages->get_languages(); $languages = $this->languages->get_languages();
$languages = array_keys($languages); $languages = array_keys($languages);
@ -31,47 +44,60 @@ class Api extends Main
$this->load->view('api_help', $data); $this->load->view('api_help', $data);
} }
public function create() 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');
} }
@ -82,22 +108,27 @@ class Api extends Main
} }
} }
public function paste() 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',
); );
@ -105,14 +136,16 @@ class Api extends Main
echo json_encode($data); echo json_encode($data);
} }
public function random() 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');
@ -120,21 +153,24 @@ class Api extends Main
echo json_encode($data); echo json_encode($data);
} }
public function recent() 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'],
@ -146,21 +182,24 @@ class Api extends Main
echo json_encode($data); echo json_encode($data);
} }
public function trending() 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'],
@ -173,9 +212,10 @@ class Api extends Main
echo json_encode($data); echo json_encode($data);
} }
public function langs() 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");
} }

View File

@ -1,24 +1,35 @@
<?php if (!defined('BASEPATH')) { <?php
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.
Auth_Ldap is free software: you can redistribute it and/or modify Auth_Ldap is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
Auth_Ldap is distributed in the hope that it will be useful, Auth_Ldap is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with Auth_Ldap. If not, see <http://www.gnu.org/licenses/>. along with Auth_Ldap. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
/** /**
* @author Greg Wojtak <gwojtak@techrockdo.com> * @author Greg Wojtak <gwojtak@techrockdo.com>
* @copyright Copyright © 2010,2011 by Greg Wojtak <gwojtak@techrockdo.com> * @copyright Copyright © 2010,2011 by Greg Wojtak <gwojtak@techrockdo.com>
@ -30,7 +41,7 @@ along with Auth_Ldap. If not, see <http://www.gnu.org/licenses/>.
class Auth extends CI_Controller class Auth extends CI_Controller
{ {
public function __construct() function __construct()
{ {
parent::__construct(); parent::__construct();
$this->load->helper('form'); $this->load->helper('form');
@ -40,17 +51,18 @@ class Auth extends CI_Controller
$this->load->library('table'); $this->load->library('table');
} }
public function index() function index()
{ {
$this->session->keep_flashdata('tried_to'); $this->session->keep_flashdata('tried_to');
$this->login(); $this->login();
} }
public function login($errorMsg = null) 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;
@ -59,43 +71,56 @@ 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('/');
} }
} }
public function logout() 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 { }
$data['logged_in'] = false; else
{
$data['logged_in'] = FALSE;
} }
redirect('/'); redirect('/');
} }
public function alpha_dash_dot($str) public
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;
} }
} }
?>

View File

@ -1,11 +1,17 @@
<?php if (!defined('BASEPATH')) { <?php
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
{ {
public function __construct() function __construct()
{ {
parent::__construct(); parent::__construct();
@ -13,21 +19,22 @@ 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;
} }
} }
public function index() function index()
{ {
// Load the DB utility class // Load the DB utility class
$this->load->dbutil(); $this->load->dbutil();
// Backup your entire database and assign it to a variable // Backup your entire database and assign it to a variable
$backup = &$this->dbutil->backup(); $backup = & $this->dbutil->backup();
// Load the download helper and send the file to your desktop // Load the download helper and send the file to your desktop
$this->load->helper('download'); $this->load->helper('download');

View File

@ -1,24 +1,31 @@
<?php if (!defined('BASEPATH')) { <?php
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
{ {
public function __construct() function __construct()
{ {
parent::__construct(); parent::__construct();
$this->load->model('languages'); $this->load->model('languages');
} }
public function index() 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);
} }
public function view() function view()
{ {
$this->load->model('pastes'); $this->load->model('pastes');
$data = $this->pastes->getPaste(3); $data = $this->pastes->getPaste(3);

File diff suppressed because it is too large Load Diff

View File

@ -1,11 +1,20 @@
<?php if (!defined('BASEPATH')) { <?php
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
{ {
public function __construct() function __construct()
{ {
parent::__construct(); parent::__construct();
@ -22,27 +31,32 @@ 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;
} }
} }
public function index() 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');
} }
@ -54,25 +68,28 @@ class Spamadmin extends CI_Controller
$this->load->view('list_ips', $data); $this->load->view('list_ips', $data);
} }
public function spam_detail() 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() ,
'spam_attempts' => $paste_count, 'spam_attempts' => $paste_count,
)); ));
} }
@ -84,10 +101,13 @@ 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);
@ -99,7 +119,7 @@ class Spamadmin extends CI_Controller
$this->load->view('spam_detail', $data); $this->load->view('spam_detail', $data);
} }
public function blacklist() function blacklist()
{ {
//pagination //pagination
@ -129,7 +149,7 @@ class Spamadmin extends CI_Controller
$this->load->view('list_blocked_ips', $data); $this->load->view('list_blocked_ips', $data);
} }
public function unblock_ip() 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);

View File

@ -1,53 +1,73 @@
<?php if (!defined('BASEPATH')) { <?php
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
{ {
public function __construct()
function __construct()
{ {
parent::__construct(); parent::__construct();
$this->theme = config_item('theme'); $this->theme = config_item('theme');
} }
public function css() 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');
} }
@ -55,21 +75,24 @@ 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;
} }
@ -80,7 +103,7 @@ class Theme_assets extends CI_Controller
} }
} }
public function fonts() function fonts()
{ {
$font_file = $this->uri->segment(4); $font_file = $this->uri->segment(4);
@ -89,34 +112,43 @@ 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');
} }
@ -124,7 +156,7 @@ class Theme_assets extends CI_Controller
readfile($file_path); readfile($file_path);
} }
public function images() function images()
{ {
$image_file = $this->uri->segment(4); $image_file = $this->uri->segment(4);
$image_file = basename($image_file); $image_file = basename($image_file);
@ -133,12 +165,16 @@ class Theme_assets extends CI_Controller
$file_path = 'themes/' . $this->theme . '/images/' . $image_file; $file_path = 'themes/' . $this->theme . '/images/' . $image_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/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;
} }
@ -149,8 +185,9 @@ class Theme_assets extends CI_Controller
readfile($file_path); readfile($file_path);
} }
public function js() function js()
{ {
//get js //get js
$segments = $this->uri->segment_array(); $segments = $this->uri->segment_array();
array_shift($segments); array_shift($segments);
@ -163,12 +200,16 @@ class Theme_assets extends CI_Controller
$file_path = 'themes/' . $this->theme . '/js/' . $js_file; $file_path = 'themes/' . $this->theme . '/js/' . $js_file;
//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 '';
} }
@ -178,8 +219,8 @@ 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));
} }

View File

@ -1,22 +1,29 @@
<?php if (!defined('BASEPATH')) { <?php
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
{ {
public function __construct() function __construct()
{ {
parent::__construct(); parent::__construct();
//protection //protection
if ($_SERVER['HTTP_HOST'] != 'stikked') { if ($_SERVER['HTTP_HOST'] != 'stikked')
{
exit; exit;
} }
} }
public function index() function index()
{ {
$this->load->library('unit_test'); $this->load->library('unit_test');
$this->load->model('pastes'); $this->load->model('pastes');

View File

@ -1,17 +1,26 @@
<?php if (!defined('BASEPATH')) { <?php
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
{ {
public function __construct() function __construct()
{ {
parent::__construct(); parent::__construct();
log_message('debug', 'MY_Loader Class Initialized'); log_message('debug', 'MY_Loader Class Initialized');
} }
public function view($view, $vars = array(), $return = false) function view($view, $vars = array() , $return = FALSE)
{ {
//theme name //theme name
@ -22,15 +31,16 @@ 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';
} }
//return //return
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
)); ));
} }
@ -49,7 +59,8 @@ 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 function _ci_load($_ci_data) protected
function _ci_load($_ci_data)
{ {
// Set the default data variables // Set the default data variables
@ -57,21 +68,26 @@ 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 ***
* *
@ -82,30 +98,35 @@ 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);
} }
// This allows anything loaded using $this->load (views, files, etc.) // This allows anything loaded using $this->load (views, files, etc.)
// 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;
} }
} }
@ -118,7 +139,8 @@ 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);
@ -141,17 +163,23 @@ 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 { }
include $_ci_path; // include() vs include_once() allows for multiple views with the same name else
{
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;
@ -167,9 +195,12 @@ 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();
} }

View File

@ -1,7 +1,14 @@
<?php if (!defined('BASEPATH')) { <?php
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
* *
@ -41,7 +48,8 @@
* @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 = '')
{ {
@ -52,34 +60,43 @@ 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;
} }
// ----------------------------------- // -----------------------------------
@ -88,14 +105,17 @@ 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);
} }
} }
@ -107,11 +127,14 @@ 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;
} }
@ -122,7 +145,7 @@ if (!function_exists('create_captcha')) {
// ----------------------------------- // -----------------------------------
$length = strlen($word); $length = strlen($word);
$angle = ($length >= 6) ? rand(-($length - 6), ($length - 6)) : 0; $angle = ($length >= 6) ? rand(-($length - 6) , ($length - 6)) : 0;
$x_axis = rand(6, (360 / $length) - 16); $x_axis = rand(6, (360 / $length) - 16);
$y_axis = ($angle >= 0) ? rand($img_height, $img_width) : rand(6, $img_height); $y_axis = ($angle >= 0) ? rand($img_height, $img_width) : rand(6, $img_height);
@ -133,9 +156,13 @@ 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);
} }
@ -167,7 +194,8 @@ 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;
@ -185,27 +213,34 @@ 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;
} }
} }
@ -228,7 +263,7 @@ if (!function_exists('create_captcha')) {
return array( return array(
'word' => $word, 'word' => $word,
'time' => $now, 'time' => $now,
'image' => $img, 'image' => $img
); );
} }
} }
@ -239,13 +274,14 @@ 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 = '')
{ {
$data = ''; $data = '';
list($usec, $sec) = explode(" ", microtime()); list($usec, $sec) = explode(" ", microtime());
$now = ((float) $usec + (float) $sec); $now = ((float)$usec + (float)$sec);
$defaults = array( $defaults = array(
'word' => $word, 'word' => $word,
'img_path' => '', 'img_path' => '',
@ -253,22 +289,28 @@ 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;
} }
// ----------------------------------- // -----------------------------------
@ -276,11 +318,14 @@ 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;
} }
@ -291,7 +336,7 @@ if (!function_exists('display_captcha')) {
// ----------------------------------- // -----------------------------------
$length = strlen($word); $length = strlen($word);
$angle = ($length >= 6) ? mt_rand(-($length - 6), ($length - 6)) : 0; $angle = ($length >= 6) ? mt_rand(-($length - 6) , ($length - 6)) : 0;
$angle = 10; $angle = 10;
$x_axis = mt_rand(6, (360 / $length) - 16); $x_axis = mt_rand(6, (360 / $length) - 16);
$y_axis = ($angle >= 0) ? mt_rand($img_height, $img_width) : mt_rand(6, $img_height); $y_axis = ($angle >= 0) ? mt_rand($img_height, $img_width) : mt_rand(6, $img_height);
@ -303,9 +348,13 @@ 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);
} }
@ -314,11 +363,12 @@ if (!function_exists('display_captcha')) {
// ----------------------------------- // -----------------------------------
function b() function b()
{ {
return mt_rand(240, 255); return mt_rand(240, 255);
} }
$bg_color = imagecolorallocate($im, b(), b(), b()); $bg_color = imagecolorallocate($im, b() , b() , b());
$border_color = imagecolorallocate($im, 153, 102, 102); $border_color = imagecolorallocate($im, 153, 102, 102);
$text_color = imagecolorallocate($im, 204, 153, 153); $text_color = imagecolorallocate($im, 204, 153, 153);
$grid_color = imagecolorallocate($im, 255, 182, 182); $grid_color = imagecolorallocate($im, 255, 182, 182);
@ -341,7 +391,8 @@ 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;
@ -364,27 +415,34 @@ 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;
} }
} }
@ -409,4 +467,5 @@ 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 */

View File

@ -1,13 +1,19 @@
<?php if (!defined('BASEPATH')) { <?php
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 you are on a version of PHP before 5.2, this might help:
if (!function_exists('json_encode')) {
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':
@ -24,23 +30,29 @@ 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
} }
} }
} }

View File

@ -1,7 +1,13 @@
<?php if (!defined('BASEPATH')) { <?php
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
* *
@ -41,14 +47,16 @@
* @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 . ']');
@ -63,17 +71,19 @@ 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()
{ {
$CI = &get_instance(); $CI = & get_instance();
$expires = $CI->config->item('expires'); $expires = $CI->config->item('expires');
return $expires[rand(0, sizeof($expires) - 1)]; return $expires[rand(0, sizeof($expires) - 1) ];
} }
} }
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
/* End of file language_helper.php */ /* End of file language_helper.php */
/* Location: ./system/helpers/language_helper.php */ /* Location: ./system/helpers/language_helper.php */

View File

@ -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,10 +64,9 @@ 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);
$http_request = "POST $path HTTP/1.0\r\n"; $http_request = "POST $path HTTP/1.0\r\n";
$http_request .= "Host: $host\r\n"; $http_request .= "Host: $host\r\n";
@ -78,22 +77,22 @@ function _recaptcha_http_post($host, $path, $data, $port = 80)
$http_request .= $req; $http_request .= $req;
$response = ''; $response = '';
if (false == ($fs = @fsockopen($host, $port, $errno, $errstr, 10))) { if( false == ( $fs = @fsockopen($host, $port, $errno, $errstr, 10) ) ) {
die('Could not open socket'); die ('Could not open socket');
} }
fwrite($fs, $http_request); fwrite($fs, $http_request);
while (!feof($fs)) { while ( !feof($fs) )
$response .= fgets($fs, 1160); $response .= fgets($fs, 1160); // One TCP-IP packet
}
// 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
@ -104,10 +103,10 @@ function _recaptcha_http_post($host, $path, $data, $port = 80)
* @return string - The HTML to be embedded in the user's form. * @return string - The HTML to be embedded in the user's form.
*/ */
function recaptcha_get_html($pubkey, $error = null, $use_ssl = false) function recaptcha_get_html ($pubkey, $error = null, $use_ssl = false)
{ {
if ($pubkey == null || $pubkey == '') { if ($pubkey == null || $pubkey == '') {
die("To use reCAPTCHA you must get an API key from <a href='https://www.google.com/recaptcha/admin/create'>https://www.google.com/recaptcha/admin/create</a>"); die ("To use reCAPTCHA you must get an API key from <a href='https://www.google.com/recaptcha/admin/create'>https://www.google.com/recaptcha/admin/create</a>");
} }
if ($use_ssl) { if ($use_ssl) {
@ -123,24 +122,28 @@ 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>
<iframe src="'. $server . '/noscript?k=' . $pubkey . $errorpart . '" height="300" width="500" frameborder="0"></iframe><br/> <iframe src="'. $server . '/noscript?k=' . $pubkey . $errorpart . '" height="300" width="500" frameborder="0"></iframe><br/>
<textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea> <textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea>
<input type="hidden" name="recaptcha_response_field" value="manual_challenge"/> <input type="hidden" name="recaptcha_response_field" value="manual_challenge"/>
</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;
public $is_valid; var $error;
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
@ -150,16 +153,18 @@ class ReCaptchaResponse
* @param array $extra_params an array of extra variables to post to the server * @param array $extra_params an array of extra variables to post to the server
* @return ReCaptchaResponse * @return ReCaptchaResponse
*/ */
function recaptcha_check_answer($privkey, $remoteip, $challenge, $response, $extra_params = array()) function recaptcha_check_answer ($privkey, $remoteip, $challenge, $response, $extra_params = array())
{ {
if ($privkey == null || $privkey == '') { if ($privkey == null || $privkey == '') {
die("To use reCAPTCHA you must get an API key from <a href='https://www.google.com/recaptcha/admin/create'>https://www.google.com/recaptcha/admin/create</a>"); die ("To use reCAPTCHA you must get an API key from <a href='https://www.google.com/recaptcha/admin/create'>https://www.google.com/recaptcha/admin/create</a>");
} }
if ($remoteip == null || $remoteip == '') { if ($remoteip == null || $remoteip == '') {
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();
@ -168,23 +173,24 @@ function recaptcha_check_answer($privkey, $remoteip, $challenge, $response, $ext
return $recaptcha_response; return $recaptcha_response;
} }
$response = _recaptcha_http_post(RECAPTCHA_VERIFY_SERVER, "/recaptcha/api/verify", $response = _recaptcha_http_post (RECAPTCHA_VERIFY_SERVER, "/recaptcha/api/verify",
array( array (
'privatekey' => $privkey, 'privatekey' => $privkey,
'remoteip' => $remoteip, 'remoteip' => $remoteip,
'challenge' => $challenge, 'challenge' => $challenge,
'response' => $response, 'response' => $response
) + $extra_params ) + $extra_params
); );
$answers = explode("\n", $response[1]); $answers = explode ("\n", $response [1]);
$recaptcha_response = new ReCaptchaResponse(); $recaptcha_response = new ReCaptchaResponse();
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];
} }
return $recaptcha_response; return $recaptcha_response;
@ -197,48 +203,45 @@ function recaptcha_check_answer($privkey, $remoteip, $challenge, $response, $ext
* @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));
} }
/* 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.");
} }
$mode = MCRYPT_MODE_CBC; $mode=MCRYPT_MODE_CBC;
$enc = MCRYPT_RIJNDAEL_128; $enc=MCRYPT_RIJNDAEL_128;
$val = _recaptcha_aes_pad($val); $val=_recaptcha_aes_pad($val);
return mcrypt_encrypt($enc, $ky, $val, $mode, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"); 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);
$cryptmail = _recaptcha_aes_encrypt($email, $ky);
return "https://www.google.com/recaptcha/mailhide/d?k=" . $pubkey . "&c=" . _recaptcha_mailhide_urlbase64($cryptmail); $ky = pack('H*', $privkey);
$cryptmail = _recaptcha_aes_encrypt ($email, $ky);
return "https://www.google.com/recaptcha/mailhide/d?k=" . $pubkey . "&c=" . _recaptcha_mailhide_urlbase64 ($cryptmail);
} }
/** /**
@ -246,16 +249,15 @@ 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) {
$arr[0] = substr($arr[0], 0, 1); $arr[0] = substr ($arr[0], 0, 1);
} else if (strlen($arr[0]) <= 6) { } else if (strlen ($arr[0]) <= 6) {
$arr[0] = substr($arr[0], 0, 3); $arr[0] = substr ($arr[0], 0, 3);
} else { } else {
$arr[0] = substr($arr[0], 0, 4); $arr[0] = substr ($arr[0], 0, 4);
} }
return $arr; return $arr;
} }
@ -266,12 +268,14 @@ 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);
return htmlentities($emailparts[0]) . "<a href='" . htmlentities($url) . return htmlentities($emailparts[0]) . "<a href='" . htmlentities ($url) .
"' onclick=\"window.open('" . htmlentities($url) . "', '', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=300'); return false;\" title=\"Reveal this e-mail address\">...</a>@" . htmlentities($emailparts[1]); "' 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]);
} }
?>

View File

@ -1,48 +1,61 @@
<?php if (!defined('BASEPATH')) { <?php
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
{ {
public function __construct() 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');
} }
} }
public function valid_language($lang) function valid_language($lang)
{ {
return array_key_exists($lang, $this->geshi_languages); return array_key_exists($lang, $this->geshi_languages);
} }
public function get_languages() 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;
} }
public function code_to_description($code) 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

View File

@ -53,7 +53,7 @@
* *
* NOTE: If you change these, also change the error_reporting() code below * NOTE: If you change these, also change the error_reporting() code below
*/ */
define('ENVIRONMENT', isset($_SERVER['CI_ENV']) ? $_SERVER['CI_ENV'] : 'development'); define('ENVIRONMENT', isset($_SERVER['CI_ENV']) ? $_SERVER['CI_ENV'] : 'development');
/* /*
*--------------------------------------------------------------- *---------------------------------------------------------------
@ -63,7 +63,8 @@ define('ENVIRONMENT', isset($_SERVER['CI_ENV']) ? $_SERVER['CI_ENV'] : 'developm
* 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);
@ -72,15 +73,18 @@ 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
} }
@ -93,7 +97,7 @@ switch (ENVIRONMENT) {
* This variable must contain the name of your "system" directory. * This variable must contain the name of your "system" directory.
* Set the path if it is not in the same directory as this file. * Set the path if it is not in the same directory as this file.
*/ */
$system_path = 'system'; $system_path = 'system';
/* /*
*--------------------------------------------------------------- *---------------------------------------------------------------
@ -110,7 +114,7 @@ $system_path = 'system';
* *
* NO TRAILING SLASH! * NO TRAILING SLASH!
*/ */
$application_folder = 'application'; $application_folder = 'application';
/* /*
*--------------------------------------------------------------- *---------------------------------------------------------------
@ -125,7 +129,8 @@ $application_folder = 'application';
* *
* NO TRAILING SLASH! * NO TRAILING SLASH!
*/ */
$view_folder = 'themes/default/views'; $view_folder = 'themes/default/views';
/* /*
* -------------------------------------------------------------------- * --------------------------------------------------------------------
@ -146,15 +151,16 @@ $view_folder = 'themes/default/views';
* *
* Un-comment the $routing array below to use this feature * Un-comment the $routing array below to use this feature
*/ */
// The directory name, relative to the "controllers" directory. Leave blank // The directory name, relative to the "controllers" directory. Leave blank
// if your controller is not in a sub-directory within the "controllers" one // if your controller is not in a sub-directory within the "controllers" one
// $routing['directory'] = ''; // $routing['directory'] = '';
// The controller class file name. Example: mycontroller // The controller class file name. Example: mycontroller
// $routing['controller'] = ''; // $routing['controller'] = '';
// The controller function you wish to be called.
// $routing['function'] = '';
// The controller function you wish to be called.
// $routing['function'] = '';
/* /*
* ------------------------------------------------------------------- * -------------------------------------------------------------------
@ -170,7 +176,9 @@ $view_folder = 'themes/default/views';
* *
* Un-comment the $assign_to_config array below to use this feature * Un-comment the $assign_to_config array below to use this feature
*/ */
// $assign_to_config['name_of_config_item'] = 'value of config item'; // $assign_to_config['name_of_config_item'] = 'value of config item';
// -------------------------------------------------------------------- // --------------------------------------------------------------------
// END OF USER CONFIGURABLE SETTINGS. DO NOT EDIT BELOW THIS LINE // END OF USER CONFIGURABLE SETTINGS. DO NOT EDIT BELOW THIS LINE
@ -182,97 +190,120 @@ $view_folder = 'themes/default/views';
* --------------------------------------------------------------- * ---------------------------------------------------------------
*/ */
// 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; {
} else { $system_path = $_temp.DIRECTORY_SEPARATOR;
}
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, '/\\'),
'/\\', '/\\',
DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR
) . DIRECTORY_SEPARATOR; ).DIRECTORY_SEPARATOR;
} }
// 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); {
echo 'Your system folder path does not appear to be set correctly. Please open the following file and correct this: ' . pathinfo(__FILE__, PATHINFO_BASENAME); header('HTTP/1.1 503 Service Unavailable.', TRUE, 503);
echo 'Your system folder path does not appear to be set correctly. Please open the following file and correct this: '.pathinfo(__FILE__, PATHINFO_BASENAME);
exit(3); // EXIT_CONFIG exit(3); // EXIT_CONFIG
} }
/* /*
* ------------------------------------------------------------------- * -------------------------------------------------------------------
* Now that we know the path, set the main path constants * Now that we know the path, set the main path constants
* ------------------------------------------------------------------- * -------------------------------------------------------------------
*/ */
// The name of THIS file // The name of THIS file
define('SELF', pathinfo(__FILE__, PATHINFO_BASENAME)); define('SELF', pathinfo(__FILE__, PATHINFO_BASENAME));
// Path to the system directory // Path to the system directory
define('BASEPATH', $system_path); define('BASEPATH', $system_path);
// Path to the front controller (this file) directory // Path to the front controller (this file) directory
define('FCPATH', dirname(__FILE__) . DIRECTORY_SEPARATOR); define('FCPATH', dirname(__FILE__).DIRECTORY_SEPARATOR);
// Name of the "system" directory // Name of the "system" directory
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)) { }
$application_folder = BASEPATH . strtr( elseif (is_dir(BASEPATH.$application_folder.DIRECTORY_SEPARATOR))
{
$application_folder = BASEPATH.strtr(
trim($application_folder, '/\\'), trim($application_folder, '/\\'),
'/\\', '/\\',
DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR
); );
} else { }
header('HTTP/1.1 503 Service Unavailable.', true, 503); else
echo 'Your application folder path does not appear to be set correctly. Please open the following file and correct this: ' . SELF; {
header('HTTP/1.1 503 Service Unavailable.', TRUE, 503);
echo 'Your application folder path does not appear to be set correctly. Please open the following file and correct this: '.SELF;
exit(3); // EXIT_CONFIG exit(3); // EXIT_CONFIG
} }
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'; {
} elseif (is_dir($view_folder)) { $view_folder = APPPATH.'views';
if (($_temp = realpath($view_folder)) !== false) { }
elseif (is_dir($view_folder))
{
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)) { }
$view_folder = APPPATH . strtr( elseif (is_dir(APPPATH.$view_folder.DIRECTORY_SEPARATOR))
{
$view_folder = APPPATH.strtr(
trim($view_folder, '/\\'), trim($view_folder, '/\\'),
'/\\', '/\\',
DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR
); );
} else { }
header('HTTP/1.1 503 Service Unavailable.', true, 503); else
echo 'Your view folder path does not appear to be set correctly. Please open the following file and correct this: ' . SELF; {
header('HTTP/1.1 503 Service Unavailable.', TRUE, 503);
echo 'Your view folder path does not appear to be set correctly. Please open the following file and correct this: '.SELF;
exit(3); // EXIT_CONFIG exit(3); // EXIT_CONFIG
} }
define('VIEWPATH', $view_folder . DIRECTORY_SEPARATOR); define('VIEWPATH', $view_folder.DIRECTORY_SEPARATOR);
/* /*
* -------------------------------------------------------------------- * --------------------------------------------------------------------
@ -281,4 +312,4 @@ define('VIEWPATH', $view_folder . DIRECTORY_SEPARATOR);
* *
* And away we go... * And away we go...
*/ */
require_once BASEPATH . 'core/CodeIgniter.php'; require_once BASEPATH.'core/CodeIgniter.php';

View File

@ -1,31 +1,31 @@
var ST = window.ST || {}; var ST = window.ST || {};
ST.show_embed = function () { ST.show_embed = function() {
$embed_field = $('#embed_field'); $embed_field = $('#embed_field');
var lang_showcode = $embed_field.data('lang-showcode'); var lang_showcode = $embed_field.data('lang-showcode');
$embed_field.hide(); $embed_field.hide();
$embed_field.after('<a id="show_code" href="#">' + lang_showcode + '</a>'); $embed_field.after('<a id="show_code" href="#">' + lang_showcode + '</a>');
$('#show_code').on('click', function (e) { $('#show_code').on('click', function(e) {
e.preventDefault(); e.preventDefault();
$(this).hide(); $(this).hide();
$embed_field.show().select(); $embed_field.show().select();
}); });
$embed_field.on("blur", function () { $embed_field.on("blur", function() {
$(this).hide(); $(this).hide();
$('#show_code').show(); $('#show_code').show();
}); });
}; };
ST.spamadmin = function () { ST.spamadmin = function() {
if ($('.content h1').text() == 'Spamadmin') { if ($('.content h1').text() == 'Spamadmin') {
$('.content .hidden').show(); $('.content .hidden').show();
$('.content .quick_remove').live('click', function (ev) { $('.content .quick_remove').live('click', function(ev) {
var ip = $(ev.target).data('ip'); var ip = $(ev.target).data('ip');
if (confirm('Delete all pastes belonging to ' + ip + '?')) { if (confirm('Delete all pastes belonging to ' + ip + '?')) {
$.post(base_url + 'spamadmin/' + ip, { $.post(base_url + 'spamadmin/' + ip, {
'confirm_remove': 'yes', 'confirm_remove': 'yes',
'block_ip': 1 'block_ip': 1
}, function () { }, function() {
window.location.reload(); window.location.reload();
}); });
} }
@ -34,42 +34,42 @@ ST.spamadmin = function () {
} }
// needed by .selectable // needed by .selectable
$.fn.addBack = function (selector) { $.fn.addBack = function(selector) {
return this.add(selector == null ? this.prevObject : this.prevObject.filter(selector)); return this.add(selector == null ? this.prevObject : this.prevObject.filter(selector));
} }
$('.selectable>tbody').selectable({ // $('.selectable>tbody').selectable({
filter: 'tr', // filter: 'tr',
cancel: 'a', // cancel: 'a',
stop: function () { // stop: function() {
var $deletestack = $(".paste_deletestack"); // var $deletestack = $(".paste_deletestack");
var $input = $("input[name=pastes_to_delete]"); // var $input = $("input[name=pastes_to_delete]");
$('.inv').show(); // $('.inv').show();
$deletestack.empty(); // $deletestack.empty();
$input.empty(); // $input.empty();
var res = []; // var res = [];
$(".ui-selected").each(function (i, el) { // $(".ui-selected").each(function(i, el) {
var id = $('a', el).attr('href').split('view/')[1]; // var id = $('a', el).attr('href').split('view/')[1];
res.push(id); // res.push(id);
}); // });
$deletestack.text(res.join(' ')); // $deletestack.text(res.join(' '));
$input.val(res.join(' ')); // $input.val(res.join(' '));
} // }
}); // });
}; };
ST.line_highlighter = function () { ST.line_highlighter = function() {
var org_href = window.location.href.replace(/(.*?)#(.*)/, '$1'); var org_href = window.location.href.replace(/(.*?)#(.*)/, '$1');
var first_line = false; var first_line = false;
var second_line = false; var second_line = false;
$('blockquote').on('mousedown', function (ev) { $('blockquote').on('mousedown', function(ev) {
if (ev.which == 1) { // left mouse button has been clicked if (ev.which == 1) { // left mouse button has been clicked
window.getSelection().removeAllRanges(); window.getSelection().removeAllRanges();
} }
}); });
$('blockquote').on('click', 'li', function (ev) { $('blockquote').on('click', 'li', function(ev) {
var $this = $(this); var $this = $(this);
var li_num = ($this.index() + 1); var li_num = ($this.index() + 1);
if (ev.shiftKey == 1) { if (ev.shiftKey == 1) {
@ -100,7 +100,7 @@ ST.line_highlighter = function () {
} }
ST.highlight_lines = function () { ST.highlight_lines = function() {
var wloc = window.location.href; var wloc = window.location.href;
if (wloc.indexOf('#') > -1) { if (wloc.indexOf('#') > -1) {
$('.container .CodeMirror li').css('background', 'none'); $('.container .CodeMirror li').css('background', 'none');
@ -123,9 +123,9 @@ ST.highlight_lines = function () {
} }
} }
ST.crypto = function () { ST.crypto = function() {
$('button[name=submit]').after('&nbsp;&nbsp;<button type="submit" id="create_encrypted" class="btn-large btn-success"> <i class="icon-lock icon-white"></i> Create encrypted</button>'); $('button[name=submit]').after('&nbsp;&nbsp;<button type="submit" id="create_encrypted" class="btn-large btn-success"> <i class="icon-lock icon-white"></i> Create encrypted</button>');
$('#create_encrypted').on('click', function () { $('#create_encrypted').on('click', function() {
var $code = $('#code'); var $code = $('#code');
// encrypt the paste // encrypt the paste
@ -147,14 +147,12 @@ ST.crypto = function () {
'captcha': $('#captcha').val(), 'captcha': $('#captcha').val(),
'reply': $('input[name=reply]').val() 'reply': $('input[name=reply]').val()
}, },
function (redirect_url) { function(redirect_url) {
if (redirect_url.indexOf('E_CAPTCHA') > -1) { if (redirect_url.indexOf('E_CAPTCHA') > -1) {
$('.container .message').remove(); $('.container .message').remove();
$('.container:eq(1)').prepend('<div class="message error"><div class="container">The captcha is incorrect.</div></div>'); $('.container:eq(1)').prepend('<div class="message error"><div class="container">The captcha is incorrect.</div></div>');
} else if (redirect_url.indexOf('invalid') > -1) { } else if (redirect_url.indexOf('invalid') > -1) {
// burn on read $('#create_encrypted').parent().html('<p>' + redirect_url + '#' + key + '</p>');
redirect_url = redirect_url.replace('" /><!-- behind you -->', '#' + key + '" />')
$('#create_encrypted').parent().html('<p>' + redirect_url + '</p>');
} else { } else {
window.location.href = base_url + redirect_url + '#' + key; window.location.href = base_url + redirect_url + '#' + key;
} }
@ -203,13 +201,13 @@ ST.crypto = function () {
} }
$('.meta .spacer:first').hide(); $('.meta .spacer:first').hide();
$('.qr').hide(); $('.qr').hide();
} catch (e) { } } catch (e) {}
} }
} }
} }
// generate a random key // generate a random key
ST.crypto_generate_key = function (len) { ST.crypto_generate_key = function(len) {
var index = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'; var index = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
var key = ''; var key = '';
for (var i = 0; i < len; i++) { for (var i = 0; i < len; i++) {
@ -218,7 +216,7 @@ ST.crypto_generate_key = function (len) {
return key; return key;
} }
ST.dragdrop = function () { ST.dragdrop = function() {
$("#code").fileReaderJS({ $("#code").fileReaderJS({
// CSS Class to add to the drop element when a drag is active // CSS Class to add to the drop element when a drag is active
dragClass: "drag", dragClass: "drag",
@ -237,7 +235,7 @@ ST.dragdrop = function () {
// How to read any files not specified by readAsMap // How to read any files not specified by readAsMap
readAsDefault: 'DataURL', readAsDefault: 'DataURL',
on: { on: {
loadend: function (e, file) { loadend: function(e, file) {
try { try {
var words = CryptoJS.enc.Base64.parse(e.target.result.split(',')[1]); var words = CryptoJS.enc.Base64.parse(e.target.result.split(',')[1]);
var utf8 = CryptoJS.enc.Utf8.stringify(words); var utf8 = CryptoJS.enc.Utf8.stringify(words);
@ -252,7 +250,7 @@ ST.dragdrop = function () {
}); });
} }
ST.ace_init = function () { ST.ace_init = function() {
// prepare the editor, needs to be a div // prepare the editor, needs to be a div
var $code = $('#code'); var $code = $('#code');
@ -277,16 +275,16 @@ ST.ace_init = function () {
ST.ace_editor = ace.edit("editor"); ST.ace_editor = ace.edit("editor");
ST.ace_editor.setTheme("ace/theme/clouds"); ST.ace_editor.setTheme("ace/theme/clouds");
ST.ace_editor.getSession().setValue($code.val()); ST.ace_editor.getSession().setValue($code.val());
ST.ace_editor.getSession().on('change', function (e) { ST.ace_editor.getSession().on('change', function(e) {
$code.val(ST.ace_editor.getValue()); $code.val(ST.ace_editor.getValue());
}); });
ST.ace_setlang(); ST.ace_setlang();
$('#lang').change(function () { $('#lang').change(function() {
ST.ace_setlang(); ST.ace_setlang();
}); });
} }
ST.ace_setlang = function () { ST.ace_setlang = function() {
var lang = $('#lang').val(); var lang = $('#lang').val();
var mode = ''; var mode = '';
try { try {
@ -300,12 +298,12 @@ ST.ace_setlang = function () {
ST.ace_editor.getSession().setMode("ace/mode/" + mode); ST.ace_editor.getSession().setMode("ace/mode/" + mode);
} }
ST.codemirror_init = function () { ST.codemirror_init = function() {
if (typeof CodeMirror == 'undefined') { if (typeof CodeMirror == 'undefined') {
return false; return false;
} }
ST.cm_modes = $.parseJSON($('#codemirror_modes').text()); ST.cm_modes = $.parseJSON($('#codemirror_modes').text());
$('#lang').change(function () { $('#lang').change(function() {
ST.codemirror_setlang(); ST.codemirror_setlang();
}); });
if (typeof ST.cm_editor == 'undefined') { if (typeof ST.cm_editor == 'undefined') {
@ -319,12 +317,12 @@ ST.codemirror_init = function () {
ST.codemirror_setlang(); ST.codemirror_setlang();
} }
ST.codemirror_setlang = function () { ST.codemirror_setlang = function() {
var lang = $('#lang').val(); var lang = $('#lang').val();
var mode = ST.cm_modes[lang]; var mode = ST.cm_modes[lang];
$.get(base_url + 'main/get_cm_js/' + lang, $.get(base_url + 'main/get_cm_js/' + lang,
function (data) { function(data) {
if (data != '') { if (data != '') {
ST.cm_editor.setOption('mode', mode); ST.cm_editor.setOption('mode', mode);
} else { } else {
@ -334,11 +332,11 @@ ST.codemirror_setlang = function () {
'script'); 'script');
} }
ST.clickable_urls = function () { ST.clickable_urls = function() {
$('.container .row .span12').linkify(); $('.container .row .span12').linkify();
} }
ST.init = function () { ST.init = function() {
ST.show_embed(); ST.show_embed();
ST.spamadmin(); ST.spamadmin();
ST.line_highlighter(); ST.line_highlighter();
@ -349,6 +347,6 @@ ST.init = function () {
ST.ace_init(); ST.ace_init();
}; };
$(document).ready(function () { $(document).ready(function() {
ST.init(); ST.init();
}); });

View File

@ -1,21 +1,21 @@
var ST = window.ST || {}; var ST = window.ST || {};
ST.show_embed = function () { ST.show_embed = function() {
$embed_field = $('#embed_field'); $embed_field = $('#embed_field');
var lang_showcode = $embed_field.data('lang-showcode'); var lang_showcode = $embed_field.data('lang-showcode');
$embed_field.hide(); $embed_field.hide();
$embed_field.after('<a id="show_code" href="#">' + lang_showcode + '</a>'); $embed_field.after('<a id="show_code" href="#">' + lang_showcode + '</a>');
$('#show_code').live('click', $('#show_code').live('click',
function () { function() {
$(this).hide(); $(this).hide();
$embed_field.show().select(); $embed_field.show().select();
return false; return false;
}); });
}; };
ST.expand = function () { ST.expand = function() {
$('.expander').show(); $('.expander').show();
$('.expand').click(function () { $('.expand').click(function() {
if ($('.paste').hasClass('full')) { if ($('.paste').hasClass('full')) {
return false; return false;
} }
@ -35,16 +35,16 @@ ST.expand = function () {
}); });
}; };
ST.spamadmin = function () { ST.spamadmin = function() {
if ($('.content h1').text() == 'Spamadmin') { if ($('.content h1').text() == 'Spamadmin') {
$('.content .hidden').show(); $('.content .hidden').show();
$('.content .quick_remove').live('click', function (ev) { $('.content .quick_remove').live('click', function(ev) {
var ip = $(ev.target).data('ip'); var ip = $(ev.target).data('ip');
if (confirm('Delete all pastes belonging to ' + ip + '?')) { if (confirm('Delete all pastes belonging to ' + ip + '?')) {
$.post(base_url + 'spamadmin/' + ip, { $.post(base_url + 'spamadmin/' + ip, {
'confirm_remove': 'yes', 'confirm_remove': 'yes',
'block_ip': 1 'block_ip': 1
}, function () { }, function() {
window.location.reload(); window.location.reload();
}); });
} }
@ -53,9 +53,9 @@ ST.spamadmin = function () {
$(document).tooltip({ $(document).tooltip({
items: "td.first a", items: "td.first a",
content: function (done) { content: function(done) {
var pid = $(this).attr('href').split('view/')[1]; var pid = $(this).attr('href').split('view/')[1];
$.get(base_url + 'view/raw/' + pid + '?preview', function (data) { $.get(base_url + 'view/raw/' + pid + '?preview', function(data) {
done(data); done(data);
}); });
}, },
@ -65,21 +65,21 @@ ST.spamadmin = function () {
} }
// needed by .selectable // needed by .selectable
$.fn.addBack = function (selector) { $.fn.addBack = function(selector) {
return this.add(selector == null ? this.prevObject : this.prevObject.filter(selector)); return this.add(selector == null ? this.prevObject : this.prevObject.filter(selector));
} }
$('.selectable>tbody').selectable({ $('.selectable>tbody').selectable({
filter: 'tr', filter: 'tr',
cancel: 'a', cancel: 'a',
stop: function () { stop: function() {
var $deletestack = $(".paste_deletestack"); var $deletestack = $(".paste_deletestack");
var $input = $("input[name=pastes_to_delete]"); var $input = $("input[name=pastes_to_delete]");
$('.inv').show(); $('.inv').show();
$deletestack.empty(); $deletestack.empty();
$input.empty(); $input.empty();
var res = []; var res = [];
$(".ui-selected").each(function (i, el) { $(".ui-selected").each(function(i, el) {
var id = $('a', el).attr('href').split('view/')[1]; var id = $('a', el).attr('href').split('view/')[1];
res.push(id); res.push(id);
}); });
@ -89,18 +89,18 @@ ST.spamadmin = function () {
}); });
}; };
ST.line_highlighter = function () { ST.line_highlighter = function() {
var org_href = window.location.href.replace(/(.*?)#(.*)/, '$1'); var org_href = window.location.href.replace(/(.*?)#(.*)/, '$1');
var first_line = false; var first_line = false;
var second_line = false; var second_line = false;
$('.text_formatted').on('mousedown', function (ev) { $('.text_formatted').on('mousedown', function(ev) {
if (ev.which == 1) { // left mouse button has been clicked if (ev.which == 1) { // left mouse button has been clicked
window.getSelection().removeAllRanges(); window.getSelection().removeAllRanges();
} }
}); });
$('.text_formatted').on('click', 'li', function (ev) { $('.text_formatted').on('click', 'li', function(ev) {
var $this = $(this); var $this = $(this);
var li_num = ($this.index() + 1); var li_num = ($this.index() + 1);
if (ev.shiftKey == 1) { if (ev.shiftKey == 1) {
@ -129,7 +129,7 @@ ST.line_highlighter = function () {
ST.highlight_lines(); ST.highlight_lines();
} }
ST.highlight_lines = function () { ST.highlight_lines = function() {
var wloc = window.location.href; var wloc = window.location.href;
if (wloc.indexOf('#') > -1) { if (wloc.indexOf('#') > -1) {
$('.text_formatted .container li').css('background', 'none'); $('.text_formatted .container li').css('background', 'none');
@ -152,9 +152,9 @@ ST.highlight_lines = function () {
} }
} }
ST.crypto = function () { ST.crypto = function() {
$('button[name=submit]').after('<button id="create_encrypted">Create encrypted</button>'); $('button[name=submit]').after('<button id="create_encrypted">Create encrypted</button>');
$('#create_encrypted').on('click', function () { $('#create_encrypted').on('click', function() {
var $code = $('#code'); var $code = $('#code');
// encrypt the paste // encrypt the paste
@ -176,14 +176,12 @@ ST.crypto = function () {
'captcha': $('#captcha').val(), 'captcha': $('#captcha').val(),
'reply': $('input[name=reply]').val() 'reply': $('input[name=reply]').val()
}, },
function (redirect_url) { function(redirect_url) {
if (redirect_url.indexOf('E_CAPTCHA') > -1) { if (redirect_url.indexOf('E_CAPTCHA') > -1) {
$('.content .container .message').remove(); $('.content .container .message').remove();
$('.content .container').prepend('<div class="message error"><div class="container">The captcha is incorrect.</div></div>'); $('.content .container').prepend('<div class="message error"><div class="container">The captcha is incorrect.</div></div>');
} else if (redirect_url.indexOf('invalid') > -1) { } else if (redirect_url.indexOf('invalid') > -1) {
// burn on read $('#create_encrypted').parent().html('<p>' + redirect_url + '#' + key + '</p>');
redirect_url = redirect_url.replace('" /><!-- behind you -->', '#' + key + '" />')
$('#create_encrypted').parent().html('<p>' + redirect_url + '</p>');
} else { } else {
window.location.href = base_url + redirect_url + '#' + key; window.location.href = base_url + redirect_url + '#' + key;
} }
@ -232,13 +230,13 @@ ST.crypto = function () {
} }
$('.meta .spacer:first').hide(); $('.meta .spacer:first').hide();
$('.qr').hide(); $('.qr').hide();
} catch (e) { } } catch (e) {}
} }
} }
} }
// generate a random key // generate a random key
ST.crypto_generate_key = function (len) { ST.crypto_generate_key = function(len) {
var index = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'; var index = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
var key = ''; var key = '';
for (var i = 0; i < len; i++) { for (var i = 0; i < len; i++) {
@ -247,7 +245,7 @@ ST.crypto_generate_key = function (len) {
return key; return key;
} }
ST.dragdrop = function () { ST.dragdrop = function() {
$("#code").fileReaderJS({ $("#code").fileReaderJS({
// CSS Class to add to the drop element when a drag is active // CSS Class to add to the drop element when a drag is active
dragClass: "drag", dragClass: "drag",
@ -266,7 +264,7 @@ ST.dragdrop = function () {
// How to read any files not specified by readAsMap // How to read any files not specified by readAsMap
readAsDefault: 'DataURL', readAsDefault: 'DataURL',
on: { on: {
loadend: function (e, file) { loadend: function(e, file) {
try { try {
var words = CryptoJS.enc.Base64.parse(e.target.result.split(',')[1]); var words = CryptoJS.enc.Base64.parse(e.target.result.split(',')[1]);
var utf8 = CryptoJS.enc.Utf8.stringify(words); var utf8 = CryptoJS.enc.Utf8.stringify(words);
@ -281,7 +279,7 @@ ST.dragdrop = function () {
}); });
} }
ST.ace_init = function () { ST.ace_init = function() {
// prepare the editor, needs to be a div // prepare the editor, needs to be a div
var $code = $('#code'); var $code = $('#code');
@ -306,16 +304,16 @@ ST.ace_init = function () {
ST.ace_editor = ace.edit("editor"); ST.ace_editor = ace.edit("editor");
ST.ace_editor.setTheme("ace/theme/clouds"); ST.ace_editor.setTheme("ace/theme/clouds");
ST.ace_editor.getSession().setValue($code.val()); ST.ace_editor.getSession().setValue($code.val());
ST.ace_editor.getSession().on('change', function (e) { ST.ace_editor.getSession().on('change', function(e) {
$code.val(ST.ace_editor.getValue()); $code.val(ST.ace_editor.getValue());
}); });
ST.ace_setlang(); ST.ace_setlang();
$('#lang').change(function () { $('#lang').change(function() {
ST.ace_setlang(); ST.ace_setlang();
}); });
} }
ST.ace_setlang = function () { ST.ace_setlang = function() {
var lang = $('#lang').val(); var lang = $('#lang').val();
var mode = ''; var mode = '';
try { try {
@ -329,12 +327,12 @@ ST.ace_setlang = function () {
ST.ace_editor.getSession().setMode("ace/mode/" + mode); ST.ace_editor.getSession().setMode("ace/mode/" + mode);
} }
ST.codemirror_init = function () { ST.codemirror_init = function() {
if (typeof CodeMirror == 'undefined') { if (typeof CodeMirror == 'undefined') {
return false; return false;
} }
ST.cm_modes = $.parseJSON($('#codemirror_modes').text()); ST.cm_modes = $.parseJSON($('#codemirror_modes').text());
$('#lang').change(function () { $('#lang').change(function() {
ST.codemirror_setlang(); ST.codemirror_setlang();
}); });
if (typeof ST.cm_editor == 'undefined') { if (typeof ST.cm_editor == 'undefined') {
@ -346,12 +344,12 @@ ST.codemirror_init = function () {
ST.codemirror_setlang(); ST.codemirror_setlang();
} }
ST.codemirror_setlang = function () { ST.codemirror_setlang = function() {
var lang = $('#lang').val(); var lang = $('#lang').val();
var mode = ST.cm_modes[lang]; var mode = ST.cm_modes[lang];
$.get(base_url + 'main/get_cm_js/' + lang, $.get(base_url + 'main/get_cm_js/' + lang,
function (data) { function(data) {
if (data != '') { if (data != '') {
ST.cm_editor.setOption('mode', mode); ST.cm_editor.setOption('mode', mode);
} else { } else {
@ -361,11 +359,11 @@ ST.codemirror_setlang = function () {
'script'); 'script');
} }
ST.clickable_urls = function () { ST.clickable_urls = function() {
$('.paste .container').linkify(); $('.paste .container').linkify();
} }
ST.init = function () { ST.init = function() {
ST.expand(); ST.expand();
ST.show_embed(); ST.show_embed();
ST.spamadmin(); ST.spamadmin();
@ -377,6 +375,6 @@ ST.init = function () {
ST.ace_init(); ST.ace_init();
}; };
$(document).ready(function () { $(document).ready(function() {
ST.init(); ST.init();
}); });

View File

@ -38,12 +38,12 @@
</div> </div>
<div class="item"> <div class="item">
<label for="code"><?php echo lang('paste_yourpaste'); ?> <label for="paste"><?php echo lang('paste_yourpaste'); ?>
<span class="instruction"><?php echo lang('paste_yourpaste_desc'); ?></span> <span class="instruction"><?php echo lang('paste_yourpaste_desc'); ?></span>
<span class="instruction"><a href="#" id="enable_codemirror" data-lang-enablesynhl="<?php echo lang('paste_enablesynhl'); ?>" data-lang-disablesynhl="<?php echo lang('paste_disablesynhl'); ?>"></a></span> <span class="instruction"><a href="#" id="enable_codemirror" data-lang-enablesynhl="<?php echo lang('paste_enablesynhl'); ?>" data-lang-disablesynhl="<?php echo lang('paste_disablesynhl'); ?>"></a></span>
</label> </label>
<textarea id="code" name="code" cols="40" rows="20" tabindex="4" required><?php if(isset($paste_set)){ echo $paste_set; }?></textarea> <textarea id="code" name="code" cols="40" rows="20" tabindex="4"><?php if(isset($paste_set)){ echo $paste_set; }?></textarea>
</div> </div>